# Algorithm for procedural city generation? [closed]

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. Stop looping #3-5 when all points have ids
7. You will end up with 10 random regions. Make roads bordering these regions.
8. 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.

-

## closed as primarily opinion-based by Byte56♦Feb 4 '14 at 15:24

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

I'm not sure the algorithm will work as you list it out. In step 3, you assign all points IDs. In step 5, you assign points next to an assigned point (which is all of the points) the ID of the point next to them. So you're going through and changing all of the IDs points you have assigned. Because of this, you'll have a jumble of tiny little islands of each ID, not 10 individual regions. – fnord Nov 15 '12 at 23:21
relevant: Pixel City. youtube.com/watch?v=-d2-PtK4F6Y – Trevor Powell Nov 15 '12 at 23:24
it doesn't explain you how it is done, but might give you some ideas : youtube.com/watch?v=FR9xI0GgrBY (city) and youtube.com/watch?v=tUwHRc2zpbo (office generation) – tigrou Nov 16 '12 at 0:04
Saskia Groenewegen's thesis might give you some ideas: graphics.tudelft.nl/Game_Technology/Groenewegen – amitp Nov 16 '12 at 0:44