Hexagonal Maze

by mrvn
Generates a hexagonal maze as map.
3 months ago
0.16
95
Owner: mrvn
Source: mrvn/factorio-hexmaze
Homepage: https://github.com/mrvn/factorio-hexmaze
License: GNU LGPLv3
Created: 3 months ago
Latest Version: 0.0.1 (3 months ago)
Factorio version: 0.16
Downloaded: 95 times

Hexagonal Maze mod for factorio

Creates a endless maze based on hexagonal tiles, as opposed to a square tiles maze. Instead of walls the maze the sides of the maze are formed by cliffs going down into acid (well, green water, but think acid. Don't fall in :). The maze is constructed at different scales:

1 At the mega scale each cell has a center tile positioned randomly in it's cell that has connection to it's 6 neighbor cells and there is a path between them. This means there are loops. The size of the mega scale means those loops are big. Get ready to travel if you want to make a round trip. The paths between 2 mega cells is also all twisted up and branches into dead ends filling up the remaining tiles of that scale.

2 As the middle scale each cell corresponds to a tile in the mega scale. Again a center is randomly placed in each cell, this time forming a larger cave of 6 tiles at the moment. Two centers are connected with a path if and only if the two tiles are connected at the mega scale. Again paths are twisted up and branches into dead ends are added. The dead ends grow into parts that are walls at the mega scale to cover all the map. But they don't connect with other dead ends or have caves. At this scale resources are added at dead ends following the normal rules of autoplacement in factorio as best as I could figure. So resources further away get richer.

3 At the micro scale the walls of the middle scale are turned into chasms filled with green water and bordered by cliffs. This scale is basically just there to make the walls look nicer.

Maze generation

As you explore and reveal more of the maze always more is generated. This isn't fast so chunk generation is slowed down somewhat. Expect some slowdown at the start when starting the map and when it generates all the hidden chunks at the start of the game. The game generates one chunk a second for several minutes after start before it settles down. After that it picks up speed till you explore more terrain. Map generation in lua is slow, sorry. Not much one can do about that.

The maze algorithms caches cells and tiles at the different scales. So when you explore and generate a chunk that overlaps a new mega cell that cell is generated. For other chunks the cached cells are used. So not every chunk generates at the same speed. Which also explains why the start is so bad. Lots of cells and tiles are needed for the initial chunks.

Compatibility

I only tried generating mazes with vanilla and a Bobs+Angels combo. But other mods should work too. Resources are autodetected by their autoplace data and the same data is used for probabilities, amounts, starting area and increments by distance. So to make a long story short: Other mods should work too. But they must define the ore prototypes before data-final-fixes. A optional depends might be needed if the mod messes with ores that late in the game.

The mod conflicts with rso-mod and RibboMaze for obvious reasons. Let me know if any others should be added either as optional depends or conflicts.

Inspiration

This mod was inspired by RibbonMaze but after editing that for a while I decided to start from scratch. The mazes I wanted and ideas were just to different to incorporate them into RibbonMaze. But give it a try and see which you like better.

ToDo

1 Aliens are currently disabled but not yet placed on the map by my own code. So if you are dying for a fight you are exploring the wrong maze.
2 No fish in the water.
3 Ores currently fill up all of a cell. They should be more of a blob with richer ore in the center.
4 Infinite ore probabilties are added to normal ores. Given that they have a much higher probability in angles the map ends up with 5 times more infinite ore than normal, making it hard to find normal ore at the start. So I folded them back into normal ores. Will fix when I fix 3.