Possseidon/the-depths

Make map size dynamic.

Closed this issue · 0 comments

Thanks for the idea oninoni!

Idea

Currently the map is 5 levels of a fixed 8x8 grid. While cool, this is quite large and even just a single level takes quite some time to traverse (even without monsters). The 8x8 was initially used because it fits on an in-game map perfectly.

Things to consider

Make in-game maps still work

The generated map should stay centered, so that in-game maps look good. Furthermore, the border should be filled with grass or some other solid color. (Or some cool pattern, but that's probably not worth the effort... Let's see)

Minimum size

To fit in four dead ends, including one 2x2 for the boss room, quite a bit of minimal space is necessary.

5x2 (10 tiles, 3 regular)

|[BO][A][B][C]|
|[SS]-'--'--' |

Is technically the smallest you can go, although it might take quite a few attempts until generation succeeds. The map being incredibly small means it doesn't take very long to generate either, so a lot of attempts aren't necessarily a problem. You also barely see any regular tiles in this configuration and you can't really call this a maze.

4x4 (16 tiles, 9 regular)

Still very small with only a handful of regular tiles. You will probably see barely any long straights, as they have to go across the entire map. Still, probably a good minimum size all things considered, albeit not recommended for a full experience of the game.

5x5 (25 tiles, 18 regular)

Probably a good size for short rounds.

6x6 (36 tiles, 29 regular)

A good size for medium rounds.

7x7 (49 tiles, 42 regular)

A good size for long rounds.

8x8 (64 tiles, 57 regular)

For long, looooong rounds.

Default

I feel like 5x6 (30 tiles, 23 regular) feels like a decent default for normal solo runs.

Players should be able to choose freely from 4x4 to 8x8 with any combination in between.

Implementation details

Filling the map with grass

This can simply be down in one fell swoop when also covering everything with tinted glass across the entire map.

Storing the map size

Using the var objective with width and height players is probably ideal here. NBT storage would also be an option, however comparisons are a lot easier done with scoreboards.

Centering the map

After generation is done, teleport everything by half a tile towards the center for each width/height increment respectively.

Limiting the grid

Similar to centering the map, have a marker that kills everything outside an 8x8 box and move it to overlap the grid for each width/height increment. Boss tiles are currently hard coded only inside a python script using the can_big tag. This somehow needs to be moved outside and can also be achieved with the same box mechanic.