I've been working on a turn based tile map based game using artemis-odb and libGDX.
I wanted different terrain types for the map such as grass, sand, water, mountains and so forth, with each of these different terrain types having different movement costs to pass through and various additional properties pertinent to the game play.
I'm considering a couple different approaches currently:
I could make the map a system
GameMapSystem
and have each type of terrain represented by an entity with the relevant components for each type of terrain (TerrainStats
, and occasionally spell effect componentsExploding
for instance). My main concern is how to manage the mapping of tiles to terrain type entities. Conceptually that should be as easy as maintaining anint[][]
with the values corresponding to the id of the terrain entity, however in that case the temporary marker components (Exploding
) would be attached to all of a given terrain type at a time. This seems less than optimal. So then would I need to have a separate entity for each tile then? Aren't I creating additional overhead for the entity framework if I do that then?I've also considered making the game map and terrain types POJOS and then simply creating marker entities with the marker components for the special effects. Doing it this way however, it looks like I'd be passing the
GameMap
object around willy-nilly in order to have various systems be able to process on it (for rendering, collision, pathing, etc). In addition, wouldn't my game map then need to also track the entities that are ON the map at any given time with their positions in order to do my pathing logic? I'd prefer to keep the management of the entities completely under the domain of the entity framework if possible as it means slightly easier maintenance.
I'm curious if there are any approaches that I haven't examined yet. Otherwise I feel inclined towards method #2, unless there's some way to fix method #1 that I've overlooked.