Thursday 26 January 2012

Framework classes

There are now 15 classes in the framework. Still, I want to extend the framework to higher level classes. Some of my goals are GUI itself and a generic Message class to output roguelike style messages. The current one in Kaduria is a real mess, it's very big and confusing so I have to think hard to create a better one.


This is the current list of classes and enums. Tar_Ball is a serialization class with binary/text data format. I'm quite proud of it actually. One of the problems I have to tackle is how class instances should be created. This far instances like Keyboard and Random_Generator are global, because there is only need for a single instance. It's not modular, but I don't know a better solution. Although Random_Generator could have several instances in classes where random numbers are needed, but the seeding should then happen somewhere else. Classes that are global usually can't be used as local instances, because they load stuff or are otherwise heavy to initialize.

Monday 23 January 2012

Framework

Thought it would be a good idea to create a generic framework for the next project which is that 7DRL I was talking about in the previous entry. I have programmed some modular classes during these years which I have used in my projects. You can view some of them in Teemu's source code, especially in 'classes' subdirectory. What I want to do is make them even better and for that I'm using GCC which is more anal about purity of C++. I will also compile the code with Visual C++, because it's my main development tool.

Building a framework or a library of useful generic classes is wise. It reduces the amount of time spent in setup of a new project and improves code quality since usually those classes have experienced a good amount of testing. What I also would like to achieve is a number of higher level classes that could be used as a base for each new project. For example this far each GUI class has been specific for that project, but I'm hoping to create a generic GUI class which then can be extended with new features.

Saturday 21 January 2012

Plans for the next 7DRL

I have an idea that could be implemented as 7DRL. While working on Kaduria (and Teemu) I have possibly started to think that a tile should own everything it has. In practice this means that each tile should have container list for items, flags for different stuff etc. For some people this is the way to do things anyway, but it's new to me, because this far a map has been just a collection of tiles, a simple 2D matrix. But when you think a tile as an object that can hold and own stuff it begins to look more and more a good idea. It makes many things easier, but could possibly make others harder.

Another thing I want to try is game objects without inheritance. Just one class for all game object types. It should be easier to do now when I have more knowledge about data-driven style.

If the "tile based" approach works really well there may be a brief refactoring session in Kaduria...