Tuesday, February 22, 2011

Re-arrangements

So this week I did a lot of reorganization code-wise.

I moved a whole bunch of code around between files, trying to find a good configuration with as little dependency overlap as possible while giving each class or function access to the other classes and functions that they would need access to. It was a bit of a shuffle but I'm happy with how things are now. I'll most definitely do this a few more times over the lifespan of the project, but that's what you get when your aim is mostly short-term progress. The upside to this approach is that I'm fixing problems as they arise, rather then trying to set up a structure to prevent every problem I might possibly encounter. The later is the reason another project is currently in limbo. This whole experience should give me some great insight in how to structure a project, which will be invaluable the next time I start, or continue, a project.

To not bother you too much with specifics on this, let me just leave you with the schematic I drew which helped me organize my code in an adequate fashion.

On to things I did that have a more practical result in the program. I redesigned the Editor layout (see screenshot below) so that you can easily pick a tool from the toolbox and then a brush and get to building. This whole ordeal brought on the creation of a system that handles drawing and manipulation of on screen buttons and panels, as well as mouse handling. You can see these in the above schematic as 'Graphical Interface' and 'Mouse' respectively.

The Cubewars editor currently only works to place world tiles, so you can make a maze to maneuver through or make jump puzzles or whatever. I'm currently getting the static_actor and goody classes to work as well, but that was a little less straightforward so I'm still on that. It should be implemented by next week. I've also figured out how backgrounds will be handled. In your level you can simply define which background # to use, and the game loads the bg#.bmp file that corresponds with that number. It's really simple stuff.

I also fixed a truckload of bugs and worked out a ton of kinks everywhere, but that's so specific it ceases to be relevant reading for anyone but myself. Rest assured though, awesome things happened behind the scenes.

Though, on a last note, I do hope that I can do some more visible things in the coming week. It just feels more rewarding to say to yourself that you got X in the game.

See you then!

No comments: