March 2019 Update – (Not) Reading from a script


It’s not released quite yet, but here’s a sneak peek at the much-requested Settler Management screen/feature coming in Alpha 2 of King under the Mountain:

Alpha 2 is on the horizon now, potentially including a resource management screen as well as this settler management one. It’s taken a lot longer than I’d have liked to be able to go from Alpha 1 to 2 but there’s some good news there – I’ve secured several days in April for development of King under the Mountain and I’m sure we’ll see a big jump in progress, and with a pinch of luck, some form of Alpha 2 being released in April.

I forgot to mention that last month saw the start of gathering information for Kickstarter rewards (other than copies of the game), specifically emailing those backers who had one or more natural resources to add to the game. If you think you should have a “pick a natural resource” Kickstarter (or BackerKit pre-order) reward, you should have received an email asking you for the details of this. Try searching for the subject “Claim your pick a resource reward for King under the Mountain” in your inbox or spam folder. It’s now over a month since these were sent out but only 47 resources out of a total 169 have been received so far, so please get in touch with me at ross@kingunderthemounta.in if you think you should have this and can’t find it.

After Alpha 2 is released, the big focus for Alpha 3 will be to enable modding in King under the Mountain. Since the early days of the project, making as much of the game data-driven has been a key goal. This means that things like items, plants, resources and so on are all defined in (JSON format) data files that are loaded and used by the game. The majority of these reference .PNG image files which are also loaded and used to make up what you see when you play the game, or .wav or .ogg audio files for sound effects. Most games combine these “assets” into compressed or obfuscated packages to make the download size of the game smaller but also so they can’t be easily modified by users. Instead, King under the Mountain plainly exposes its assets (take a look in /mods/base in the game directory if you’re curious) so modders can see how things work to add their own.

This works for adding new things to the game with different values and assets, but doesn’t cover adding new functionality to the game, which require the game code to be modified in some way. This month I spent some time investigating this. Initially I was planning to add some kind of scripting engine using a language like Python or Javascript, which would open up the game to small scripts of code to be run. I was worried about the performance of this (although there’s quite good options for running snippets of these languages in Java) but also how it would expose the classes and functions used in the core engine for these scripts to make use of. In the end I settled on a different approach, very similar to the one used by Rimworld, where small libraries of additional Java code (the language the game is written in) can be loaded and used by the main game. The main benefit of this is that modders will be able to write code mods that make use of the entire codebase of King under the Mountain, albeit in a controlled manner where certain new classes can be added, rather than just letting a mod change any code within the game.

The way the AI works is heavily inspired by this post by the Starmancer devs, where I have a system of Goals made up of Actions. The Goals are JSON files (look in /mods/base/ai/goals) which are made up of a set of selectors to determine when a settler chooses to select the goal to complete, and a set of Actions which are Java classes used to fulfil a certain, well, action, with a success or failure state. Until now it would only have been possible to add mods implementing new Goals using only the existing Actions. As a test case I had the game load in a new Action from a mod and use this instead, which proved modders will be able to add their own AI steps to the game as well as overall goals. The same can be implemented for basically anything that has a range of different implementations rather than just data values, such as different job types and their effect on the world, and hopefully going as far as new UI screens and views possible in mods. I’m really excited to see what people will be able to come up with in mods and I’ll have a lot more to say on this (and guides!) in the near future. I’m sure it’ll be an evolving process as some things that I’ve not really considered might not be possible to mod yet, but I’d be able to open it up as the modding community makes requests.

So it’s another relatively short update for the month. Again, I’m very sorry at the lack of tangible progress since Alpha 1 was released but I’m fully committed to breaking through that wall and getting the next major build to you guys soon. If you’re already playing the game and haven’t joined already, we have a friendly discord server at discord.gg/M57GrFp and if you’re just discovering this game for the first time now, you should head on over to rocketjumptechnology.itch.io/king-under-the-mountain and grab a copy of the game while its still in earliest access! Itch purchases will include a Steam key when the game is ready to move on to Steam.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.