Random Map Generator - A Very Early Prototype

Hi Unreal community,

After working with some minor projects, I have finally decided to work on something fresh and a little bigger in scope. I have been working on a random map generator for some time, and wonder if there are people who have similar interest in making random maps. After working on it for 2 weeks, I feel like is time to get some ideas and feedback, and the most important part is bug fixing before blueprints get out of control!

Simply put, my method is to randomly place everything using one number so that pattern can repeat again. Imagine you go from location A to location B, then go back to location A, it doesn’t make sense that location A is different when you go back. There are some conditions, such as buildings are spaced out more evenly, rivers tend to flow less random, etc.
A major weakness in my method is that the map size is predetermined (10x10) and pre-placed (not spawn in game). The map can be define by characteristics that can be set by whatever values but unfortunately some of them are mutually exclusive (valley vs mountain).

So that’s pretty much it. There are still a lot of things I have in mind, like making roads, streetlights, and start texturing. However, I have no idea what kind of game I want this to be. I have another project I need to do, but I really like to keep this going.

I would love to get some feedback and ideas. I will definitely update this possibly once a week if I have a chance, but I will answer any questions you ask. There are many things to be done, but for now I like to show you guys some screenshots and possibly a demo once I cleanup the blueprint!

Small town among the hills. It’s hard to distinguish the hills right now because there is no texture.

River valley at sunset. I still need to fix the shadows:(

City at sunrise

That’s it, hopefully I will make improvement soon.

Hi

Looks cool. Have you thought about slopes for the hills or are the vertical hills something that you want to go along with your visual style?

As for your pre-placed mape generation techniques you could go with something like that:

  • get some basic “templates” of maps as separate UE4 levels (5x5, 10x10, etc), these you woluld load from a menu level based on the choice made in the menu
  • and than you generate the rest of the random stuff in game, I guess anything you have defined with a variable you can define at the level start-up?

So by simply moving the stuff that is “hardcoded” into some options available in the game menu and preparing some basic, empty templates for that option choices you could get pretty flexible in runtime.

This looks very good. But to use something like this as a generic tool, you should be able to assign the models you want to be part of the level, besides the default setup.

Also i want a level border, which could be a mountain, forest or water wall maybe.

But main town hubs, do not have to be random or generated, so i would use such a generator on outdoor levels primarily (forest, island, desert, or dungeon levels).

That’s interesting. I guess I was so focus on making terrains to work that I forgot about how will characters walk up or down those hills. I will make that part of the things to do.
Regarding the map size, I believe what you suggested will work, so any size below 10x10 should not be a problem. However, the performance with 20x20 might be too slow to generate, maybe like 8 seconds? For now, the 10x10 map generated in 2 to 3 seconds under the heaviest settings (max number of trees and buildings) with my cpu i5 3570. Everything is done through blueprint so things might get faster once I move it to c++.

8 seconds for generating a level is not a problem, at least IMO. You just make some kind of “generating level…” screen, and that’s it.

Looks good! Always happy to see more devs working on procedural worlds. :slight_smile:

Depends on the requirements. My standard map takes 30 seconds to generate, which is basically fine for the genre, and the billions of iterations required to generate the map data.

If you are doing say something like Minecraft, you are going to want the nearby regions generating while you are roaming around, so beyond optimizations, background loading using a Tick is something worth looking at.

Thanks everyone, the suggestions are great, and some of them I might never think of.

I played with a 20x20 map, and the time it takes to generate it is about the same as a 10x10 map (under 3 seconds). This is surprising to me. It seems I’m safe to experiment with bigger map like 40x40!

i took a picture of the 20x20 map. As you can see, the buildings are everywhere because i increased the amount to 100. I will work on it some more over this week.

very cool! Whats your road maps of features you’d like to add? roads and paths?

I don’t have a road map yet, at least officially. In the back of my mind, I can think of adding textures, build road and paths, and adding slope so characters can go to upper levels. I will add more features once I decide on what kind of game I want to build with this.

hah yeah I guess you need to know what kinda of game you want to make! Looking forward to what you come up with.

Cool idea! It would definitely be interesting to add paths and roads to this next!

Hi everyone, I worked on roads but then it opened up all kind of crazy ideas I have in mind. I started to make streetlights in the city and it came out ok (there’s always room for improvement). The time to generate remains the same but fps drops by half due to the point lights that get spawned. I think there might be more settings that I have to play with to get the best performance, like light radius. Because of the performance hit, I think it’s better to limit the size of the map, or make a top down game to reduce the number of lights for the camera.

Here’s a picture of a small section of the map. I believe there are around 50 point lights in the map.
7e5e46016026027af6feb7819df2037f6eae562c.jpeg

Thanks everyone for checking this out! I think paths will be better if they are textured so I’m going to work on that next.

You are probably going to want to limit the amount of space that is lit and rendered at any given time. Since it is procedural, that limits your options for level streaming unless you are comfortable in C++.

But, there are other ways you can do it such as masking materials, culling volumes, etc.

This looks really cool :slight_smile: Will keep my eye on it for sure!

I would be really interested to know how you did this, I’m interested in also creating a random map generator however rather than stumble around, guidance on the subject would be fantastic!

that’s awesome !!~

Hey Wesyc - What are your plans for this?

Do you intend to sell this on the marketplace?

I am really interested in this. :slight_smile:

This is pretty sick, especially if you can easily change out models for your own with textures. Still seems like a clean way to make a concept and work over it and clean it.