Cityscape Developer Diary

By Shamus Posted Thursday Jul 9, 2009

Filed under: Programming 20 comments

Coder Chris Whitworth read my Pixel City series and decided to implement his own version of it using Microsoft’s XNA/C# tools. Note that this isn’t a fork or a port. It looks like he’s starting over from scratch, but borrowing some minor details. (Like the techniques I used on the windows.) The series begins here. His series is longer and more detailed than the one I wrote, and he’s using a much more modern approach than I was. (He’s using vertex buffers and shaders, which are the indoor plumbing of graphics programming today.)

My favorite entry so far is #13 (the most recent, as of this writing) where he breaks the city into building plots. The animation of that is pretty cool.


From The Archives:

20 thoughts on “Cityscape Developer Diary

  1. Rutskarn says:

    So, what is he hoping to accomplish with the project? Is he trying to improve on aspects of it, or just demonstrate how it can be done using a different set of tools?

  2. Kdansky says:

    You might want to take a look at Prototype, it’s pretty good at generating a decently realistic city.

  3. Fosse says:

    I’m a non-programmer, and I found your series to be very interesting. This new one, however, is really dull to me.

    In yours, you talked about what you wanted to do and why you wanted to do it, and you showed us the intermittent results when they were going poorly or well. In his, he discusses how he did what he did, and shows us a screenshot of the end result in each post.

    It was much more interesting to read about how you dissected what impressions you thought the eye gets from a particular scene, and what might create a similar result in your city. It’s dreadfully boring to read about programming whatsits.

    I did enjoy the final post so far, 13. Only one image, but he discusses his trial and error and gets to an interesting result.

  4. Zukhramm says:


    Maybe he thinks it’s fun and just wants to do it?

  5. Chris says:

    C#? When will people learn not to give in to Microsoft’s lockins? It’s terrible in the long run. C# is a mistake.

  6. Hipparchus says:

    Perhaps he wanted to demonstrate that you can have procedurally generated cities on powerful consoles like the Xbox 360 showing that, yes, modern devs. can save the $1000 (or whatever) and load time if they use more procedurally generated content. Why don’t they use it? It would save space, loading time, money, and would look pretty much the same as if you did it in a more expensive and has longer loading times way.

    1. WJS says:

      Um, no, procedural content doesn’t have a loading time advantage over static content, it’s quite the reverse, in fact.

  7. James Block says:

    @Chris: C# is actually a pretty decent language. Its main problem is that half of its user community is made up of drooling morons, which reflects poorly on the other half and makes finding useful resources that much harder. “Microsoft lockin” is hardly a problem for a dinky little procedurally generated city; this is not some million-dollar core business app. C#/XNA is a very good choice for new graphics applications, and allows easy portability to the XBox 360, should one desire to go that route (as Chris Whitworth evidently has experimented with).

    @Fosse: As a programmer, I agree with your impression. Reading about the nuts-and-bolts is interesting for someone like me, but adding discussion of the what and why would make it even better.

  8. Nentuaby says:

    While Microsoft lockin is indeed a bad idea, C# isn’t one if you take a modicum of care. It’s an open standard with at least one mature, cross-platform open source implementation (Mono). There are libraries which will lock you in via internal usage of Win32 API calls, but they’re easily avoided. Indeed, given the inherant cross-platform advantages of its bytecode compilation scheme, it’s arguably better for avoiding lockin than a C-oid language.

  9. tourist.tam says:

    Thanks for sharing, having more experience in C# than in C++. I am enjoying both series, even though I can relate a bit more to his for obvious reasons at this point. ;)


  10. Well, that explains the spike in traffic over the last couple of days, anyway. Thanks to everyone who headed over to read the diary!

    To address the comments:

    @Rutskarn – I’m doing it because I can, and because I thought it would be interesting – by which I mean, interesting to me, not to necessarily to anyone else :) I’m a former games developer, and occasionally like to dip my toes back into that world, and PixelCity provided an interesting jumping-off point for a new project. Basically, it seemed like a way to kill time in the evenings when my wife is out of the house whilst I’m on a break from World of Warcraft :)

    @Fosse – the thing is, when Shamus says I “borrowed a few minor points”, he’s either being overly generous, or extremely sarcastic, because the fact is I’ve ripped off nearly every technique he used to determine the look of the city. So, there’s little point me discussing how I’m coming up with the look of things, as Shamus has already done it – in fact, it’s pretty much just this latest entry with the layout of the city that diverges from his techniques in any major sort of way.

    Also, I hadn’t really anticipated that my series would be read by anyone other than a few friends of mine (most of whom are programmers anyway) – in fact, when I emailed Shamus, I was at best expecting an “Oh, cool” reply and at worst a Cease-and-Decist order, so the fact he’s plugged it on what is a considerably better-read (and better-written) blog than mine is a plus – so I wasn’t really writing it with a particular audience in mind.

    Re: C#/XNA – I’m not really interested in religious arguments about which tools I should use: at the moment, I’m a C++/Windows developer by trade; in my last job I worked in C++ and assembler on Linux and various flavours of Unix. I have no particular allegiance to a platform, other than I’ll use to most convenient one to hand for what I want to do. For 3D graphics, I’m most familiar with the DirectX way of doing things from my time as a games developer, and XNA is fairly close to that but abstracts away all the annoying device acquisition and resource munging stuff. It’s incredibly quick and easy to get something up and running. Plus, as someone mentioned above, it’s relatively trivial to take an XNA project and deploy it on an XBox 360, which has a nice nerd factor to it. As for C#, it’s a nice productive language, although I make no claims that my code is “good” C# – it’s probably mainly C++ written in C#, in fact, but again, I’m not doing this to demonstrate my l33t C# skills – it’s just a bit of fun.

    If my concern was to do this cross-platform, I’d probably have gone for Python and pygame – in fact, if someone fancies knocking that out in a spare weekend, I’d love to see it.

    Anyway, thanks again for taking an interest; it’s nice to know someone’s reading :)

  11. says:

    @ Kdansky:
    Are you sure prototype is randomly generated? I am sure it is static, as the whole Manhattan isle is transferred into the game.

  12. Neko says:

    Maybe Manhattan is procedurally generated.

  13. Scott says:

    I live in Los Angeles, and I can tell you that, with the exception of a few key buildings, it is most certainly procedurally generated.

  14. Carra says:

    Well, it’s not hard to be more modern then using visual C++ 6.0 / visual studio 6. I have to use it at work for our legacy project and I bloody, hate using it. I’m used to working with C#/Visual Studio 2008 and it’s a night and day in difference (what, I can’t just rename a field?). Having to start up my 6.0 editor feels like going back to the medieval times.

    None the less, it doesn’t really matter what a program is written in as long as its a great program. But if given the choice, I’d to pick a newer technology. It will increase your productivity. Well, if you don’t have to spend a few days getting used to the new technology that is :)

    I’ll go have a look at the new project, I loved reading about your project.

  15. Nentuaby says:


    HAH! And you can really see the advantages of it, too. You can just keep driving and driving in any direction and there’ll be more of L.A. for you to see. None of those static cities can boast that.


  16. John says:

    If like me you are interested in procedural world generation, I’ve recently launched a website for my own research and experiments in this area:

    Oh, and keep up the good work Shamus!

  17. John says:

    If like me you are interested in procedural world generation, I’ve recently launched a website for my own research and experiments in this area:


    Oh, and keep up the good work Shamus!

Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun. Your email address will not be published. Required fields are marked*

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="">Darth Vader</a> on Wikipedia!

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

Leave a Reply

Your email address will not be published. Required fields are marked *