Post

Game Programmers - how do you build your campaign systems? I mean: The things that track and determine which doors are locked, the current phase of the moon, and whether or not the last insult you hurl at the grand wizard is enough to make them leave the dinner party. #gamedev #gameprogramming

I've seen a bunch of games just spray this logic absolutely everywhere, but that means for anything beyond very simple quest structures it's easy to introduce progression blocking bugs, you can't map possible game states and routes for analysis, and the only way to test is to play the entire thing.

I previously built a little IF prototype that uses rules (actually just nested ifs) to select available affordances which then modify the game state and... I really like building with it. All the logic is in one spot, I can click through a playthrough super fast, and it should be automatable.

I guess my question here is - should I push all my campaign logic through something like this or am I overthinking it? Right now I'm building an action RPG and testing and setting campaign state on individual doors, NPCs, pickups etc, and it feels extremely fragile.

Anyhow, I'm going to have a go at using a more formal, centralized approach to dropping the gatehouse key when you slay or befriend the dragon. It's more work but should allow: - Click-through campaign testing - Automated random testing - Dead code and soft lock detection - Easy instrumentation

I'll also be able to detect bugs like trying to save during atomic campaign updates or level skips. I guess campaign logic violation should invoke a Mr Resetti type event, where some magical thing happens and you return to the last save point. And it logs a bug.

Yeah no this was a mistake. It seems great when you build the logic itself, but integrating it with the wider game I found that most of the bugs are gonna come from misalignment between the verbs the campaign logic says should be available and what you can actually do in a level.

So for example the campaign logic would need to know about walkable terrain and where lockable doors are placed. Meanwhile lockable doors, pickups, NPCs etc would need to instantly respond to any campaign logic state change. Also recoverable bad states would be met with hard errors. Eep.

this is one of the reasons I use Chatmapper as a backbone for and driver of game state logic and content authoring tool - it runs on lua and exports to a number of formats, on top of having incredible debugging and simulation tools in itself, but it's probably not a great fit for low text-y games

Oh nice! Thankyou. I will check that out. My game uses Lua already so it might be a good fit.