Goodbye XNA. Hello MonoGames

XNA was abandoned by Microsoft many years ago. But even now I have still been using it, that is untill MonoGames has become a viable alternative.

I have therefore spent my time on holiday converting Craft Empire over to MonoGames. The main advantage is cross-platform. Been able to target Andriod, IOS, Windows and Mac with 99% of the same code is awesome indeed. The MonoGames team really deserve a lot of gratitude for make such an awesome framework.

MonoGames also uses the same functions as XNA meaning that most of your XNA code will work out the box. I say most as there is still a lot of work porting your code over.

Anyhow gone is my dependence on needed the XNA framework installed on the users pc. Now the user will have the option of using DirectX or OpenGL.

Goodbye XNA. Hello MonoGames

Block Data

I have finally managed to be able to store both block rotate and block data with in the same byte.

This means that the game will use a lot less memory meaning we can have bigger worlds and there is more chance it running on phones and tablets.

However the downside is that since I need 3 bits for the rotation I only have 5 bits for the data meaning I can only have a total of 32 different states for the block data on any block that can rotate.

 

Block Data

Building UI

Last week I did work on the building UI. It was a complete nightmare!

I wanted the UI to show you a preview of the building that you are going to build. Therefore if the user creates there own building the UI will automatically create a preview for that building for you to see. It was a pain.

Now for the technical bit for you who are interested.

Step:

  1. The end result is the building is render to a back-buffer.
  2. Then take this image and find the nearest pixels to each edge of the texture.
  3. Remove the rest of the image just leaving the rendered building
  4. Scale that texture to the correct size.

The result is something I am happy with. Its not to bad on performance either.

Building UI

UI

Yesterday was all about the user interface. Iv still got a long way to go in this regarded but a lot of progress has been made. For starters 99% of the UI has been made resolution Independent. This mean that the UI will automatically adjust if the screen resolution is changed. This is all handled through an event that get fired at startup and every time the resolution changes.

I also added a UI to show what resources are required to build each building and added a check so that you can not start building anything that you don’t have enough resources for. This is only a basic representation of what I want to achieve in the future when it comes to buildings been built but it will do for now. In the future I want the builders to actually walk to the warehouse collect the resources and then bring them back and start building. I have not worked out all the details yet but either way its some time in the future that I will be tacking that issue.

UI

woodcutter

today I managed to add a new job woodcutter. Selecting a worker then selecting a tree will send the worker off to chop it down. I thought it would be easy to then get the worker to find the nearest tree and go chop it down. It turned out to be a lot more complex than I thought. :/

in the end I got it to work though and now we have tree slayers in the game :)

 

woodcutter

Jobs

This week I have been working on jobs in Block Empire. Jobs are basically what you would assign to villagers. For example you can have a Walking to a location, Building something, Mining or Tree Cutter jobs.

Surprisingly though there are little jobs that I never thought about. I was working on a way to garrison villagers like when they go in to a mine. I never imaging that to do so I would have to make a job for garrison. :)

Anyway the main job class is built and so are some sub classes like walking and garrisoning. Hopefully I will be able to add more jobs in the next few days.

Jobs

Block Empire

Now that all the other things have been done. I have turned my attention back to block empire.

Over the next 2 weeks I will be working heavily on the project. We will have a new name for it and someone else has joined the project. More on that later.

On another note we are going to have a fundraiser on Kick Starter to get the game funded for production.

Block Empire