I am wonder me, whats the best data structure for a ship like in FTL. At first I thought its easy and I need only to make a array with the rooms(Tiles). But than I noted, that I must put somewhere the doors, walls, weapons, crew and systems. And with this Aspect I don't know a clean data structure. Have someone a idea ?

enter image description here

If there is something unclear write it and I try to explain.


1 Answer 1


I'd go with 2D tile map of size X / Y. It is much easier for representation and pathfinding.

Each tile would have a bunch of properties alike:

  • room_type,
  • oxygenation_level
  • hasFire
  • etc.

Having these it will be map editor responsibility to make sure certain rooms have proper size (e.g. 2x2). That will also give you freedom to make different sized rooms (e.g. double-packed engine room of 3x2).

Also keep a second structure for tile/tile markers (e.g. tile also stores properties for bottom and right walls):

  • wall_type_right,
  • is_door_bottom,
  • etc.

In FTL weapons have static mounting points, so you can go with just a list and locations relative to your map, with regard to ship graphics (probably pixel coordinates).

Crew are just units living on a tile-map.

Systems are just entities that exist or not basing on existence and functioning of the rooms on the ship.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .