So I have decided to try and give regular updates every Monday on the progress of The Genesis Project. These updates will be focused on what has been done the past week and likely what will be attempted the upcoming week. We may occasionally do extra posts if we have something more in depth to cover. This past week we have been refactoring our proof of concept and are probably over half way done. So what does this mean?
In software refactoring is taking something that is working, breaking it and then putting it back together in a better way. When you are done you will seem to be right where you started but things behind the scenes will be much better off. A good non-software example of this is if you break your arm. The doctor might have to break it again in order to get it to set right.
You might be wondering what types of things are we refactoring. Many might be a bit too technical for this point but I can give one example. Games have to rely a lot of co-ordinates or "where are things at". What makes our game interesting in that area is we have two sets of co-ordinates we can use. One is the 'normal' set you would think of as a typical X and Y number. This tells us for example exactly where in the world each character or object will be. We also break our worlds up into 'tiles' of a certain size. We will cover what this means more in the future but a short version is we have a 'grid' we break the maps up into. So we also need to track which 'tile' or 'grid' a character or object is on.
If you were thinking that this does not sound too bad then you would be right. By itself this is not an issue. However the idea of 'tiles' was added after we had a big part of the work done. So in many places in our code we are expecting a 'point' (the non-tile co-orindate), in others we were expecting a 'tile' co-ordinate. To make things even worse some places expected the X and Y to be split as two different values and some expected them as a 'pair'.
This is a perfect type of thing to refactor. We create what we call a 'Point' object that contains data on both the tile and non-tile co-orindates and are using this everywhere to refer to a location in the world. There are several benefits to this, mostly in cleaner and more consistent code. We know every time we are dealing with a location what to expect.
Well this already ran longer then expected but feel free to leave comments or ask questions if this does not make much sense. Otherwise you will hear something from us again before too long!