Back to CityGen

Another big gap between the last update and this one.  Part of it was a good thing (two-week vacation to Japan) and part of it was a bad thing (two weeks of airport-spawned sickness after going to Japan). Then for the last month I continued to purge that damn technical debt.

datafilesIt turns out there were a lot of things that the game generated (including things I wrote this summer when creating the overworld) that was mired in sub-awesome way of storing things.  I can’t say things are perfect now, but my Perforce  tree is starting to fill up with all the datafiles I can now create, search and copy to my heart’s content.

The datafile system (again, inspired by the one used in Dungeonmans) allows me to use tables to reference other tables, as well as arbitraily roll dice for whatever I want.   I still have entities to squeeze into the system but I think everything else is in a pretty good state.  Now I just have to train Notepad++ to parse them just a hair better and I’ll be in a great place for editing.

One thing I won’t be converting into text files is the Patch System I wrote for my initial attempt to create cities.  I wrote that system to integrate well into the entity editor, and I can drop in a bunch of tiles into an object and then drag the object right into an info panel to bake it out.  I’m not great at tools but I’m pretty happy with that one.  I’ve only just started to fill out variety with it but I think it can produce some really crafted setpieces in the midst of the pile of procgen that a Roguelike generally has.

patches

Coming back to working on the generation of a quality city, I decided to double down on the value of Patches and try a generation system that capitalizes on it.  We colloquially call it the “Crown Royal bag” method, once again inspired by Dungeonmans (Jim mentioned in his talk at last year’s international Roguelike conference).  It was actually first written about by Mike Anderson on RogueBasin.  The idea is to keep a list of all your legal walls that can hold doors in a list and draw randomly.  Pick one of those walls and consider busting a door into the side.  Then pull a precrafted “room” from your virtual Crown Royal bag at random and see if it fits onto that particular doorway.  If it doesn’t fit, throw it out and start over.  For hundreds of draws you might only place 40-50.

tilepatchesThere are number of issues using this for a city.  First of all, as you can see here, my tiles are created with entrances and exits built in…   I had to create an entrance and exit tagging system to figure out what tiles were valid connections to each exit.  That wasn’t too hard luckily, although I have to create connections now for single-lane roads and just plain asphalt and dirt, which are more interesting alleys and short cuts than the core big, two-lane roads.

Second, the technique basically creates a tree rather than a nice, playable dungeon with loops.  I’ve got a ton of ugly dead ends and roads that lead up to other roads but don’t connect.  It’s important for the proper feel that intersections look right and create nice setpieces with crosswalks and driveways and stop signs and such.  To accommodate this I need a more sophisticated system, in particular a way to overlay roads onto other roads and have them convert to intersections.  That actually means that I’d be heading into creating a road link system instead of relying on handcrafted patches, but I think I can integrate some smart tagging on my tiles to handle this.

cityloops

The battle continues…  Trust it’ll look better soon.

Leave a Reply

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