Category Archives: AutoFire

7DRL 2017: Day 1

7DRL Challenge Day 1: Unfortunately GDC lay me flat on my back for five days straight through the weekend, so I’m getting a really late start on my challenge. I guess I’m be aiming for submission late Sunday to get as many hours logged as possible.

Today I was able to re-acquaint myself with the ugly-ass 7DRL 2016 codebase and temp sprites. <Shudder> All I had time for was to start working on road generation and take a step in the direction of transforming my combat movement into strafes, accelerations and so on. Still got lots of work to do. Still, fun to see things moving forward.

7DRL 2017: Westbound and Down

This is my third 7DRL, and this year I’m hoping to kill two birds with one stone by exploring some alternate gameplay concepts I first explored in last year’s entry, Auto FireAuto Fire introduced car combat and exploration of a (poorly-rendered) cityscape and in the ensuing year has been extended to 3D, with richer generation, an overworld countryside, and a variety of superior UI and tools.  None of which I’m going to use this week, see below.

This year, with Westbound and Down, I want to explore some of the “Convoy” style aspirations that I have yet to put into Auto Fire…  Traveling from town to town and taking on cargo missions between outpost cities in a post-apocalyptic western U.S.  Instead of exploration combat, the player must drive “blocker” for a convoy of trucks that is continually harassed by bandits and other road hazards.  Upgrade your car and convoy vehicles, hire drivers, maintain your stock of ammo and fuel, and take on loads with higher risks for greater rewards.

The tough part of this year is that even though I’ve progressed quite a bit with Auto Fire’s codebase over the last year…  in the spirit of making this a fresh 7-day effort, I’m working from the code from 2016’s 7DRL and seeing what I can construct within those confines.  I hope to create an alternate movement model (forced directional movement, with most of the maneuvering involving lane-changes and acceleration/deceleration), a regional highway map, a cargo quest structure, some interfaces for cargo and hireling loadout, and hopefully some FTL-style dialogue encounters which could lead to bonus salvage or ambush.  That’s a fair amount of stuff, but I’m hoping I’ve got enough to build from…  and if I have to hack up my code a bit to try something, that’s okay, I can take any successes and work them into Auto Fire later, hopefully the “right way”. 🙂

Loops and destruction

In the past few days I’ve managed to add a whole bunch of loops to the city generation.  This was achieved by adding optional exits to the blocks that I lay down…  These are invisible overlays that, if a road tries to enter a block that doesn’t have an entrance on that side, can be stamped down over the existing block to let it link back.  It helps a lot with the four-lane highways in particular, which would act like a barrier that didn’t integrate into the rest of the street maze if I didn’t allow it to reconnect.


More loops are important because driving and having to turn around is fairly bad…  the fewer dead ends the better.

Once the map is complete, I put down more obstacles and overgrowth.  Then finally I take some Perlin noise to the map and add destroyed swaths, both rubble and driveable stuff, just to add interest.

I think I can move beyond generation for the time being.  Now it’s time to get fog of war back in so that the map feels more mysterious and ready to explore.  Then I’ll lay out a boss battle fortress…  woo!


I’ve made more progress in sealing up road connections, adding more variety and, most of all, creating 4-lane roads!  I’ve still got to work on seeding out the highway before the map is built, so we have a big thoroughfare in there.  Pretty soon I should be far enough to start getting Fog of War back in (which was ditched when I made the move from 2D to 3D back in May).

Also, Unity has had some nice sales lately and I stumbled onto this, which I jumped on.  At first glance the pack seems to be selling a bunch of muzzle flash VFX and so on, but it also includes this sweet modular turret system which includes a bunch of different weapons that can be separated from their turret bases.  How cool is that?


I was starting to make plans towards learning some basic 3D modeling so that I could make weapons like this…  typically they are attached to the side of a vehicle or something.

In my case I want the player to be able to see the weapons in their inventory, and then place them out on a grid.  So, while I will still need to find or create some of the more unusual models (what does a smoke screen sprayer look like?), I can get pretty far with these guys.

CityGen – Making it fun

I managed to carve a good chunk of time working on city generation over the 4-day Thanksgiving, but I wish I were done.  My core accomplishments was in creating single-wide alleys, more crafted patches for both 2-lane and alley roads, and most importantly:  Allowing patches to be rotated when placed.

This allows me to create more variety, not just because things look different when rotated, but also because I can spend my time on crafting unique areas without having the create four direction rotations of them.  It’s getting there…citylayoutweekend2a

The biggest problems beyond variety is playability.  The most interesting maps should have some interesting tactical spaces, and more importantly enough loops that give the players a better sense of exploration as well as not punishing them as much for getting some speed going (which dead ends can completely wreck).  Typical Roguelikes (Dungeonmans included) introduce at least a few loops so that exploring the map doesn’t force endless backtracking.

A whole bunch more work is needed, including:

  • Make additional large patches with interesting tactical features such as open areas, wide runways and so on.  This will help keep the game from just being a bunch of corridors.
  • gen
    A strange street flow perhaps, but I just wanted to try some more interesting tactical layouts.

    Create an evenlarger 4-lane road type and seed the map with a couple of large roads.  This should present some neat places to build up some speed.

  • Checking patches before they are laid down to make sure that they are not blocking off an adjacent road (this leads to a series of roads that lead to nowhere).
  • When the map has been expanded as far as it can be (usually a set value, such as 1000 attempts at placing a patch), make sure that all the “unexplored” road tiles are capped with dead ends or are connected up to their neighbors.  (Again, this avoids road connections that terminate abruptly.
  • Add some “overlay” rules and tagging that allows for “optional” entrances into a block.  This way if I try to lay down a block next to another block, I can more easily “bust a hole” between the blocks as needed.  This will be huge for generating loops.
  • Create a few rules to evaluate a “good” map, including if there is enough space to explore and that there are areas suitably deep in the city where boss areas can be placed…  and if those criteria are not met, throw the whole map out and start over.

I basically need to take this as far as needed until it’s fun, and then step away from it and worry about making it perfect later.  Something like this could take all of my time for many months if I let it.  Over time I’ll try to add new models, streetlights, textures, buildings and so on, but I need to work towards something I can play again.

Once the map generates well (hopefully in another week), I’ll need to properly populate it with encounters, and create a boss area fairly far from the entrance that players need to play towards.  Once I’ve got that I’ll be back to having a game loop and can push to sharing a build out.  That’s something I really want to get done before the holidays.


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.


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.


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

So Many Datafiles

Yes, Technical Debt is still rearing its ugly head.  One of the things that any procedurally-generated Roguelike has is a ton of different files that hold profiles that define how to generate cities, landscapes and enemy encounters.  And tables, so many randomized tables!

sceneinspectorDuring the 7DRL I found an expedient solution that worked for the challenge and a fair amount of time afterwards.  I baked data right into each Unity scene that I saved out, imagining that I could just make a scene for each type of scenario or terrain profile I wanted.  I could bake in components that had all the predefined information I needed and just load them as needed.  I could even drag-n-drop the appropriate prefabs for everything I wanted to spawn.  How simple.  Sure, it nagged at me that it wasn’t super extensible, but scenes were cheap to make and I was interested in how far it could get me.

Wellll, it turned out it was pretty far, but eventually it started to haunt me.  The more scenes there were, the harder they all were to maintain, even if all the common information was kept in Unity prefabs.  Oh god, the prefabs…  they are great sometimes, but they also can puke all over themselves if I moved files around or a metafile got invalidated somehow.  Also, any time I wanted to choose something randomly, it felt like I was writing new code to deal with it each time.

I also used the serializer for a number of structures, but there was always a desire to have more flexibility when reading data.

Anyway, I knew I needed to up my datafile game.  My friend Jim’s amazing RL Dungeonmans has something like 500+ datafiles holding anything from name generation to encounters to tile definitions, with weighted randomization tables and tables that reference other tables.  How slick!  He spent many years refining his data methods and he encouraged us to reuse his approach in our own games.

So last weekend I finally bit the bullet and built a datafile system around some of the same concepts and in the end my format is virtually the same as Dmans.  This way I can build a sector with a pretty flexible format:

defThing sector_basic
 class adSectorData
 scene Overworld

 biome Desert
 nametable sector_name_chart
 treasuretable sector_treasure_table

 music mus_desperado

 basic_city_table 1d2
 sector_outpost_chart 2d4
 sector_town_chart 2+1d3

And these tables have some handy reference capabilities (recursing through each table referenced) and weighting for randomized results:

defTable "sector_name_chart"
 #t1 "sector_place_types"
 #t2 "place_nouns"
 #t3 "sector_adjectives"

 "The [t1] of [t2]" 10
 "The [t3] [t1]" 10
 "The [t1] of [t3] [t2]" 10

defTable "sector_adjectives"
 "New" 10
 "Old" 10
 "Dry" 10
 "Frosty" 10
 "Winding" 10
 "Hewn" 10
 "Locked" 10
 "Winding" 10
 "Ancient" 10

…and bingo, my world generation becomes 10x more flexible and powerful.  I’m dyin’ to get back to the drive-shoot stuff, but this was so worth it.


Late Night Asset Store Addiction

The Unity Asset Store is a great temptation at all times, cleverly one click from my development environment.  When you’re stuck in the dregs of some less-than-glamorous code snarl, it becomes the devil.  An Asset Store 24-hour sale are basically late-night Ronco TV ads for game developers.  Just 10 bucks for the next 2 days!  30% off!  But hey, this might be just the thing your game needs to be awesome…

Recently I bought a Volumetric Clouds package, hoping that I could get some cool, turbulent cloud cover with shadows over my landscape as the player wanders around.   Looks pretty good, but my poor frame rate just couldn’t handle it, especially at high resolutions.


The solution involves a sweet technique of rendering many layers of a noise texture so it piles into a volumetric shape.  It seems to run pretty well for ground scenes looking up at the sky, but for my particular situation it didn’t quite fit.  Maybe I can’t use it for Auto Fire, but it’s a clever enough solution that looks great in a lot of cases, so I don’t feel too bad supporting the creator.

I don’t want to obscure the map features anyway, so just shadows would probably do the trick.  I might be able to do an extremely cheap version of the shadows with some some screen space projection instead…  but there are a hundred other things to do first.

I stumbled on another Unity sale recently that dangled a plugin called Beautify in front of me.  “Add a pro look!  Punch up your colors!  See the detail!”  I couldn’t help but bite, because I’m always wondering what I can do to eliminate the muddiness that I sometimes get with Unity, especially when I shrink assets that are intended to be experienced at realistic sizes.

A good chunk of what Beautify does is apply a sharpen post-process, along with some LUT’s to enhance some coloring.  I must admit there’s an appeal to seeing those shrunken assets appear sharper against the terrain or ground surfaces.  (You’ll probably have to click to see the difference).


It punches everything up and everything gets a nice feel in comparison.  However, it uses a sharpen filter, so I have to balance its use versus all the work built-in antialiasing does.  So, while it helps eliminate some of the muddy appearance (something I equate with unpolished products), it adds a lot of shimmer and harsh pixels (something I equate with unpolished engines).  In the end I probably just need some lighting help from a real artist. 🙂

Anyway, I can turn down the sharpen or nix it if I want, which is good because I like the results Beautify gives me with color.  It’s also got sweet bonus night vision and thermal views.

Nonetheless, I’m still looking for the right combination of lighting and filters to attain the pro look I’m after.  The quest continues…  and my wallet fears the night.