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

art comission.

The whole squad is here!

Interested? Follow me!

Made my first ever animation.

Who's is this little cutey👸 here? Thanks🙏 for a gorgeous fanart @WheNa! Feel free to share your arts, screenshots, or videos with #playzelter or #zelter hashtags! #pixelart #animating #unity3d #animated #indiegames #unrealengine #animate #conceptart

Some time ago, we posted a screenshot of the Mexico level. A curiosity about it is that, like some other scenarios of the game, it was inspired by a real landscape, The Basaltic Prisms of Santa María Regla. It is one of the natural wonders of the country!

I just wanted to introduce you to my latest musical production and hear some opinions about it. Thank you very much.

Art made for my friend @ungerbibs . Much love for this <3

Our Japanese themed game released yesterday on Gamejolt + Itch io if anyone would like to check it out! :) You play as a spirit of a japanese wolf.

Knocked down + Get up animation