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!
During 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:
And these tables have some handy reference capabilities (recursing through each table referenced) and weighting for randomized results:
"The [t1] of [t2]" 10
"The [t3] [t1]" 10
"The [t1] of [t3] [t2]" 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.