Sunday, December 27, 2009

Procedural Cities in XNA

It's been quite a while since I've talked about any development I've been doing. To be honest I have been quite busy with work and flight lessons, so I don't have much time to work on my hobby projects.

Lately I have been working on a procedural city generator in C#/XNA. I'm basing my work on the Metropolis project, which was in turn based upon a research paper presented at SIGGRAPH 2001.

I began with the procedural road map generator. It takes a heightmap and generates a road network from it.



Zooming in you can begin to see the subdivisions between streets where buildings will be built.



Zooming in even further makes the building lots even clearer.



Next, I began work on the 3D building creation. Here you can see many simple buildings all using the same texturing.



I then added more texture variety.



I finally added in the terrain with road texturing.



Zoomed out view showing the vast number of buildings generated.



And the final image showing "Central Park" (this city was generated from a heightmap of Manhattan).



I want to eventually release the source code for this, but first I need to clean up the code some more. I also need to tweak the renderer to run faster. Right now it is just brute forcing it, and doesn't utilize any form of level of detail or frustum culling.