Game
Rhythm, Paper, Scissors
7 years ago

Random Level Generation - How it works


Hello again, Mattis here. I am back to tell you more about the random generation in Rhythm, Paper, Scissors. Today I would like to go over the basics of how the script actually generates rooms. I would also like to tease some of the progress I’ve made since the last post. In the next post I will go over the progress I’ve made and the problems I’ve had to solve in more detail.

Random Generation

In order to create the random generation in Rhythm, Paper, Scissors I started out with looking through some tutorials and examples of how you could go about solving this problem. I then created a very basic script that could generate rooms and connect them with corridors, that’s all you saw in the last post and I thought I would explain how the script does this in this post.

I start out with creating a list that holds all the tiles of the entire level. I use this list to keep track of what needs to be instantiated at what positions when I have completed the random generation.

Next step is creating the first room of the level where the player will spawn. It’s a 5x5 room that I place in the center of the level. After the first room is created I generate a corridor that leads out of the starting room in a random direction. I then generate another room at the end of the corridor and the cycle repeats until the entire level is generated.

I control the random generation using various public variables that can be set through the inspector in unity for quick testing and editing.

• They control the size of the level that is to be generated.
• They control the amount of rooms we want in the level.
• They control the size of the rooms we generate.
• They control the length of the corridors that connects the rooms.

5d0a9431a0141.png

After the level is generated and my list contains the information it needs I use the list to instantiate the entire level.

When I instantiate things into the world I pick a random prefab from the Prefab Lists which contain several variants of the floor, wall, enemy and prop prefabs. This leads to the levels looking a bit more varied and interesting.

Currently our sprites are limited but I want to make sure we have a higher quantity of different looking prefabs to make sure that the levels stay interesting.

Finally… I would like to leave you with this GIF of what the levels look like right now and a little teaser for the progress I’ve made with the level generation. The generation scales up the amount of enemies as you generate more levels and makes sure that you don’t get flooded by enemies (or props for that matter) as the levels get bigger and more difficult.

5d0a9433d719d.gif

I hope you enjoyed reading about the Random Level Generation I’ve created for Rhythm, Paper, Scissors and I hope you join me again next time for more in depth info on how I solved some of the problems that came up when I started adding enemies and props into the mix.

See you next time!

  • Mattis



0 comments

Loading...

Next up

🍒Did you like the game? A demo is available for free on Steam.

✌️ Thanks for playing IndieGameiacs!

⚙️ Free Demo: http://bit.ly/UniDuni

📺 Full Video: https://youtu.be/5qEbVXg7GaQ

#steam #uniduni #clops #screenshotsaturday

Heya! I wanted to show some gameplay progress i made so far. I hope you like it ^^

Werehog transformation process. #sonicunleashed

Finished work on the emotions of a new character for the tank universe

A Shiny Mega Gengar 🌟 For @ManutkArt 's #ThreeColorsChallenge!

One of the most critical update for Sunblaze demo. Now you are able to pet a cat! Finally!

I mostly build 3D First Person Shooter game mechanics in Unity, and in this I'm just showing C4 mechanics I made for a little side project I am working on! :)

Our menu, gathered a huge feedback and positive comments among foreign audience, what you say? Game Steam: https://store.steampowered.com/app/1543090/LiBER/

Respect (Only TLOZ Players Will Understand)

:] me sigue sin gustar

:] I still don't like it