Jump to content
  • Advertisement

Archived

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

DanS

Random level generator?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

If any of you have played Worms, Worms2, or Worms Armageddon, do you know what kind of algorithm they used for the level generator? I have a similar game in development and desprately want to know! Please post or e-mail me. DanS

Share this post


Link to post
Share on other sites
Advertisement
I started a Worms clone with a friend, but it never got very far.

However, I did complete the random level generator code.

This was a while ago, but I'll try to remember the important details.

For each pixel along the x-axis of the level I have a "top" & "bottom" location, the space between each is filled with whatever texture, and grass is added at the top.

To render it, I randomly select a start location (on x axis), a top and bottom location (usually very close to each other), a direction to work in(left/right), and a variable describing the current top & bottom heights using a floating point variable (so you can have smaller gradients)

For each pixel from the start location to either the end of the level:

o set top & bottom locations to the contents of the current top & bottom variables (rounded of course)

o adjust the current top & bottom variables by a small random amount (make it bias towards the current gradient, so you get nice big hills instead of a wiggly line )

o check the top is higher than the bottom etc, if they meet, exit the routine, the landscape is complete. Also quit if the top goes off the bottom of the screen.

o move along the level in the direction selected initialy.

You will also want to prevent the landscape from going off the top of the screen (or too high)

This creates a land-mass, you will probably want three or four, you will also want to add sprites on top (snowmen etc)

Each sprite had information regarding how much of the sprite could be buried etc, which was used when placing the sprites.

Not the best of descriptions, but it's not very hard to do, hell, I managed it

George.

"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"


Edited by - GEo on 4/13/00 5:47:12 AM

Share this post


Link to post
Share on other sites
Hmm... im thinking of making a random world generator for my upcomming game, it''s an RPG w/ a huge 2d world...
I need to make a world w/ different types of terain (ie. snow, desert etc). The generator is not to be sent w/ the game but it''s for me so i dont have to make the entire world by myself but just edit in the towns etc.

can anyone help me?

========================
Game project(s):
www.fiend.cjb.net

Share this post


Link to post
Share on other sites
I'm planning somethin' like that for my RTS-Game, too...


CU M.E.L.O...

Edited by - Melo on 4/13/00 11:48:22 AM

Share this post


Link to post
Share on other sites
Hmmm...To do this, I guess I would make each tile contain information about which kind of tiles can be adjacent to it.

For example, if I have a vertical bridge tile, it would contain information about what tiles can go above, below, left, right, etc..

So, for this example, it would say that only another bridge tile or a bridge-landing tile can go above or below, and only a water tile can go to the left or right.

This woulld work...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!