Learning Tile Based Games

Tile based games uses tiles as one of the fundamental elements of play. Traditional tile-based games use small tiles as playing pieces for gambling or entertainment games. Some board games use tiles to create their board, giving multiple possibilities for board layout, or allowing changes in the board geometry during play.

A tilemap is essentially an grid of cells where the value in the cell indicates what should be at that location. So we we might define “1” as grass and “2” as mud and define a map using these values describing an area in the game.

The first nice thing about tilemaps is they’re simple. Its very easy to implement a tilemap using a standard two dimensional array. You simply fill it full of values and access them using x/y coordinates.

The second nice thing about tilemaps is that they often save space. You only define the properties of a particular tile type once. You then reuse that set of properties over and over by referencing it form the tilemap.

The last nice thing (that I can think of) about tilemaps is that they’re quick to access. Given a particular location on the map it can be very fast to get to the properties associated with that area. Normally its simply a matter of accessing into an array based on the x/y location of an entity.