Modding in King under the Mountain

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!

modding example

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.

Read more

July Update – Raising Mountains

After working on getting characters moving around the area map, where the map consisted of a literally random scattering of walls, I thought it was time to make a start on actual maps for use as game areas, and so this has been the focus of July’s development effort.

Following on from some work I’ve done previously with procedural generation, I decided I wanted to use midpoint displacement, aka the diamond square algorithm, to generate some random heightmaps to use as the basis for a 2d representation of the playable area in and around a mountain.

Midpoint displacement of a line
Midpoint displacement of a line

Read more

June Update – Life!

This month I’ve moved on from the lighting system that’s been the focus of development in previous months, onto getting characters into the game and moving around. The goal of the first playable prototype is to have dwarves in the game as a playable race, before working on bringing other races in.

First of all, it’s with great pleasure that I can unveil the first piece of concept art for King under the Mountain, produced by Anthony Avon. As something of a specialist in landscape concept art, I contacted Anthony with a description of the game, the setting, and a brief of producing a landscape depicting a dwarven settlement in the game world.

Concept art of a dwarven settlement

Read more

Musical Interlude

While working on the technical side of King under the Mountain I’ve been in touch with several creative types to help out with the more artistic side of the game. I’m pleased to announce the first set of music tracks have been produced and they’re ready to be unveiled to the world!

Each of these tracks is to be used as peaceful background music while the player is building up and managing their settlement, so they share the same theme and goal, but differ in approach from each individual composer.

Designing the Mountains is by Juan I. Goncebat (Wind Wolf), you can view his website at and listen to more of his work at his BandCamp site

A Call to Create is by Frankie Rivera. His main website is his soundcloud site where you can listen to the rest of his work –

An Industrious Beginning is by Hannah (Safi Composer), who has a portfolio at

Peaceful Thoughts is by Bettina Calmon and she was kind enough to extend and update the track after initially finishing work on it. Bettina’s professional website is

All of the above artists are freelance composers with experience in creating a range of different music for games. If you’re a fellow indie game developer and need something composed, be sure to check them out!

May Update – Underground, Overground

I’m back from (a fantastic) honeymoon and working on King under the Mountain once again. Apologies that there were no real updates – I was on the other side of the world for a month!

In development news, in addition to the point light system detailed earlier, I’ve been working on “outdoor” lighting, to illuminate the outdoor areas of the game compared to indoors and underground. Even more excitingly, I’ve also added the basics of a day/night cycle, where this lighting changes colour throughout the game day. As with nearly everything in the engine, the values used are open to modding by being stored in a simple JSON file, which will allow people to change the brightness, colours and times of the phases of the sunlight shown.

Light from outside bleeds inwards over a distance (as shown with the area on the right in the video). The goal is to tie this into game mechanics with how well lit areas are for the characters in the game to be able to “see” to perform actions.

I’d like to add a direction to the sunlight that changes throughout the day (simulating the sun rising, moving and setting) and shadows, but I think this will do for now while I concentrate on getting other basic systems in place to have something playable.

In other news, I’ve started outsourcing some creative work to some very skilled artists and composers and I can’t wait to share more details with you very soon!

April Update – Let there be light!

I’m happy to say I’ve got the first major building block of lighting and shadows into the game. Here’s an example of the final result:

Coloured point lights with shadows!
Coloured point lights with shadows!

There were quite a few stages involved in getting these lights working, with a lot of thanks to Amit Patel’s excellent article on 2D visibility. Amit’s brilliant interactive tutorials helped me a great deal and I’m not sure I would have achieved these results without them. I also need to thank Wholehog Game’s article on lighting a 2D game for the clear explanation of using normal maps in 2D and lights as geometry.

Read more

March Update – State of play

This blog has started a short way into development of King under the Mountain so I’ll use this post to bring you up to speed on where we’re at.

For those interested in the technologies being used, King under the Mountain is written in Java using the LibGDX framework. LibGDX allows you to cross-compile your game for deployment on many different target platforms, so a port to mobile/tablet is a possibility in the future but for now the project is aiming at PC only.  LibGDX is also a wrapper aroung LWJGL, which is a lower-level library and the one used to most notably create Minecraft.

The very first “working” version of the game was to get the concepts of the 2D world and “walls” working correctly. As I’m drawing inspiration from Prison Architect and a lot of older tile-based games, of course the game world in King under the Mountain is tile-based. The very first problem to tackle was the fact that as the game involves digging into the side of a mountain, I do not want walls next to each other to look like this:

Adjacent walls in Prison Architect
Adjacent walls in Prison Architect

Read more

Begin at the beginning

So I thought it was about time I started to build up a web presence for King under the Mountain, and to start a dev blog to keep myself organised and motivated. Although I’m writing this in March 2016, the source code repository was started almost exactly a year ago and early designs for the game came much before that.

I’ve created a page to explain what the game is and how it’s intended to play, so I thought I’d share my inspiration and goals here. Too many years ago (nearly 20!), one of my favourite games of all time was Dungeon Keeper (and later it’s sequel). Not only was it a lot of fun playing “the bad guy” (albeit a slightly cartoonish one), I loved the mechanics of tunnelling your own dungeon out of the rock – creating a dungeon and infesting it with monsters, rather than playing as the goody-goody heroes exploring a dungeon someone else had created. Planning what to build and where in addition to caring for and training minions. I loved the whole thing.

Dungeon Keeper 2, a worthy sequel in my opinion

Read more