Algorithm for procedural city generation?

Posted by Zove Games on Game Development See other posts from Game Development or by Zove Games
Published on 2012-11-15T22:59:37Z Indexed on 2012/11/15 23:27 UTC
Read the original article Hit count: 210

Filed under:
|

I am planning on making a (simple) procedural city generator using Java. I need ideas on whan algorithm to use for the layout, and the actual buildings. The city will mostly have skyscrapers, not really much complex stuff.

For the layout I already have a simple algorithm implemented:

  1. Create a Map with java.awt.Point keys and Integer values. Fill it with all the points in the city's bounds with the value as -1 (unnassigned)
  2. Shuffle the map, and assign the 1st 10 of the keys IDs (from 1-10)
  3. Loop until all points have IDs:
  4. Loop though all points:
  5. Assign points next to an assigned point IDs of the point next to them, if 2 or more points border the point, then randomly choose which ID the point will get.
  6. You will end up with 10 random regions. Make roads bordering these regions.
  7. Fill the inside of each region with a randomly spaced and randomly rotated grid

PROBLEM: This is not the fastest way to do it.

What algorithm should I use for the layout. And what should I use to make each building's design? I don't even know how I'm going to do that yet (fractals maybe). I just need some ideas, not actual code.

© Game Development or respective owner

Related posts about java

Related posts about procedural