Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I had an idea of procedurally generating arena-type levels in which the player would either fight hordes of enemies, or another skilled opponent. The level would be built at the very start of the layout, and will have a layout similar to those in Quake Live; Pickups, enemy spawners, etc. What would be the best way to achieve this?

share|improve this question
    
What's your specific problem? As it stands this is a pretty broad question. –  Byte56 Jul 4 '12 at 16:34
    
Well, I guess I just wish to know any good algorithms to use for making the Top-Down arenas. Like, would Perlin Noise work, or point-midplacement, for this situation? What would be best to use and where could I find an example to get me started? –  Phobos001 Jul 4 '12 at 17:22

2 Answers 2

Algorithms are specific solutions for specific problems, for level generation you don't need algorithms, just logic.

First of all you need a specific idea how the maps should look like, then you need a few abstract data types which describes the features of the map, in this case those could be: player start point, platforms, pathways.

Now you have set those you need to distribute them: where should platforms be placed and where the player start point? Also how many platforms? When you have done that you can connect the Platforms by Pathways.

Having that basic structure set up you then can place game play details: you could connect a few platforms by jumpers and put item spawns on others.

Short example pseudo code:

func generateMap(int width, int height)
{
  struct Point{ int x, y; };
  struct Connection{ Point start, end; };
  list<Point> platforms;
  list<Connection> pathways;
  Point player;

  // Set Player point somewhere on the left side in the middle:
  player = { width/4+Random(-100, 100), height/2 };
  platforms.append(player);

  // Now distribute a few more platforms:
  int numPlatforms = (width*height)/300+Random(-2, 2);
  for(i=0; i < numPlatforms; i++)
  {
    /* Insert code here to generate random coordinates which are not too near to the already existing platforms*/
    platforms.append({x, y});
  };

  // Make connections (for simplicity sake here just randomly, this doesn't really work well obviously.)
  foreach(Point platform in platforms) pathways.append( {platform, platforms[Random(platforms.length)]} );

  // Quake style arenas are symmetrical so just mirror what you already have here.
  [...]

  // Now do stuff like generating a Tile map from that data, depends a lot on the underlying engine.
  [...]
}
share|improve this answer

You're unlikely to find a standard algorithm for doing that. Also, I'm not sure you'd get the structural aspects you want from using pure noise. I'd look into how procedural cities or building are generated, then apply those to making your own algorithm. There's a Survey of Procedural City Generation (pdf). Then over at the Procedural Content Generation Wiki, there's a good list of links related to dungeon generation. Hopefully this is enough to get you started.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.