Generating Maps

There is an example made by Epic, I think in the Unreal Marketplace, for free. I think it is called Turn-Based Strategy Game Example or something like that.

I goes into 2 main subjects: Grid-based random map generation and A* navigation for AI (an alternative to the navmesh).

I created a very simple random maze generator for my game Scooty Shooty (not published yet, but close - just gotta resolve a few more bugs, but the maze generation works perfectly every time) by looking up on Google an algorithm that gives the kind of maze I wanted, and creating that in Unreal. I made a struct that stores where there are walls on each floor tile (north south east and west), along with whether it has already visited that tile, and some other data, and I used the algorithm over an array of these structs to “carve” out the paths of the maze by flipping the flag for each wall to FALSE wherever there shouldn’t be a wall.

The algorithm I used is recursive and I was doing this in Blueprints, so I had to change my project settings to allow more than 250 function calls on the runtime stack. I also had to make sure the recursion was working properly (it used to keep on drilling down for every tile and every direction, instead of popping back up when it had completed a path!)

That’s just one way to do it, which may or may not meet your needs.