Super busy week and weekend, only finishing up now - late on a Sunday evening. Work was mainly refactoring all the world generators to be compatible with the new game planner code. I’ve modified at least 10,000 lines of code this week, which gives you an idea of the scale. It’s very tedious: adapting old code to use new code, changing locations of structs, etc.
All this work is so that I can specify game properties at the level of the Planner. Here’s some code for the Planner on the left … all it’s doing is saying it wants a Skeleton and Furnace at a certain location in a level. The generator then takes this info and figures out exactly where to place those things. The generator is then also free to add extra enemies and objects. This frees the Planner up to focus on just important game-wide elements.
In addition to the NPCs, some other game-wide elements include World Objects (like the furnace above), Features (which include simple things like spawn points to more complex structures like Houses), and Internal Doors (which connect up the different regions).
Related to this refactor I’ve moved all the crafting recipes into a huge spreadsheet. They were split amongst several files before, so it’s great to have them all centralised. Each entry is basically a series of [RECIPE LIST, VERB, ITEM, INGREDIENTS] rows.
I decided to generalise the concept of CRAFTER to that of a RECIPE LIST. In the game I can now give a recipe list to an NPC or a world object, and it gains the ability to craft items from that list. Typically a World Object will correspond to just one recipe list (e.g., a Toolbox will always have the Toolbox recipe list (below)). But more generally, it means we can customise other crafters. E.g., for Boney’s Furnace above, we could attach a different recipe list to give it a customised set of items. Likewise for NPCs, I could design a set of different recipe lists for merchants and then assign one randomly and/or dynamically.
See you next week!