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?

  • \$\begingroup\$ What's your specific problem? As it stands this is a pretty broad question. \$\endgroup\$ – MichaelHouse Jul 4 '12 at 16:34
  • \$\begingroup\$ 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? \$\endgroup\$ – Phobos001 Jul 4 '12 at 17:22

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 };

  // 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.

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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