Tuesday, 27 June 2017

Level class management

After about 12 years of C++ programming I had an idea to split the Level class. Actually I did it to downward direction when I derived some level themes from Level class, but now I'm planning to split the level class to four classes with a linear deriving order.

The base level class is going to be a container for tile map and game objects. It also has tile-based functions for things like creating a single tile. Another idea I had is that the tile map pieces will be null unless there is a tile object. Also, the tiles should be created on first priority which means what is created first will not be overwritten by another tiles. Well, other than creating wall tiles on floor tiles which is going to happen anyway.

The second level class will be shapes class with features that create anything from rivers to rooms.

The third level class will be the sequence of creation (which is different for some level themes).

And the fourth class will be the operation class during gameplay which handles actions with game objects and the level.

A nice thing about deriving is that I can simply copy-paste the existing source code from Level class upward in classes without any modifications needed. So it's a big task, because the Level class is huge, but still quite easy one.

No comments:

Post a comment