So its that time of the week again, I’m starting to get used to this. Last week I was hoping to complete work on transformation related tools in the editor and to be able to add new entities to the scene through the editor. But as these things usually go, I wasn’t able to get where I wanted to. I got halfway there though!
I finished work on all three transformation tools, for now anyway. As I suspected, the easiest of these turned out to be the scale tool and rotation turned out to be the most trickiest. Whenever you add more code, you increase the number of moving parts and that means a seemingly innocuous addition can have a tendency to break things in the most spectacular ways that leave you puzzled.
While these bugs are sometimes difficult to fix what can be even more confusing is how the things leading up to a particular bug worked at all. You introduce bugs into your code when the actual state of the program varies from the state of the program running in your head when writing it. The more things you have to keep track of the more likely you are to inadvertently create new problems. The series of events usually ends up something like this:
- Add new functionality
- Some bits of it work as expected and others not so much
- Attempt to fix the problems and fix most of them
- Get stuck and run in circles
- Eventually fix the problem
- Wonder why the fix actually fixes the problem
- Discover the real problem was in some other part of the code that you were sure could not have any problems so you never bothered to check it
- Add it to the ever-increasing list of things to do
All this is nothing new if you’re familiar with programming. The take away I suppose is to always test your assumptions. Still, I feel I’ve made good progress this week despite not reaching where I intended to. I actually quite like the somewhat unorthodox system I’m moving towards which feels more like placing objects in an RTS game than a level editor. Let’s see where I eventually end up with this.
The target for next week is to start work on adding entities to the scene and complete it. The types of entities will change as I work on gameplay features but I want to have a good base to work with where catering for a new entity type is as simple as adding another case to a switch statement. I suspect this is going to be the main chunk of the editor code since adding/removing entities and mofifying their properties is what a level editor is supposed to be about anyway. Let’s see how it goes.