About the Author
Mass Effect
Final Fantasy X
Batman:Arkham City
Borderlands Series
Weekly Column
Champions Online
World of Warcraft
DM of the Rings
Good Robot
Project Frontier

Procedural City, Part 11: Demonstration Video

By Shamus
on Saturday May 2, 2009
Filed under:
Programming, Projects


Here are the key points of the project, distilled into a short video.

Link (YouTube)

Seeing the thing in motion really is more exciting than screenshots.

I know in the video I claimed it was released as source and a screensaver , but that step has been delayed and I’m to lazy to re-cut the video.


Note that the stuttering apparent in the video is not from the program itself. It was running at 200-300fps with no slowdowns when I made this video. The stuttering either happened during video capture or during the encoding process, which I was obliged to do twice. (Cheapo Windows Movie Maker doesn’t support multiple audio tracks, so to get the typing sound and the music in there together I had to encode the entire movie with just the typing, then re-import that movie and add the music. There were probably better ways to have solved this, but all of them would have taken longer and I’d already spent more time on this than I’d intended.

The story of the cool cam is one many engineers (and by extension, programmers) need to take to heart, that marketing does not always deserve the scorn we give it, and that a little polish in presentation can go a long way to covering up the lack of polish in everything else. I applied that lesson to great effect here. The animated camera does a great job of showing off the cool stuff and hiding the rough edges.

Comments (93)

1 2

  1. froogger says:

    Looks fantastic! I feel like a uncle at someones graduation. “I’m so proud, I was there when he was born you know. Not there, there, but anyway, he’s a fine cluster of code now, ready for the world.”

  2. Zaghadka says:

    What’s it for? What was that “life” procedural thing we all had running on our computers for?

    It’s pretty and fun to watch.

  3. Anoria says:

    Hello. I’m not a particularly regular reader here, so I haven’t been following this project as you’ve been narrating it, but I found the video and your most recent posts about tweaking and I’m very impressed.
    I’m not sure if this is a level that you can or want to address with the techniques at hand, but the one thing that stuck out at me during the preview wasn’t the streetlights, it was the traffic patterns. On the rare occasions that the camera is at an angle where two perpendicular streets of cars are visible, they flow through each other at intersections and that inconsistency really drew my eye.
    Otherwise, it’s beautiful, and if I ever get to spend the time I’d like to spend on learning how graphics work, I’ll be coming back and reading everything about this several more times.

  4. Anoria says:

    Aw crap, you already addressed that way up in the beginning of the comments. Sorry. (And of course I notice this about five minutes past the end of the edit window.)

  5. Gandaug says:

    Very nice. I never use screensavers, but this thing has just changed my mind. Can’t wait for you to release it.

  6. Blake says:

    Thanks for this series Shamuns, I’ve quite enjoyed it.
    Look forward to grabbing the source when you release it :)

  7. Rick says:

    I can’t think of anything to say other than that this looks beautiful. Absolutely beautiful.

  8. Anon says:


    You should integrate it with your terrain engine so the city isn’t perfectly flat :-D. (I jest, I know that’s a ton of work)

  9. ClearWater says:

    I like the video but the stuttering gets on my nerves. *shivers*
    I can’t wait for the screen saver/source code. You probably mentioned what language it was written in but I’m too lazy to check… *kicks myself* No I’m not. Hold on a sec. Those Previous in Project links really help.

    Ok, I’m back. I still can’t find it. I’m guessing based on a vague memory that it is something to do with C. Do you need a special compiler/package or will the freely downloadable stuff work? (I used to use djgpp or something like that. No idea if that will still run on XP/Vista.)

  10. stringycustard says:

    I looked at the screenshots in the previous parts. And I thought, “wow, it’s looking good.” Then I saw the video and it was like going from story board to feature film. Really incredible how it looks in motion. Thanks for doing this, Shamus, it’s so cool seeing the development of this kind of thing. Always wanted to know just how to start with procedural-based programming.

    Gives me urges to jump into some C++ pronto.

  11. Visi says:

    Might be better just with half the amount of cars. But it looks awesome, can’t wait for the screensaver~

  12. R4byde says:

    I know I’m at the tail end of the bandwagon here, but that was F^%@#n AWESOME! Screensaver please, now.

  13. Leonardo Herrera says:

    43,000 polygons? Just yesterday I was seeing some footage of an soon-to-be-released PS3 game (UFC) and they were saying that each fighter is about 30,000 polygons.

  14. Michael Schmahl says:

    It’s a little late posting this, considering how almost-done you are, but have you looked into simulating your traffic using one-dimensional cellular automata? It should be pretty cheap, computationally. Basically, the idea is that the road is a line of pixels, which are either 1 (car) or 0 (no car). On each pass-through, look for the pattern “10”. Wherever “10” is encountered, change it to “01” with a probability depending on the neighboring pixels:

    0100: Cruising, probability 90%
    0101: Braking, probability 20%
    1100: Accelerating, probability 50%
    1101: Congested, probability 10%

    (The probabilities can be adjusted to taste.) With good technique, you could probably get this to run each pass in under 1000ns.

  15. Aveiro City says:

    Hi! Congratulations.. it’s fantastic!
    It would be more interesting if it had some way to implement an control panel of administration (backoffice) .. like the SimCity game.. in 3D..
    This project could also be very interesting if it had applicability in SIG/GIS .. Esri Arcmap Applications or Autodesk Map 3D.. with an easy way to implementation and optimization different modes of roads, buildings, land (water and green!!), light and “many” others factors :)
    Greetings from Portugal!

  16. Jason Porath says:

    Pretty slick. I’ve had to come up with auto-city generators before, in both Maya and Houdini. Your setup is about as good as anything I came up with, and it sounds like you did it a bit faster. Kudos!

  17. Martin says:

    This is just wonderful work, Shamus! I found your article linked from FlowingData. I have long wanted to do exactly what you did, but time has made me forget more and more of my 3D gfx courses. Now, I hope I can just take a look at your code and perhaps add something cool to it!

  18. […] Tests Procedural City, Part 9: Speeding Things Up Procedural City, Part 10: More Performance Procedural City, Part 11: Demonstration Video Procedural City, Part 12: Finishing Touches Procedural City, Part 13: “Release” of Program and […]

  19. dbmuse says:

    very cool…. now i’m going to have to read/view all your older stuff.

  20. dbmuse says:

    I would like to see a segment where one building in the city became the focus point and all the other buildings turned to wire frames…. then the camera view can zoom through the wire framed building and make some sort of circle around the one building. or just a city block of buildings… maybe only the fronts appear solid while everything else is wire or invisible. wire is best to hold the 3d perspective. my opinion is buildings are difficult to show up close… hence most shots… and reality of this vantage point is from afar and from above. Saddly things in the middle are blocked from view.
    more pudding please

  21. ulgortronic says:

    as there are enough comments on the final look already, I would like to thank you for the detailed documentation. You dont just mention why you chose a solution, but document the approach to finding/testing them – great! I think this helps me (as a half-experienced programmer) much more than too much detail of how exactly something works: It gives me a good idea of where to look, and how to find my own solutions!
    great job!

  22. Jamie Thomas Durbin says:

    Dude, you are one of the people I now acknowledge as proc-gen masters. I bow to your expertise, and would love to see the code, optimised as it has been… :D

    Also, what *is* the music for that video?

  23. Michael says:

    This technique could make a hell of a difference in things like flight simulator programs, some of the manually built cities in them are just awful, this looks way better and is procedurally driven? any flightsim developer worth their nuts should be begging you for this code. Also, if you can incorporate finer detail near the street level, this technique could make the whole “expansive environment” thing they go for in MMOs much more seamless.

  24. Kapten-N says:


    Are those company names generated or do you have a list of names to pick from?
    You know what? You should sell advertisement space in the generated cities.
    “10 bucks to have your company name and logo in the randomly pulled list of company names to place on buildings!”
    It’s cheap enough to be a worthwhile investment even for small companies and it could turn out to be a lot of money for you.
    Then all you’d have to do is have the screensaver occationally check an Internet server for an updated list of company names.

1 2

One Trackback

  1. By Procedural Content Generation: Pixel City on Friday May 15, 2009 at 9:42 pm

    […] Tests Procedural City, Part 9: Speeding Things Up Procedural City, Part 10: More Performance Procedural City, Part 11: Demonstration Video Procedural City, Part 12: Finishing Touches Procedural City, Part 13: “Release” of Program and […]

Leave a Reply

Comments are moderated and may not be posted immediately. Required fields are marked *


Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun.

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="http://en.wikipedia.org/wiki/Darth_Vader">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>