Wednesday, June 1, 2016

Code pollution

Well time fly by and animation system starting take shape. Thanks to it I could do even some not bad looking animations in game (http://coffemonsters.blogspot.co.uk/2016/05/lba-preview-15.html) but well this is just another milestone in road to finished game. 

Because of this thoughts I already moved to next issue: recovering of movie system. So far its going fine I added new movie resource, movie editor module. No I starting adding basic functionality: adding keys. This operation require list of selected objects in level.

This part was designed great :D Because I can have N levels loaded in memory in the same time I created new level component which exist only in editor. It contain some editor specific data i.e. selection. It's added on loading from editor and it's not saved with level. When you want list of selected objects just pick component from level and I have access to selection. Great idea right ? 


I thought this way when I was writing it. Right now I think it was good direction but it's still "Code pollution". Editor code and game code start mixing which is always harder to manage. On top of that Editor tools component is visible in level properties and yes I know I could hide it in code but then you create hack/some new code path which create new issues. Leaving it is also not any option because this is weird for person who work in tools. When there is something you didn't add you have temptation to remove it (I know what this it and that I shouldn't remove it but still don't like how it pollute my level setup) :D

My another iteration over this problem will be: 

LevelEditorModule would replace level component and thanks to that became independent from level. Advantage of this system is that it should be relatively easy progression from existing code. Just a little bit of time. 

This may look like something stupid to do when I'm already limited by time and doing so many other stuff. Yeah you may be right. I never was too wise in this situations I prefers spending evening or two improving code which works than add new feature to game. Thanks to that I won't have maybe nice feature which will look nice at picture or video but I will have code which will supporting my efforts in creating games. Then features will be easier and funnier to work on :)

Greg

No comments:

Post a Comment