In this article I’m going to talk a bit about the design decisions and goals when it comes to modding in King under the Mountain. Please excuse the poor programmer art!
A bit too long ago when I was studying at university, dreaming of being a game developer, I read the first few entries in the Game Programming Gems series. The very first chapter in the first volume stuck in my mind and stayed there, it was titled “The Magic of Data-Driven Design” by Steve Rabin. Here’s a decent article (from the same time period) by Kyle Wilson on the subject (and here’s a good stack overflow post), but it can be summed up as not having any game-specific data hard-coded into the game engine, instead it is all pulled in from external data files. All the weapons, enemies, levels, AI and anything else is driven by easily modifiable data files so that additions and changes can be made easily without needing a single line of code to be changed. Internally for a team of game developers, this lets artists and designers plug their assets or variables/scripts into the game they’re working on without needing a programmer to make any code changes, speeding up the development process considerably. There’s a potentially even bigger win for game devs however, in that this also opens up your game to the modding community, who often come up with weird and wonderful additions that the original devs wouldn’t (or couldn’t) have managed on their own.
Having as much as possible in the game open to modding is one of the architectural design goals of King under the Mountain. Not only does this make new content easier to add as the game developer, modding communities tend to extend the life and enjoyment factor of a game massively. Despite some complicated algorithms going on under the hood (such as the lighting algorithms and figuring out which wall tiles to draw), I wanted the data-driven side of the game to be as easy and accessible as possible. I decided to use JSON as the data format of choice (here’s an intro for non-programmers by Scott Lowe) because it’s a fairly compact text format, easy for humans to read and edit, and has good support in terms of coding tools and libraries. Next I’ll show you some examples of how this is being used under the hood.