# Random room generation

**URL:** <https://forums.unrealengine.com/t/random-room-generation/248158>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [August 31, 2021, 4:19am UTC](https://forums.unrealengine.com/t/random-room-generation/248158 "2021-08-31T04:19:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![abugust](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abugust/32/88714_2.png) [@abugust](https://forums.unrealengine.com/u/abugust)\
**Post date:** [August 31, 2021, 4:19am UTC](https://forums.unrealengine.com/t/random-room-generation/248158/1 "2021-08-31T04:19:10Z")

</div>

I have been trying to create a spelunky clone like level generator.

Can somebody give me a blueprint that will generate levels like this?

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/0/c/c0cbb08311c3b83c107f95caf23021ff1d796cd6.jpeg "How (and Why) Spelunky Makes its Own Levels") ](https://www.youtube.com/watch?v=Uqk5Zf0tw3o)

---

<div class="post-metadata">

**Author:** ![DomusLudus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/domusludus/32/1215140_2.png) [@DomusLudus](https://forums.unrealengine.com/u/DomusLudus)\
**Post date:** [August 31, 2021, 7:12am UTC](https://forums.unrealengine.com/t/random-room-generation/248158/3 "2021-08-31T07:12:44Z")

</div>

I think there are several options in the unreal marketplace  
Have you checked it?

---

<div class="post-metadata">

**Author:** ![DomusLudus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/domusludus/32/1215140_2.png) [@DomusLudus](https://forums.unrealengine.com/u/DomusLudus)\
**Post date:** [August 31, 2021, 7:18am UTC](https://forums.unrealengine.com/t/random-room-generation/248158/4 "2021-08-31T07:18:39Z")

</div>

I share a lot of my knowledge for free in these forums, I don’t know why people can’t ask for something free before looking at other options, without being harassed.

---

<div class="post-metadata">

**Author:** ![abugust](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/abugust/32/88714_2.png) [@abugust](https://forums.unrealengine.com/u/abugust)\
**Post date:** [August 31, 2021, 11:27am UTC](https://forums.unrealengine.com/t/random-room-generation/248158/5 "2021-08-31T11:27:23Z")

</div>

Ok here is a more in-depth explanation:

There are 5 rooms, Each has a location in an array

The game starts with a random integer that is gonna determine where the StartingRoom is spawned

Let’s Call this integer A (0-4)

This is the starting room, Let’s say this has an orange color

Then another random integer is rolled, Let’s call this integer B (0-4)

that is gonna determine where the UpRoom is spawned

This is the UpRoom, This is the room that has to have an opening at the top

Every room between the Up room and starting room is a corridor room, They have to have openings at both the left and the right so the player does not have to use any bombs to create a way

all the other rooms become optional rooms, these rooms can have openings, but can also be closed

Then when everything is done move all the actors where the location is saved in the integer up 1000 and repeat, But instead of a starting room a DownRoom is spawned above the UpRoom, This room has to have an opening at the bottom

Then integer B is reRolled to determine where the next Up room is gonna be, Fill in the rooms in between the DownRoom and the UpRoom with corridor rooms

When that is done all the rooms left become bedrooms

Repeat this until the last layer where instead of an UpRoom a finish room is spawned¨

So

If A = 1 and B = 3

Room 1 become a starting room and B become an uproom

2 become a corridor room and 0 and 4 become optionalrooms

If A = 4 and B = 1

Room 4 become a starting room and 1 become an Uproom

3 and 2 become corridor rooms and 0 become an optional room

If A = B then a special room is spawned that is both an UpRoom and startingRoom at the same time, The rest become optional rooms

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f27400311](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f27400311](https://forums.unrealengine.com/u/anonymous_user_f27400311)\
**Post date:** [August 31, 2021, 5:12pm UTC](https://forums.unrealengine.com/t/random-room-generation/248158/7 "2021-08-31T17:12:09Z")

</div>

Dang bro that’s deep

I’ve been trying to learn unreal for 5 weeks now, been doing pretty well in fact (besides procedural generation it’s not working with me) but you have now got me motivated to help people  
That’s cash money homie

---

<div class="post-metadata">

**Author:** ![UnrealSolver](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/unrealsolver/32/1194693_2.png) [@UnrealSolver](https://forums.unrealengine.com/u/UnrealSolver)\
**Post date:** [September 2, 2021, 6:53am UTC](https://forums.unrealengine.com/t/random-room-generation/248158/8 "2021-09-02T06:53:12Z")

</div>

Hahaha

Never expected that someone will use my comment anywhere XD

@DomusLudus - nobody’s being harassed here :o

If he wants something for free - look the internet through for examples, codes, ready BP’s, whatever  
Coming to a forum, placing the first thread ever and “gimme bp that makes rooms”, if he gets it the same day another post “gimme working character”, another day “gimme enemies and bosses” and so on…

There are plenty of places where you can find this useful stuff called information and googling stuff doesn’t harm you

Also sometimes buying some [good stuff](https://unrealengine.com/marketplace/en-US/product/procedural-level-generator) is a good idea to support creators  
[here](https://www.unrealengine.com/marketplace/en-US/product/procedural-level-generator-from-perlin-noise-and-curve-heightmap) some cheaper one which is also amazing!

@abugust - Remember that 3D technique will also apply to your 2D game as it also exists in a 3D space anyway

**Regarding the post again:**  
In my eyes it’s just spam, you may see it other way but try asking random people on street for clothes, cars, houses, coffee beans, nivea shampoo or whatever’s not a cigarette or food if they will give it away to a stranger 🙂

If they know you - it’s easier, as a stranger - at least put some effort into it to convince people ;]

Even some nice posts are being skipped and not visited so much therefore if your post looks good - it makes the people happy and soft to at least point you in the right way. Well, later he updated the post and the comment looks AMAZING now! ( I kindly advice you to put that text as post description 😛 )

@AntiGravity #Point 1 - I totally agree with that!

We don’t mind to help people look for stuff, sometimes our Google does better :P, we also don’t mind advicing or sharing our stuff but like just said - it looks like he didn’t even put any effort into searching, maybe he did but the original post looks like waiting for others to do your stuff done and that’s it…

And I like that you @DomusLudus offer help as well, that’s always good, we do as well but we also wanna have the Forum organized in some ways, for us no effort from poster - no effort from our side (at least regarding requests, cuz we put much effort into writing the comments XD) and once again - **Nobody’s being harrassed here!**

**And the update on his post looks so well that I even started googling!** XD  
_He showed he knows already something about the Engine_, knowing that I know now that I can advice him with [this](https://answers.unrealengine.com/questions/253791/2d-procedural-level.html), [this](https://forums.unrealengine.com/t/2d-procedural-level-generation/54159) or [this](https://forums.unrealengine.com/t/map-generator-procedural/121625) and this one even has an example project so you can play around! Oh, check [this one](https://forums.unrealengine.com/t/generating-simple-procedural-dungeon/97541/3) out as it also contains a project!

I know, they all don’t look like in Spelunky  
Check out [this video](https://www.youtube.com/watch?v=-POwgollFeY) - it explains exactly how such levels are generated and instead of Noise pictures - you can work with numbers to generate different things ;]

It’s not as difficult, you just need some strict rules, as an example - you know the map XY size, from that you can apply math to create some long floors that will never reach X max size to create a hole, add some blocks above and below to create differences and so on, it’s not something to explain in raw text but it’s a tip from my side that with math and some rules (booleans and math again) you’ll be able to create simple map, more complex just needs consideration of more rules

Also a lil teaser of my room generator based on some settings

 ![2021-08-05 13_46_00-Unreal_Room - Unreal Editor](https://d3kjluh73b9h9o.cloudfront.net/original/3X/b/0/b079b26c35adaae1715df2c9d5856a6f1441d3dd.jpeg)

// Sorry for 5 edits - made some spelling changes XD and added some more text
