Saturday, 7 June 2014

Tile class

Today I was thinking about possibility to create a Tile class. The way it's now done is separate map instances for things like terrain, masks and game objects. When I started Kaduria it was a solution like anything else, but it has been difficult to manage maps since then. A combined Tile class would take lot of source code from Level class and place it in a smaller, more manageable class.

The bad thing about this is not a surprise: it's a big refactoring task. Is it really needed or should I just go with the current system? Maybe I should try to estimate the amount of work needed. It's maybe possible if you look at the calls to map handles, how and where they are used.


  1. Your current approach sounds like one I'm actually quite fond of, which has treated a few of my projects well and is used in Brogue.

    What are the particular issues you're running into?

  2. Each tile has many layers of data and they each require a map. I think by combining everything into a tile object it's easier to use the map, because many operations can be done within the tile class (or in a single map class), without get/sets from maps. With a proper Tile class it should become easier for me to fight the complexity better in that area of the source code. And even if it doesn't work that way, it's still working just as well as the current style. I think it can't be worse than having around 15 maps for each layer of data.