T_Bag was ready for GO_Container to inherit from, but what blocked it was the way game objects are saved with a template routine which is creating only the default constructor object. Now I'm sure it's a bad way to do it, because what happens is that when you load the object all pointer composite classes are re-created in the Load()-routine. I guess it's not that bad, but still it would be more appropriate to always create the whole object with the constructor.
It's certainly not impossible or even hard to fix, because all you have to do is save the type of object and then write routines for each object type with specific extra information about the constructor parameters. In this case the container (GO_Container) has to know what kind of T_Bag class it has during the construction, in fact before it by passing the container type to GO_Container's constructor. This information has to be saved and loaded outside the class of course, because you can't create the instance before knowing what kind of class it is.
The way I solved the wrapper function problem for now was indeed making the container component accessible to the player and level classes, and using class->component->Do_Something(); notation.
Other than that I've pretty much cleaned the simple game object classes. The base class has some message related routines which need fixing, but it requires the new message routine not yet ready. The main focus is now in Item and then Creature classes. The problem with those is not only the size and increased compexity but the fact that they are often more connected to the role-playing system. When I was programming the previous versions it was quite easy, because there wasn't any role-playing system worth mentioning. The game has now a HP value and some damage amounts which are totally not in balance at all. The easiest way to kill enemies is just throw something at them which they can't do in return.
I have to be more clever with the RPG system than before and try to keep things really simple. Luckily there is no magic or other difficult issues, only damage with various ways and HP. The new RPG system is probably going to be similar to that, but more balanced and slightly more complex with armour protection.
No comments:
Post a Comment