Pixel City Redux #1: More Pixels

By Shamus Posted Tuesday Apr 10, 2018

Filed under: Programming 82 comments

The programming bug has bitten again. This is bad. I’ve got other writing I need to do. My Wolfenstein series ends in two days. If I don’t get the next series done then you folks won’t have anything to read on Thursdays. Still, this project got stuck in my head and after a week or so of not working on it I realized I wasn’t getting anything else done because I was spending all my mental energy just trying to not think about this. Now I’m hoping that if I put a few days into this I’ll be able to think about other things.

A lot of things brought this about. My time with Grand Theft Auto V has got me thinking about the problem of crafting urban gamespace and the terrifying expense and complexity of the problem. My friend Paul got me thinking about programming again. Out of the blue, a couple of people sent emails mentioning or asking about Pixel City, a project I did way back in 2009. Also, I’ve recently played Left 4 Dead again, and that game was one of the inspirations behind Pixel City.

If you never saw Pixel City, it was a programming project where I tried to fake a city using nothing but black cubes and lit windows. It turned out okay:

Link (YouTube)

I want to do a next-generation version of this that can be explored on foot. (Or at least, from ground level. I doubt I’ll make actual walking mechanicsSpoiler: Wrong!..) I’m not trying to make a game or anythingThis is still true.. I just want to make a city using nothing but code.

I also want to mess around with some rendering tricks I’ve been thinking about. I like the idea of taking a full-color scene and crushing it down to EGA or even CGA color levels. Maybe experiment with dithering? I’m just curious what that sort of effect will look like in motion.


It’s important to set goals now so that when I fail to meet them later we know which parts of the project I’m supposed to be ashamed of. Here’s what I’m shooting for:

  1. A city of proper “videogame” size. It doesn’t need to be Manhattan, but it needs to be big enough to FEEL like Manhattan in terms of how players perceive scale within a gameworld.
  2. It needs to run in realtime. Decent framerate. I mean, I’m not aiming for “playable” or anything, but if my world is slow to the point of being annoying or uncomfortable to navigate then that’s not good enough.
  3. The procgen stuff needs to run in a reasonable time. Say 15 seconds or less. I want to hit a button and get a city without needing to wait for half an hour to see the result.
  4. The buildings in Pixel City were pretty good, but I’d like to revisit those ideas and maybe make some more interesting shapes.
  5. The world needs to have the framework for detail, even if I ultimately don’t put that detail in the city. Like, I’m not planning on learning Blender so I can make streetlights, trash cans, traffic lights, newsstands, vending machines, pay phones, parking meters, dumpsters, fire hydrants, benches, road signs, bus shelters, billboards, road signs, and bike racks. This is a programming project, not an art one. But maybe I’ll put some simple primitives in the world to show that I know where these kinds of objects WOULD go. We’ll see.

To keep things from getting too crazy and having the whole project spiral out of control, I want to constrain it to something I can do in a few days or a week. So let’s put some limits on the scope of the project:

  1. The ground will be flat. I’m not going to mess around with fitting a city to rolling terrain. That can complicate things tenfold.
  2. No cars, pedestrians, or other things that will require tons of programming / art.
  3. No building interiors.
  4. The city will be night only. I’m not going to make the buildings featureless black cubes like in the original Pixel City, but nighttime lighting conditions can cover a lot of corner-cutting.
  5. I’m not going to use procgen textures this time. That was fun last time around, but this time if I need a texture map I’ll spend five minutes bashing pixels together in an image editor rather than spend two hours trying to write code to accomplish the same thing.

I’m starting this project in C++, using my usual frameworkSpoiler: It won’t stay there. of SDL and OpenGL.

Note that the timeline is going to be a bit wonky. By convention I write these entries in present tense, but I’m actually writing this after several days of developmentI wrongly suspected that I could pour a couple of days into this and go back to doing other things and I wouldn’t have anything worth writing about.. I’m going to publish these entries once a week, but each entry represents roughly a day or so of development time. By the time we get to the fourth entry we’ll be well into May, but you’ll still be reading about what I was doing at the end of March. Also, while I’m writing this from the future, I’m not writing this from particularly far in the future. This entire project might hit a wall or come to nothing. I might lose interest. While I don’t know what will become of the project as I’m writing this now, I’ll probably know by the time you read this.

I realize this is horribly confusing. Sorry. For the sake of brevity and basic comprehension I’m going to continue to write in present tense, regardless of what’s going on in a temporal sense. Otherwise this whole series will come off sounding like Primer fanfiction.

Anyway. Enough disclaimers. Let’s get started.


So the most basic problem is “How do you form the city layout?” This is one of those annoying problems that’s obvious to do by hand but rather fiddly to do with code. A child can draw you a passable street layout, but then again a child can identify pictures of birds and it turns out that’s also a really hard problem for computers to solve.

Sure, you can do the brute-force thing of having streets form a strict grid. Every street can be locked to a world axis. But that’s boring. I want something that can gracefully handle T-junctions, diagonals, and so on.

So here’s what I come up with:

There. Done. Whaddya think?
There. Done. Whaddya think?

The program will draw lines to form a mangled grid. No curves to start with, but the roads will meet at odd angles and such. These lines are streets.

Then each street will put down marker points for where a sidewalk will go. These points will have a direction associated with them and will be oriented with “right side forward” scheme. Imagine you’re driving down the road on right side. To your right will be (invisible to the player) markers that point forward, just off the side of the road. On the other side of the street will be the same kind of markers pointing in the opposite direction.

You can't tell, but all those red dots are actually arrows.
You can't tell, but all those red dots are actually arrows.

Once that’s done, we’ll have all these crazy criss-crossing groups of points. It will be chaos. If we use these points to create sidewalks then we’d end up with sidewalks all over the roads. So the second step is to have each road “clean up” any sidewalk points that are encroaching on its space. Once that’s done, we should have something that looks like this:

Well, they're not so much ARROWS as tiny little lines that are red on one end but green on the other. Good enough, since they're just to help me visualize.
Well, they're not so much ARROWS as tiny little lines that are red on one end but green on the other. Good enough, since they're just to help me visualize.

You can see we already have city blocks isolated as little islands. Now I can just grab a point and go the way its arrow indicates, grabbing the next closest point in that direction. If I’m confused about which point to choose, I can favor right turns, which ought to let me enclose all of these city blocks. The only exception is those bits around the edge. If the program hits a dead end, it assumes it’s on the edge of the city and just throws away all the points.

The white outlines are city blocks that it was able to complete. Red ones are blocks that didn't work out.
The white outlines are city blocks that it was able to complete. Red ones are blocks that didn't work out.

This works. I can then use these points as an outline to create the polygons.

(If this seems like an odd way to go about this, you’re right. I’ll come back to this in a few days. I’ll talk more about this then.)

So now I have these enclosed shapes, which form city blocks. Now I just need to put buildings on them.

I already have these points scattered everywhere. They’re a perfect starting point for this job. Here’s what you do:

Grab a city block. Within that block, grab the first point that makes up its perimeter. This point also has a vector, indicating which way to go to walk down the sidewalk. (Walking on the right side of the street.) All I need to do is make a right-angle turn from where this thing is pointing, and I should be facing the big empty interior of the block. From there I can attempt to slap down a rectangle, aligned with this sidewalk. Let’s start with one that’s 10 meters x 10 meters. This rectangle will be the site for a building.

If the rectangle doesn’t overlap with the sidewalk, and it doesn’t overlap with any other building sites, then it’s good. I can nudge it a little larger and see if it still fits. I try making it wider. Then deeperThat is, the back of the building is father away from the sidewalk.. Then wider again. I try to make it as large as I can get away with, while also keeping it roughly square. I go around the block, fitting in rectangular sites like this to fill in each block as much as possible.

Now we're getting somewhere.
Now we're getting somewhere.

Once complete, I have lines for streets, rough outlines for city blocks, and scattered rectangles for building sites. Technically this is everything we need to build a big city like in the original Pixel City. (For the record, those red incomplete blocks on the edge of the city aren’t really relevant anymore. The program throws them away, but they’re still being drawn here for development purposes.)

Just to get a sense of how this is looking in terms of scale, I turn it into polygons so I can have a look around:

Eat your heart out, Crytek.
Eat your heart out, Crytek.

I realize this doesn’t look very impressive in terms of videogame graphics, but I’m pretty happy with what I’m seeing. Try not to think of these cuboids as literal buildings but instead as a representation of the volume for where a building would go. Also, you sort of have to imagine a street and sidewalk textures and such.

The point is that I like how this is working out spatially. Since I’m being a little more ambitious this time, it’s going to take us a bit longer to reach the point where we see something interesting. This is particularly true because I’m about to do something really absurd and silly. I’m about to start over with different tools.

Great, now we just need to add EVERYTHING ELSE and we're done.
Great, now we just need to add EVERYTHING ELSE and we're done.

Next week we’re doing this again, except in Unity.



[1] Spoiler: Wrong!.

[2] This is still true.

[3] Spoiler: It won’t stay there.

[4] I wrongly suspected that I could pour a couple of days into this and go back to doing other things and I wouldn’t have anything worth writing about.

[5] That is, the back of the building is father away from the sidewalk.

From The Archives:

82 thoughts on “Pixel City Redux #1: More Pixels

  1. DaMage says:

    Oh neat, the series that introduced me to this site.

    1. redsoxfantom says:

      Hey, me too!

      1. Ander says:

        Pixel City didn’t introduce me to the site, but I think it was going on when I discovered it. Along with the terrain project, it got me into programming. It’s been–wow, it’s been a while. But now I’m paid to code, so hey. I’m excited to see what Unity brings, ’cause I’ve got a friend who’s currently (not) finishing his senior computer major project in Unity.

        1. Reed says:

          I showed up back in the DM of the Rings days.

          I remember (very) early on, being quite irate that this guy was writing huge, long text posts on what was OBVIOUSLY supposed to be a webcomic site.

          Then I started READING those posts, and, well, the rest is history… :)

          More on topic: LOVE the programming posts, and looking forward to revisiting Pixel City…

        2. Elorex says:

          Honestly if it wasn’t for Shamus I never would have gone back to Computer Science. My first look at it I only got to take Information System classes (High School) and tech support friends and family. Obviously I hated it, but Shamus started posting Programming stuff and I just loved it. It was a whole new world and honestly it kind of changed my life.

    2. Kikito says:

      Yeah! I’m on the same boat as you! Or at least our boats were procedurally generated by the same algorithm.

    3. Yep, same here. Found Shamus young, and it really got me into programming back in middle school. Must have watched the video with that music like 100x lol. Now I’m 21 years old, and a junior in college double majoring in Computer Science and Mathematics. Cool to see this revisited :)

      1. Doctor Ivellius says:

        Now you’re just trying to make people feel old. :P

        1. Erik says:

          Meh. I was already feeling old when the original Pixel City series ran.

          I also found the site during the run of DMotR, and was stoked when he started documenting neat programming projects like this. But I’d already been programming professionally for over 20 years even then.

          You kids get off my lawn!!

      2. Ander says:

        I wonder how weird it feels to read this stuff on one’s own blog. It’s like…I don’t know. It’s one thing when you’re a theatrical actor who gets told by some up-and-coming kid “You inspired me to join the drama club.” You smile and tell the story to others and it’s great because your job is to be on stage for large numbers of people. This is a geek blog started to record a D&D campaign, and there’s a few of us here who are saying, “My career started here.” I’m grateful, but that’s gotta feel bizarre.

    4. Kronopath says:

      Same here! I am so glad to see this coming back.

      1. Axehurdle says:

        Yep, this is the content that I fell in love with and made me stick around for longer than I’ve been on any other site.

  2. Richard says:

    Whoo! Party like it’s 2008!!

    Pixel City and the other procgen series, with the landscape/hills/island(?), were some of my favourite bits of content over the years. Intriguing stuff for a layman, and I love the charmingly self-deprecating tone which you adopt as you write about the foibles of last-week you.

    1. Epopisces says:

      Echoing this comment: I like most of your content, but these programming journalogues are probably my favorite category of post.

  3. Mephane says:

    Like, I’m not planning on learning Blender so I can make streetlights, trash cans, traffic lights, newsstands, vending machines, pay phones, parking meters, dumpsters, fire hydrants, benches, road signs, bus shelters, billboards, road signs, and bike racks.

    While I can’t really point you towards any particular source, I know there are sites with free to use stock objects for this purpose.

    1. rabs says:

      A nice one is Google Poly, mostly for objects created in VR with Google Blocks.

      Those are often simple / low poly with CC-BY license.
      For example, trash cans: https://poly.google.com/search/trash%20can

      1. Paul Spooner says:

        Beat me to it. I recommend google poly for any placeholder assets you need.

  4. GargamelLeNoir says:

    Hey, if it worked for the System Shock remake it can work for Pixel City!

    Too soon?

    1. Modran says:

      This was the first thing that came to my mind too :D !

      1. Daniel says:

        Same thought I had.

        I look forward to the post where Shamus tells us he has gone back to the original vision he shared with us when this series began . . . and that the series will now be completed in 2020.

    2. Lanthanide says:

      Turns out that System Shock isn’t actually dead!

      The developers are returning to the original vision. They’ve also just released the original System Shock source code for MAC. I’m a little surprised Shamus hasn’t written a post about this, to be honest.

      More infos here:

      Turns out the real backstory is that just after their kickstarter campaign, they got a verbal agreement from a publisher for a bigger game, hence why they switched engines, but the verbal agreement never resulted in an actual contract. So that was rather foolish of them.

      Looks like they’re trying to make good on their promises, though.

      1. Mintskittle says:

        From my experience, never accept a verbal agreement as a business. We had a customer ask for certain changes verbally that contradicted the purchase order, and afterwards, tried to screw us over because what we did wasn’t in line with the PO. So now policy is changes to the PO must be in writing.

        1. Olivier FAURE says:

          Yeah, that’s kind of “business 101”.

        2. Daemian Lucifer says:

          A workaround is to have all of the meetings recorded.Unless your state specifically prohibits recording business meetings.

  5. Kathryn says:

    So it’s obviously too late, but a thought – the current grid does not (to me) look like something that would either naturally arise or be planned. I do live in a city that has wonky streets, and the two main reasons are waterways (the downtown grid is canted instead of being north-south and has funny edge conditions because of the bayous; further out, there are many smaller roads that end at a creek and pick up on the other side of the creek, with only a couple bigger roads actually crossing said creek) and major roads that began their lives as cow trails long before Henry Ford. To simulate the latter, you could have one to three major roads winding through the area at weird angles (we have two even-numbered roads* that actually intersect) and minor roads that are more or less a grid between them.

    The key is that in both cases, you *do* have a 90° grid where geography permits and where newer roads are added after major ones are already established, as opposed to the “jackstraws” approach shown here. But I think either way would require curves in your streets. Which is a whole new ball game.

    Anyway, I look forward to reading the series!

    *even number means east-west, odd number means north-south. These roads should theoretically be parallel. They…are not. Not even close.

    1. Jaaxter says:

      I would actually chime in and say that this grid looks a LOT like the downtown of the town where I grew up. It was built on a river that runs almost north-south but not quite, so some of the roads are aligned to the river (breaking the north-south alignment) and also was built over a ridge that was a little too steep for draft animals to pull a cart straight up the ridge, so roads have to go up the ridge at an angle, breaking the east-west alignment.

      1. Kathryn says:

        I had wondered as I was typing if grades in the land would make a difference. (The closest thing to hills we have around here are highway overpasses!) Thanks for the info.

        I hope more people will comment on road layouts in their areas, because I find the topic surprisingly interesting. The influence of geography is usually fairly predictable, but the human element/politics can be much less so. For example, I have read that nearly any road in Rome that is actually straight is the work of Mussolini, and apparently some of the roads (I am thinking of the one that leads from the Castell Santangelo (spelling? It’s by the bridge with all the angel sculptures by Bernini and his students) to St. Peter’s) were controversial at the time because of the amount of city that had to be knocked down to make way for them.

        1. Well, I live in the suburbs of Atlanta, and you want interesting (and WTF) roads, we got ’em!
          There is a grid to downtown and midtown (sorta), but once you wander out from there you have a river, a lot of hills and a couple mountains, cities older than Atlanta itself that are now suburbs (Roswell comes to mind), counties that hate each other, and major intersections designed by the insane. There are 3 major roads all called Roswell Road (they all go to Roswell, GA, but start in different counties and cities and only intersect in Roswell where none of them are called Roswell Rd anymore). Oh, and the Peachtrees, all the Peachtrees…

          There’s a reason I still tell my grandmother’s joke about Atlanta being designed to confuse Yankees…

          1. Viktor says:

            I worked on a subdivision one time that had the same street name for 3 different roads. It was basically:

            With all the vertical roads called the same thing. There was some logic to it, but I pity anyone who tries to give directions to a house on one of those.

            1. Daemian Lucifer says:

              My city has similar things.While building a part of it,for some reason the “fingers” protruding from a road inside a block were given the name of the street they were protruding from.Makes some sense.Except that the same naming convention was used for the entire city block,with all the crisscrossing streets.And in (numerous) cases where a street would go all the way through the entire block,from one major street to the next,half of it would be named with one name,half with the other.Basically this:

              ====== Name 1
              ___|___ Name 1
              ___|___ Name 2
              ___|___ Name 2
              ====== Name 2

        2. Viktor says:

          I saw a picture of a California city a few weeks back where half the city was built with NSEW roads and the other half the city was built with roads that run parallel/perpendicular to the coast. Apparently there were 2 city planners who hated each other and refused to work together.

          I’m mostly just used to a grid with random dead-ends. There’ll be a park, or an arena, or block of historical buildings, and the road just ends at a 1-way street. Fun to navigate if you’re not used to it.

        3. Amstrad says:

          My favorite local political road thing is the US Rt. 219 which started life as your usual two lane rural highway. In the 70’s a new expressway was built that followed a portion of the old highway from the city of Buffalo south towards Pennsylvania, the obvious intention being to build an entire stretch of modern expressway and link it up with a similar roadway in PA. For whatever reason however it didn’t make it that far and instead terminated in my hometown of Springville, which really didn’t have anything of interest in it during the 70’s. The result was that for 30 years a major express route terminated in this small town, which suddenly got a bunch of development (your usual fast-food, gas, big-box retail, etc). Then in the 00’s the project restarted and the expressway was extended at great cost (a bridge over a gorge complicated things). They made it 4 miles. Now it ends in the middle of absolutely nowhere. Who knows when/if it’ll be extended further.

          1. Blackbird71 says:

            I was once in a country where the typical political cycle involved someone getting elected to office, building a pet project that they could put their name on as a monument to their term of service, and then that individual getting voted out of office at the next election, often before their project was completed. The new elected official rarely had any interest in completing their predecessor’s project, and so would instead start on creating their own landmark. This resulted in many half-finished structures.

            My favorite was a bridge on a main road that only spanned two-thirds of the way across a river.

    2. Anonymous Coward says:

      And this neat grid is generally not how most cities in Europe work. Because they weren’t planned, they grew.

      The general shape of such a city is the circle. You’ll find lots of concentric circles there, places were city walls were. Grid-like parts are then oriented around those circles. But again, not as neat. Roads split or end in cul-de-sacs, a janky road here, a winding road there, parks and rivers and lakes.

      1. Droid says:

        I already wanted to point out how the original Pixel City’s “classic” buildings are still pretty modern by European standard, so it’s not like Shamus was going for that look at any time during this project.

        European cities also generally speaking have an Oldtown at their center, with the American-style Downtown/Highrise district tacked onto the center.

      2. Bubble181 says:

        Yeah, as a European, this doesn’t resemble any city within a thousand miles from here, except *maybe* one or two that were sufficiently razed during WWII to have been rebuilt on a “modern” lay-out during the fifties.
        I’ve been to the USA, so I do know from experience that lots of cities there are “designed” like a drunk chessboard, but it’s still somewhat weird to me.

  6. Olivier FAURE says:

    Next week we’re doing this again, except in Unity.

    Oh fuck.

    I’m curious how this turned out. From my experience, Unity is the worst for this kind of non-standard project. If your experience was better, then I look forward to you explaining how you proceeded. If your experience was the same as mine, then I absolutely look forward to you explaining in detail why Unity doesn’t work for this approach.

  7. NilkadNaquada says:

    What a surprise to suddenly see a Pixel City project on this site again. I’ve had the original Pixel City set as my screensaver for several years now and really loved reading through the development posts for it, looking forward to seeing more of this one.

    1. OldOak says:

      Same here, with the observation that I used the ported version (self-compiled for x86_64 both Windows and Linux).

      To paraphrase a StarCraft II quote regarding this come back:

      Now that’s the commander I’ve been waiting on!

    2. SAD1 says:

      I also still have Pixel City running as the screensaver on my desktop machine! :)

  8. Redrock says:

    I’m about to do something really absurd and silly. I’m about to start over with different tools.

    Hey, that’s not what the Kickstarter trailer promised! Shame on you!

    … in all seriousness, did you hear that the System Shock thing seems to be back on track? That was pretty surprising.

    1. Daemian Lucifer says:

      But is it the original, correct track, or the falde one?

      1. Echo Tango says:

        It sounds like it’s going to be basically the original track, that was shown with the original demo. They’re sticking with the Unreal engine, instead of switching back to Unity, and they’ve apparently cut down to the original team of devs. So maybe they’ll actually be able to make a finished game this time, and keep the scope limited?

  9. Ermel says:

    Good to see you give in and do this already. I’m looking forward to reading about, and maybe (if ancient hardware allows) even trying to run, the new PixelCity. Your programming content has always been my favourite on this site, anyway.

    1. Ermel says:

      And by “already”, I don’t mean that I as a reader feel entitled to reading it or something, but that hearing you agonize about wanting to program but not having the time to do it, which you did while driving around in GTA V, made me wish that you gave in to that desire. Thought I’d clarify, because for me as a non-native speaker of English, my own sentence sounded slightly demanding on re-reading — if it does sound like that to you, well, I didn’t mean it that way. JFTR.

    2. Echo Tango says:

      If this can’t run on old laptops, what’s even the point? :P

  10. KarmaTheAlligator says:

    Hadn’t seen Pixel City, loved the video. And I get the feeling I’m going to like this series.

  11. McKracken says:

    Mentioning that you’re already several days ahead of what’s described here just prevented me from starting to come up with alternative ways of doing this, and will probably prevent a bunch of armchair advice, not just from me.

    It seems like your block-finder algorithm failed on two closed blocks. The very sharp triangular one on the left edge I kind-of understand because the sharp angle is far away from 90°, but the small rectangular one in the middle? Was that too small to fit a 10x10m house in?

    Some of the blocks look quite realistic, at least superficially, but some of them seem a bit weird to me. In most (resonably planned) cities, I think you’d have similarly-sized houses, or almost-identical ones, make up one front of each block. Because usually the streets were either built around previously existing houses, or the houses were built to make best use of the space between the streets, I’d expect to see more equally-sized buildings next to each other in one block, or have some blocks or parts of blocks replaced by very large custom-shaped highrise buildings which are molded to the sidewalk outline, to make best use of the available footprint area.

    1. Echo Tango says:

      In blocks (or even cities) where all the buildings went up at the same time, you’d be correct. However, you sometimes have buildings built at weird sizes, because one building used to be some large department store that was built big and built early. Then they built 10 small buildings when they were trying to change what kind of commerce they wanted to attract downtown, then they went back to medium-sized buildings because they replanned downtown again. But half of the old buildings are still in business, and two of the buildings are historical sites that can’t be torn down. Across one street is a giant whole-block mall, and across the other street is ten evenly-sized apartment buildings.

  12. Abnaxis says:

    At this point, is constructive criticism still a thing that is worthwhile?

  13. MichaelG says:

    “form a magled grid” — mangled?

  14. D-Frame says:

    If you’re writing from the future, you may as well include some lottery numbers.
    Also: YAY! PROGRAMMING! Please just drop everything else you’re doing and keep going with this.

    1. totally not D-Frame with a different name says:

      I second that.

  15. kikito says:

    > The world needs to have the framework for detail, even if I ultimately don’t put that detail in the city.

    A street light is just a very small building, repeated at regular intervals.

    BTW you might be interested in going the “grammar/domain-specific-languaje” way for implementing your buildings this time. http://procworld.blogspot.com.es/2012/02/grammar-editor-in-voxel-studio.html . I’m not saying it will take less time, but it will probably be more interesting than hand-coding all the rules in C#.

  16. Shamus your street grid looks kinda odd. All the roads go straight through the city.
    Shouldn’t a few of them end halfway through, that way you’d have blocks of buildings sort of shifted right or left.
    You only have 4 way sections, there are no t sections that I can see.
    And you’d also have at least one corner (“L” ?) in the city where there is no “T” or “X”.

  17. BenD says:

    Way back in one of the GTAV Shamecasts (Maybe March 14) someone asked if you’d consider Unity again, or try it, or something. And your answer was mild but felt…weighted to me. Were you coding this then, or still in the denial phase? XD

  18. Paul Spooner says:

    So cool! I’m really looking forward to this series!
    And, if you need someone to procedurally generate placeholder assets in Blender, I may know a guy.

  19. JackV says:

    Oh, yay, more programming! And prose intro to unity, even.

  20. StuHacking says:

    This is bad.

    Completely disagree. (Sorry :-))

  21. Dev Null says:

    Details which are probably overkill for the project your working on:

    The uniform width of the streets looks weird; where are the alleys?

    The blocks where the buildings span the entire width look weird (having trouble describing this; a given building has street frontage on two parallel streets?) You do see this in the wild sometimes, but not often in my experience (at least, when you’re only counting major thoroughfares because you have no alleys…) Usually you get layouts more like the ones you have that divide the blocks up into a series of lots around each edge, either backing onto each other, or onto a central space (where, just to over-belabor a point, you put an alley… and your dumpsters and loading docks.)

    1. Echo Tango says:

      Whole-block buildings, or buildings with doors on two or more streets aren’t that unusual. Big department stores, malls, etc, are all things that touch two or more streets. It depends on how big the buildings are, and how big that particular block is.

  22. Moridin says:

    Nice! I have to say that your programming projects always end up more interesting than your videogame analysis. Although that’s probably partly because I rarely play the games you talk about.

  23. Blake says:

    “Out of the blue, a couple of people sent emails mentioning or asking about Pixel City, a project I did way back in 2009.”

    Funny how things all line up sometimes, after not thinking about Pixel City for a long long time, I saw a car last week that had white tail lights, and mentioned to a friend it was confusing that they weren’t red, then told him about how you did the red/white sprites in Pixel City to imitate cars.

    1. Erik says:

      I think that (at least here in California) white tail-lights are not just confusing, they’re illegal. Exactly because of potential confusion, I seem to recall that all back-end lights must be red or amber, while fronts are white or amber.

      …one Google search later…


      ILLEGAL BRAKE LIGHTS: Brake lights on vehicles newer than 1979 must be red (24603 VC). (Vehicles older than 1979 may be red or yellow.)

      LACK OF REAR REFLECTORS: Two red reflectors are required on the rear of cars and trucks (24607 VC).

      INCORRECT COLOR OF TURN SIGNAL: It must be white or yellow to the front, red or yellow to the rear (24953 VC).

      RED LIGHTS TO THE FRONT: They are illegal except on emergency vehicles (24003 VC). This is one way to get pulled over very quick!

      Tail lights that incorporate a bulb with a red tint or coating. In general, custom tail lights that incorporate a clear outer shell and red inner lens are legal (24011 VC). If they don’t incorporate reflectors, they must be added to the vehicle (24607 VC).

      * 24607 VC

      Every vehicle subject to registration under this code shall at all times be equipped with red reflectors mounted on the rear as follows:

      (a) Every vehicle shall be equipped with at least one reflector so maintained as to be plainly visible at night from all distances within 350 to 100 feet from the vehicle when directly in front of the lawful upper headlamp beams.

      * TAIL LIGHTS THAT ARE TOO DIM, washed out or show yellow, white or other colors (24600 VC). Ugly anyway

      This section should apply to the tinted tail lamps covers. The tinted covers that covers the red brake lights.

  24. Sabrdance (MatthewH) says:

    Hey, I’m excited!

  25. Chris says:

    I’m really glad you’re returning to this project space. I really enjoyed the Pixel City series! The programming stuff is always my favorite.

  26. Ilseroth says:

    Super excited for this series, I’m a dev that works with Unity so I’m curious to see where this goes.

    As someone else said, doing this kind of weird thing in Unity could be challenging, especially as a first project, so I’m really looking forward to how you work with it!

  27. Pixel City was always my favorite of your series, and I’m glad to see you working on it again. It has inspired me to create my own procedural city. Just by coincidence, this is what I happen to be working on right now. I have somewhat different goals than you, but there is some overlap in our night time scenes. See my
    recent blog post

    1. Dan Efran says:

      Hey, thanks for that link! Your procgen engine looks pretty awesome, at first glance. I’ve only looked at a few of your posts so far, but even your earliest screenshots are pretty rad. I look forward to reading the whole thing in detail, in the inevitable dry spell after Shamus’s latest show-and-tell.

      (I consider twentysided to be a stellar example of a procgen blog, when Shamus stays on topic…. Long form game critique is okay too, for a while, and he’s good at it, but his true strength IMHO is finding clever hacks to build efficiently rendered random scenery. (And describing the journey in an entertaining way, but with plenty of technical details.) It sure is a pleasure to watch a city rise up from the emptiness once more! This is what I come here for.)

      1. It amazes me that Shamus was able to put together Pixel City in what, 40-50 hours? That’s a work week. I probably spent that long just getting the roads to properly connect my cities together.

  28. raifield says:

    I haven’t read the original ‘Pixel City’ entries, but as someone who wishes he had time to pick up programming this is incredibly interesting!

  29. Garrettt says:

    Neat. I’d like to see how all of this is going to be done in Unity. It also reminds me of the work one of the Introversion software guys did for a video game they never released called Subversion. The development diary was really interesting but they never could figure out how to make a fun game. You can still read the diary but all the pictures are missing and there are a few videos of the city generator in action.

  30. MadTinkerer says:

    The programming bug has bitten again. This is bad.

    Not for us! :D

  31. AndrewCC says:

    People that are interested in this subject should check out Megaton Rainfall. It’s a game where you’re a superhero and fight an alien invasion. It does a pretty decent job at procedural generation of cities and an amazing job at dynamic destruction of those cities. The gameplay is kinda weak but it’s interesting concept.

  32. JackV says:

    PS. This isn’t really relevant to this post but I started playing Factorio and boy am I addicted, thank you for talking about it!

  33. Mervyn Bickerdyke says:

    Loved the original PixelCity, though the screensaver never completly worked on my machine. I did a few Unity tutorials a while ago and maybe I’m able to do a code along with that series! Would be great.

  34. Here is a interesting study in how GTA V defer it’s rendering maybe this can spark some ideas for your renderer Shamus?

  35. Neil Roy says:

    Great, I miss your posts for a couple years and it figures I miss one of my favourite projects being revisited. I really need to keep my eyes on your page. :/

  36. Neil Roy says:

    One idea concerning buildings. I always thought that it would be interesting to have procedurally generated building internals. So you enter a building and it generates an interior that you can explore, rather than having a bunch of solid blocks with doors you can’t open.

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="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>

Leave a Reply

Your email address will not be published.