#### Archived

This topic is now archived and is closed to further replies.

# Generating random side scroller levels

This topic is 5986 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Has anyone every make a random level generator for a 2D sidescroller, I''m looking to create indoor environments and so far the only method I can really link of is to create premade sections and have the generator paste them together like puzzle pieces. The only problem I see with this is that after playing a few random levels (or more depending on how many pieces are available and how many are used for each level) players will start to see the same corridors and junctions.

##### Share on other sites
There''s just no substitute for true human creativity -- at least not yet .
I wonder if some sort of fractal algorithm could make levels look uniquely interesting. You know how the mandelbrot set looks infinitely varied and detailed in different places at different magnifications. Just pie in the sky speculation -- maybe you could find mandelbrot subsets to generate the shapes of your sections or something .

"All you need to do to learn circular logic is learn circular logic"

##### Share on other sites
You might look at the standard top-down maze makers.
I think they generally have a opening at the top ( start ) and an opening at the bottom ( finish ) and then proceed to send tendrils out from the edges at random. since you can only add onto tendrils and aren''t allowed to close the openings between them, this assures you that there is a path between the tendrils from Start to Finish. For a side scroller, you might use something similar with constraints to make sure your hero can jump from ptA to ptB.

##### Share on other sites
I can''t think of a better (practical) solution than your jigsaw puzzle idea, but consider this: If you build paralax scrolling into your engine then you can have more variety buy using different background layers. You could also create vary things with lighting, if you design it to take advantage of 3D acceleration. Then you can have predefined types of lighting for a level such as day, night, dim, etc. And don''t forget the possibility of a foreground layer in front of the layer that your character moves on. I hope that all made sense.

---------------------------------
"It''s groin-grabbingly transcendent!" - Mr. Gamble, my teacher, speaking of his C++ AP class

##### Share on other sites
Lets say you have several map objects such as trees, rocks, boxes, floors, and items(weapons, ammo, health, etc.). You could start by randomly generating one item, such as trees. Get a random number of trees and their locations. Then, make some algorithms that do things such as: don't put two trees next to each other, don't pile rocks/boxes/gaps in the floor so high the player can't jump/climb over them, spread items evenly throught the map, and so on.
Or, if you are going to have enemy spawn points you may want to think of a system that gives you ammo just before you are attacked and health right afterwards. How much health/ammo or even a new weapon depends on how many enemies will be at that spawn point.
Putting all these thoughts into logical statements will take a while, but won't be too hard. You'll probably end up with some weird looking maps though.
The puzzle pieces idea is probably the best for maps that are playable.
Maybe you could use the same puzzle pieces, but randomly generated, lighting, enemies, items, textures. Randomly generated textures and enemies would probably be better said as "randomly chosen". If you are working in direct draw it would be a lot harder to do this than in D3D.
EDIT: sorry, i didn't see that someone else had already suggested different textures and lighting.

Proceeding on a brutal rampage is the obvious choice.

Edited by - amish1234 on February 27, 2002 10:11:02 PM

1. 1
Rutin
25
2. 2
3. 3
4. 4
JoeJ
17
5. 5

• 14
• 14
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
631757
• Total Posts
3002123
×