Generating random levels
Okay, this is a brain-storming thread more than anything else... I'm just looking for fun ideas. I'm not even sure if this is the right forum for it... anyway. I'm making a 2D side-scroller game, with the goal that all graphics and most of everything else will be procedurally-generated. It just seemed kinda fun, and I intend to have lots of pretty, surreal effects, hearkening back to demoscenes and old Amiga games and such. Assuming I can figure out how they work, of course, but that's a different thread. The topic of today's ramble is this: I want the levels/rooms to be generated randomly, within certain bounds. That's not hard, all I have to do is figure out a certain number of factors for each room, and tweak them within certain bounds. However, I do intend for there to be some progression and finish to this game, not just an endless progression of escalating difficulty. The game itself consists of a bunch of "rooms", which may lead to one or more other rooms. The question is really this: How do I organize the linked rooms in a sane manner? I need some balance between randomness and pattern; the player shouldn't be wandering aimlessly or get completely lost, but I'd kinda like at least some element of the labyrinth in it. So ideally I should have some big over-reaching organization to the way the rooms connect to each other, but an organization that can be randomized from game to game, needing a certain amount of exploring and fooling around to figure out where to go next. It occurred to me to use something like a Starmaze (http://www.cartania.com/starmaze/intro.html), which is what originally sorta-inspired this game, but it's far too simple and regular once you figure out the pattern, and hard to make it more random. So far the best idea I've come up with is having a number of "core" rooms, each with it's own theme (background type, colors, enemies, etc), and then more-or-less randomly generating a maze of similarly-themed rooms around it, with subtle patterns and indications of whether you're getting closer to or farther from your goal. More-or-less pre-made secrets could be sprinkled around liberally, making it worth exploring more than one might otherwise. That really doesn't seem like a bad way of setting things up, but it feels like it lacks... elegance, or something. I was just wondering if anyone else had any interesting ideas in how to structure something like this. Well, and rambling. Don't forget the rambling.
-----http://alopex.liLet's Program: http://youtube.com/user/icefox192
I'm assuming by 2D side scroller you are talking about a platformer...
Platformers are driven by the quality of their level design... randomly generated levels are just not going to give you good platforming levels.
My suggestion would be to have a number (can be a fairly large number) of pre-designed rooms. Each of these rooms can have doorways in that lead to other rooms, but the actual rooms that they lead to is random. If you wanted even more variety, you could do things like:
- Each room has three different enemy placement scenarios, chosen randomly
- Each room chooses its tile-set/graphic style randomly, or based on the area of the world it is in.
- Each room has X different difficulty versions (harder jumps, more enemies, etc) and the further into the game you are when you encounter that room, the harder it is.
Just a few ideas...
[Edited by - JBourrie on July 11, 2006 3:42:30 PM]
Platformers are driven by the quality of their level design... randomly generated levels are just not going to give you good platforming levels.
My suggestion would be to have a number (can be a fairly large number) of pre-designed rooms. Each of these rooms can have doorways in that lead to other rooms, but the actual rooms that they lead to is random. If you wanted even more variety, you could do things like:
- Each room has three different enemy placement scenarios, chosen randomly
- Each room chooses its tile-set/graphic style randomly, or based on the area of the world it is in.
- Each room has X different difficulty versions (harder jumps, more enemies, etc) and the further into the game you are when you encounter that room, the harder it is.
Just a few ideas...
[Edited by - JBourrie on July 11, 2006 3:42:30 PM]
Check out my new game Smash and Dash at:
You can easily create a maze built off a grid. There is no need to use someone else's programming there.
From that maze, insert a prebuilt room that fits the door pattern(preferably, choose 1 from a library several).
A quick way to make a maze:
create a large grid of cells with walls between all of them and number the cells.
choose a random wall segment (or choose a random cell, wall)
if the cells on opposing sides of the wall have different numbers (they of course will on the first pass) then remove the wall and set all of the connected cells to the same number. eg remove the wall between 1 and 2 and rename cell 2 to 1. Now you have a larger cell.
repeat
one way to speed things up at the end is to keep a list of walls that fit the bill and select from them.
From that maze, insert a prebuilt room that fits the door pattern(preferably, choose 1 from a library several).
A quick way to make a maze:
create a large grid of cells with walls between all of them and number the cells.
choose a random wall segment (or choose a random cell, wall)
if the cells on opposing sides of the wall have different numbers (they of course will on the first pass) then remove the wall and set all of the connected cells to the same number. eg remove the wall between 1 and 2 and rename cell 2 to 1. Now you have a larger cell.
repeat
one way to speed things up at the end is to keep a list of walls that fit the bill and select from them.
[s]I am a signature virus. Please add me to your signature so that I may multiply.[/s]I am a signature anti-virus. Please use me to remove your signature virus.
Quote:
Original post by JBourrie
Platformers are driven by the quality of their level design... randomly generated levels are just not going to give you good platforming levels.
Yes, a platformer, but one where each room is relatively small; perhaps two or three times the size of the screen. You're probably right about the level design; I do like the pre-made room idea, though. Another idea would be to have certain terrain elements like tubes or pyramids combined in various ways; that would probably result in a fairly sane type of room without the player saying "Oh, this place again?".
Perhaps a combination of both, in different situations. But I'm more interested in is ideas for the large-scale organization, the overall shape of the connections between the rooms. I could lay it out like a grid, or a sphere, or something weird like a torus or spiderweb... I think it'd be best if it were some pattern that isn't immediately apparent, though.
Oh well, we'll see.
-----http://alopex.liLet's Program: http://youtube.com/user/icefox192
In a game I did in school called Thelema (Available here) I had a large world made of smaller rooms in a grid, but each time the player entered a new room I'd stream all of the rooms around it, so that it could appear to be a single seamless world. If the graphics didn't suck (causing visual seams in the world) nobody would have noticed that there were different levels at all.
With cleverly placed doors and a graph saying what rooms have doors that line up with other rooms, you could do something similar with the world and have the players not even realize that the rooms they are entering are different.
With cleverly placed doors and a graph saying what rooms have doors that line up with other rooms, you could do something similar with the world and have the players not even realize that the rooms they are entering are different.
Check out my new game Smash and Dash at:
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement