TileMap Suggestions - Player Built Map

Godot Version

4.2

Question

Hoping to get some suggestions as a noob here. What I want is to allow players to place hexagon tiles to dynamically build a map. I’ll need to highlight locations where a tile can be placed based on some map building rules. The player will be allowed to rotate the tile (which will update valid location highlighting).

My main question is whether or not to invest time learning tilemaps or just use a custom node and manually managing placement? Tilemap seems to be more designed for platform level building, so I don’t know if it will do what I want.

Thanks!

The TileMap does have an option for a hexagonal grid. I think it would he worth using, as it’s really flexible. I’m a noob myself and I couldn’t imagine making a different system from scratch. You can definitely use tilemaps for top down things. You can also get locations of cells eother directly or with a formula based on cell size. You could likewise find which tile your mouse is over. You can probably make it work.

Thanks. I was hoping this would work, didn’t like the idea of reinventing the wheel!

1 Like

Looks like I’ll have to use my own design. I doesn’t look like there is a decent way to rotate hex tiles 60 degrees. I’m also using regions within a hex tile and will need to place props at different positions on the tile. Don’t like it, but it seems easier to figure out position data manually and not have to compromise with the Tilemap limitations.

Shame. I just found out that Godot stores tile rotations as a number between 0–23, corresponding to the 24 unique orthogonal rotations and flips of a square. It’s built from the ground up to only be used with squares.

An update in case others run into this. I ended up making a sprite sheet for each tile which contained an image of each rotation. Using the atlas coordinates this allowed me to emulate hex rotations.

My latest issue is a disappointing. I looked at adding scenes to tiles. I was really excited about this at first. Sounded like an awesome way to managing units in a cell (I have large hexagons and wanted to put multiple units in various positions in the tile) using a flowcontainer. Alas, after getting the layer setup and seemingly working I discovered that you can’t rely on the scene instances existing at any point in time. I validated this by dragging a node on top of the tilemap at runtime and observed the instances being removed. Bummer.