Procedural City, Part 1: Introduction

By Shamus
on Apr 13, 2009
Filed under:
Programming, Projects

151 comments

Change of pace. In the last week I’ve had an idea clawing at the back of my head, and it’s clear the thing isn’t going to leave me alone until I do something with it. I don’t usually blog about my little programming projects (with the exception of the Terrain Project) because I like to imagine this site has some sort of focus, but the choice here is for me to blog about this or leave the site fallow for a week. So I’m blogging it. Perhaps you’ll find it entertaining anyway.

Motivation

There are several reasons for wanting to do this.

It’s comical now, but this was a real eye-grabber in 1996.
It’s comical now, but this was a real eye-grabber in 1996.

Way back in my early days of 3D development a lot of my work was focused on creating effects or finding tricks to make it look like there is more to the scene than what is really being rendered. A lot of work was being done by game companies to simply push the technology as far as it would go, but I enjoyed getting halfway there with technology and then going the rest of the way with a good facade and some lighting tricks. The techniques I used in the mid 90’s would seem laughably simplistic and trivial today, but at the time I remember getting a lot of “How did you do this?!?” type reactions to my work.

For example: I wanted to make a city, but the scene just couldn’t render things at a great enough distance to give you a “big city” feel. It just felt like a handful of big boxes next to each other in the middle of a featureless plain. So I set the city at night, scaled the buildings down so that they weren’t really much bigger than houses, and slightly pinched the tops of them so that the top of the (apparent) cube was smaller than the base. The reduced scale let me get a lot of buildings close together, the night lighting let me suggest more detail than was really present, and the skewed shape created a false impression of height. (The eye wanted to believe that these building-ish objects were cubes, and so when you looked up it made them seem taller than they were.) The scene was pretty astounding in 1996, although I doubt it would impress anyone today.

This sort of thing was an unusual blend of technical and artistic work, and I enjoyed it immensely.

l4d_buildings.jpg
In a section of the Left 4 Dead commentary (near the very end of the initial No Mercy level) one of the developers draws attention to an apartment building in the distance. He explains that it’s a very simple building with little detail, but because it’s mostly a silhouette against a detailed sky, the eye accepts it and your mind fills in details that aren’t really there. This reminded me a great deal of my old work, and got me itching to do some of that sort of thing again.

My new graphics card is ridiculously powerful. While I’m working less and less with graphics these days, on the rare occasions where that sort of work crops up it’s still focused on getting more out of widely adopted low-end technology. So I haven’t worked with much new technology. (“New” being very relative. For me, anything younger than a kindergartner is new.) This makes me some sort of cutting-edge Luddite, pushing the limits of stale technology.

CPU’s have stagnated a bit over the last few years while GPU’s have continued to accelerate. (No pun intended.) This has moved a lot of the old bottlenecks around. I think it would be good for me to get to know one of these recent GPU’s and see what it’s like to work with them.

And finally, I love procedural content, but I never get a chance to work with it.

Goals

1. The goal is to make a nighttime cityscape that is mostly made of lights and suggestions rather than real detail.

2. The city will be entirely procedurally generated. That is, the program will contain no art assets. No textures. No models. Everything must be built from scratch at startup.

3. I’m budgeting a week of nights and weekends for the project. So, probably about 30 hours of time total.

4. I’m going to use only conventional rendering. While I’d love to muck about with pixel shaders and see what the new ones can do, I haven’t messed with that sort of thing since 2006. Just getting up to speed on the subject would blow my entire time budget. (Pixel shaders are special programs that run on your graphics card instead of on your “computer” with all of your other software. They are strange, amazingly powerful, and difficult to master.)

5. I’m aiming for something that will run on a broad range of machines. This will be a little tricky, since my current machine is pretty beefy compared to the average. (I’m talking about the average windows-based PC, not the average gaming computer.) It’s much easier to develop on an old machine than to develop on a new one and try to guess where the bottlenecks will appear when run on old hardware. All of our older machines around the house have been converted to Ubuntu, and running under WINE wouldn’t make for a very useful benchmark. So this goal will be difficult to judge. The best I can do is aim for the program running at at least 100 frames per second on my PC and hope that it can still manage 25 or so on an older machine. Even this is pretty dicey, but it’s the best I can do for now.

I don’t know what I’ll do with the program beyond the goals above. Give away the source? Turn it into a screensaver? Add more features? We’ll see where the project takes me and how interesting this is to people.

Getting Started

The first step in a project like this is to make a simple program to open a window, start up OpenGL, and provide some basic camera interface so that I’ll be able to examine my work. This involves gathering up a lot of boring boilerplate code, creating the project files, and adding a bunch of not-very-interesting low-level systems. The result is not very compelling:

pixelcity_base.png

Sorry for dragging you all this way only to show you an empty window, but this is how it often goes. I’ll make sure to have something more compelling to show you next time around. This series will run all week, assuming everything goes to plan.

Enjoyed this post? Please share!

Footnotes:


A Hundred!202011We've got 151 comments. But one more probably won't hurt.

From the Archives:

1 2 3

  1. […] This is a demonstration of a program to generate and fly through a dynamically generated city. You can read the step-by-step of how it was made at this website: http://www.shamusyoung.com/twentysidedtale/?p=2940 […]

  2. […] J’ai inclus le site Web du créateur de ce logiciel, Shamus Young et aussi comment il a réalisé ce magnifique travail. Si vous avez la patience d’un programmeur vous pourrez le faire vous-même. http://www.shamusyoung.com/twentyside… […]

  3. […] Procedural City — 14-teilige Artikelreihe über prozedurale Synthese (Video mit Musik von Oursvince) […]

  4. […] en el estilo de excelente Shamus Young ciudad procedimiento serie, voy a comenzar blogs sobre planetas haciendo. A diferencia de él, sin embargo, no voy a […]

  5. […] time the program runs. Here, the video that shows the Young’s process will make it more clear:Pixel City is a procedurally-generated city by Shamus Young. For the non-coders out there, this essentially […]

  6. […] discussing his design choices, challenges and gotchas. If you are interested in reading about it, the first post is here and the final product can be downloaded as a Windows screensaver here.. Personally I found that […]

  7. […] out this video of a dynamically generated city by Shamus Young. More info here. [Thanks Umlaut] Share May 16th, 2009 | Tags: 3D, Dynamic Content, Pixel | Category: Art, […]

  8. […] that documents building a virtual city. The city was generated programatically by Shamus Young, who details the process on his blog.You can follow our links and commentary each day through Twitter (@guardiantech, or our personal […]

  9. […] few years ago, a guy named Shamus Young coded something really cool: a procedurally generated city. Using just a few assets (a bit of texture, some general building models, a bit of code for cars) […]

  10. […] Procedural City, Part 1: Introduction – Twenty SidedApr 13, 2009 … Pixel City – Procedurally generated city: wie baue ich mir meine eigene … By We Built This City On (er) Maths: PixelCity | Rock, Paper, Shotgun … […]

  11. […] que el título lo dice todo lo que realizó Shamus Young en su proyecto Pixel City, en el que utilizó la técnica de Procedimiento de Generación para […]

  12. Gregory says:

    Great Wall of China is known as China\’s serpentine masterpiece thanks to its huge architecture and historical beauty.

    I only wrote 748 glowing items about him in The New York Post
    and in boxing magazines when he was trying to make his “bones” in the fight game.
    I kind of doubt it but I would not go into any Sugar Shane shock over such bad news.

  13. It’s a shame you don’t have a donate button!
    I’d definitely donate to this brilliant blog!

    I suppose for now i’ll settle for book-marking and
    adding your RSS feed to my Google account. I look forward to brand new updates
    and will talk about this site with my Facebook group.
    Talk soon!

  14. Garver says:

    This is awesome work I just ran across, your so talented. Keep up the excellent work. Sincerely, Garver

  15. Hellο mates, how iѕ the whoe tɦing, and what yoou ԝish fօr to
    say гegarding this paragraph, in myy view іts аctually remarkable
    іn support օf me.

  16. Ouida says:

    Thanks for finally writing about >Procedural City, Part 1: Introduction – Twenty Sided <Loved it!

  17. auto backlink bomb

    adwords keywords tool

  18. You can search from Tacoma to Seattle and never have the ability to find one other shop that can even come near matching our
    low costs and grade A quality of hashish products sold right here at Highway 7 Recreational Marijuana Store.

  19. […] Links extern: Twenty Sided » Procedural City, Part 1: Introduction […]

1 2 3

14 Trackbacks

  1. […] This is a demonstration of a program to generate and fly through a dynamically generated city. You can read the step-by-step of how it was made at this website: http://www.shamusyoung.com/twentysidedtale/?p=2940 […]

  2. […] J’ai inclus le site Web du créateur de ce logiciel, Shamus Young et aussi comment il a réalisé ce magnifique travail. Si vous avez la patience d’un programmeur vous pourrez le faire vous-même. http://www.shamusyoung.com/twentyside&#8230; […]

  3. By Pixel City | city on April 29, 2011 at 10:14 pm

    […] http://www.shamusyoung.com/twentysidedtale/?p=2940 […]

  4. By Die Welt ist gar nicht so. » Linkschleuder (17) on April 30, 2011 at 10:39 am

    […] Procedural City — 14-teilige Artikelreihe über prozedurale Synthese (Video mit Musik von Oursvince) […]

  5. […] en el estilo de excelente Shamus Young ciudad procedimiento serie, voy a comenzar blogs sobre planetas haciendo. A diferencia de él, sin embargo, no voy a […]

  6. […] time the program runs. Here, the video that shows the Young’s process will make it more clear:Pixel City is a procedurally-generated city by Shamus Young. For the non-coders out there, this essentially […]

  7. […] discussing his design choices, challenges and gotchas. If you are interested in reading about it, the first post is here and the final product can be downloaded as a Windows screensaver here.. Personally I found that […]

  8. By Pixel City by Shamus Young « fang found this on September 10, 2011 at 4:47 pm

    […] out this video of a dynamically generated city by Shamus Young. More info here. [Thanks Umlaut] Share May 16th, 2009 | Tags: 3D, Dynamic Content, Pixel | Category: Art, […]

  9. […] that documents building a virtual city. The city was generated programatically by Shamus Young, who details the process on his blog.You can follow our links and commentary each day through Twitter (@guardiantech, or our personal […]

  10. By Procescape | Come On, Let's Go. on December 28, 2011 at 10:25 pm

    […] few years ago, a guy named Shamus Young coded something really cool: a procedurally generated city. Using just a few assets (a bit of texture, some general building models, a bit of code for cars) […]

  11. By Pixel city | Silkskinessent on April 4, 2012 at 9:28 am

    […] Procedural City, Part 1: Introduction – Twenty SidedApr 13, 2009 … Pixel City – Procedurally generated city: wie baue ich mir meine eigene … By We Built This City On (er) Maths: PixelCity | Rock, Paper, Shotgun … […]

  12. […] que el título lo dice todo lo que realizó Shamus Young en su proyecto Pixel City, en el que utilizó la técnica de Procedimiento de Generación para […]

  13. By auto backlink bomb on December 15, 2014 at 3:23 pm

    auto backlink bomb

    adwords keywords tool

  14. By Pixel City « XeXeXe on February 14, 2017 at 9:32 am

    […] Links extern: Twenty Sided » Procedural City, Part 1: Introduction […]

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>