September 2021 Update – Alpha 7 release


Welcome to the monthly King under the Mountain dev update! This month sees Alpha 7 released (as of yesterday) which is the single largest update of the game so far!

The main part of development for this alpha was extending the calculation and rendering of water flow into channels and pipes that can be dug by the player. You may have noticed that the river flows in a realistic direction in each tile. During map generation, this is calculated by flowing water from one end of the river to the other – really a rough approximation using a similar method to Dwarf Fortress – and keeping track of which direction water flows in an out of. Here’s a very early video showing that in action:

The red lines are a vector used as the direction of flow in each tile, which is then averaged out to the vertices (corners of the tiles), and this is what’s used in the water flow shader.

The main problem in extending this to channels dug by the player is I needed to combine all the rendering techniques the game currently uses – not just the flowing water shader, but also only showing this in part of the tile (the irrigation channel) and also the way that flooring overlaps with each other – i.e. rather than having straight edges between every tile, different floor types overlap onto their neighbours. Here’s another extremely early video of that:

Also the irrigation channels make use of the way walls are rendered out of separate quadrants. So in the end I had to combine all the rendering techniques I’d come up with so far – the flowing water shader, the splitting of a tile into quadrants to make use of many different layouts from just 5 sprites, and the overlaps between floors also making use of these quadrants. It was messy and difficult, but we got there in the end! Here’s a look at water flowing between irrigation channels in the game – this is slowed down a bit from what’s ended up in the released version, and you should be able to spot the same method used as the original flowing water video:

So why would you want to dig all these channels for water to flow into? Well, they’re certainly cheaper than laying pipes underground (which is a related new feature), but your settlers can’t walk across the channels (though you can build a bridge over them) so for the most part, pipes would be much more effective. What they do provide is constant access to water for nearby plants, particularly your crops which is why you’ll want to dig these channels and set up irrigation. Plants now require access to water to grow quickly, otherwise their growth is stunted if they don’t have access to water for a while, and stopped completely if they can’t receive any water for many days! “Access to water” for the most part will be covered by the fairly common rain in the game, though now the summer season is a bit drier overall. The goal is that players will be able to get by relying on the weather for watering crops (there’s no watering cans or jobs here!) but they will want to turn to irrigation to optimise things (or at least avoid the chance of having a summer drought).

But how do you get water into these channels and pipes? This release sees the first animated furniture in King under the Mountain (courtesy of artist Rizal Zulkifli who produced most of the art assets in this release, and a lot before that too, all the way back to the original pre-alpha releases). You’ll need to build a water pump connecting the river to a pipe system:

The water pump

But to actually make use of the water pump, this release also introduces the concept of powered furniture. Not electricity, but good old mechanical power provided by a waterwheel or windmill.

There’s a lot of small touches that get put into the game which I don’t know if anyone will notice. One is that the waterwheel actually rotates in the correct direction, thanks to having the water flow information described at the start of this post! While the waterwheel has to be placed adjacent to the river, the windmill will work anywhere outside, however the windmill requires linen sails which I’ll get to later.

Now there are power-producing and power-consuming pieces of furniture (the ore crusher now requires power or else it takes a very long time to use), they need joining together in some way. As this is mechanical power, this is performed through a series of gears and wooden shafts which are placed below the ground level:

Gears and wooden shafts

Now that your dwarves are able to move water from the river through pipes and channels, that creates an option of no longer having to trek all the way to the river for the many times a settler needs some water for a job or just to drink. You can now build wells which are automatically filled by your pipe system, so you can build these deep into your settlement, connected to working pipes, and greatly reduce the amount of travelling for water needed!

This release sees the first Kickstarter-backer-nominated crop added to the game – Hemp! While we’re not adding any Tolkein-esque “pipe-weed” just yet, it’s a possibility for the future. What hemp does do for you now – is introduce a new weaving crafting type where hemp is processed to hemp fibre through a process called retting (in King under the Mountain, this is mechanically the same as the mushroom log shock tank where the hemp bundles are submerged in water for about a day), and the hemp fibre can be woven into rope or linen. The well above clearly needs a rope to function, and as mentioned earlier, the windmill requires linen for its sails to function. Most importantly though, beds now need linen to be constructed as well as wood for the frame, making comfortable beds that little bit more expensive to craft. To balance this, there’s now a “sleeping spot” which can be placed in bedrooms as a location for your settlers to sleep on the floor, so at least you can control where they sleep before you can furnish your settlement with a full complement of beds. Look out for other backer-nominated crops still to be added in the future!

Long-time players may remember the fishing profession that was in early versions of the game (which didn’t do anything), or more recently you may have noticed that your dwarves produce fishing poles without making any use of them. Well that is no longer the case! The fishing profession is now fully implemented, so particularly unusual dwarves may be happy to go and stand next to the river, fishing pole in hand, to bring back fish for your settlement to eat. Mechanically this is an alternative to growing crops for food, without the setup of tilled earth or the requirement of seeds, but it is more labour intensive as the settler has to actually fish for a long period rather than leaving crops to grow. That said, fishing is probably an easier way of acquiring food, so there’s also a limit on how many fish can be caught each year – which should be enough to support a population of up to 20 settlers from fishing alone. Currently the game includes Pike, Perch and (of course) Carp, with the artwork produced by Kaitlynn Peavler.

Right now the fish you catch only produce meat to be added to your food supplies, but it won’t be long before bone is added as an important crafting resource too, with small bones from fish making up a large part of this.

The door assets saw a visual update this release (again thanks to Rizal Zulkifli) which was necessitated by the fact that the old door sprites only had “connecting” caps on walls for the rough stone wall type. The doors now align and blend in properly to any of the types of walls found in the game, as you can see by this before and after screenshot:

As usual, this major release came with a bunch of bugfixes and quality of life improvements – one of the standout QoL improvements being that when a stockpile’s settings are altered, it now cancels any outstanding jobs to haul items to that stockpile which would not be valid with the updated settings. There’s also a big startup-time performance improvement as I noticed all the sprites for the game were being loaded many times over on launch due, which has now been fixed, so I’m hoping players see a noticable improvement in the time the game to takes to initially load up (show the main menu) compared to before.

And that just about covers this month and Alpha 7! If you’re reading this and you have yet to actually play King under the Mountain, good news – There’s now a playable demo available (accessed via the Steam store page) as part of the upcoming Steam Next Fest!

This is a time-limited demo (you can play the first year of the game without restriction) based on the Alpha 6 version (so it won’t include any of the content mentioned in this post). The demo will only be available while the Next Fest is ongoing, so make use of it while you can!

That’s it for this month, now we’re going on to adding all kinds of animals to the game which I can’t wait to share with you, as well as detailed injuries and health as a key component before combat is added shortly. As always, drop by the King under the Mountain discord server as the best way to get involved with the community and help improve development through player feedback (or just to ask for help).

Finally I want to pay it forward a little and throw a spotlight on another upcoming game featuring dwarves digging their way into the depths – Below the Stone currently on Kickstarter!

I’ve been following Below the Stone for a while and they’ve gone through exactly what I did with King under the Mountain – an initial Kickstarter that didn’t meet its goal (it is ridiculously hard to do well on Kickstarter as an unknown indie compared to the golden age of around 2013 to 2015), so they kept working hard, improved things, learned lessons from the KS campaign and came back and they’ve nailed it. I’ll leave the description to them:

Below The Stone is a procedurally generated spelunking roguelite with completely destructible grid-based levels resembling that of many loved titles such as Terraria, Enter The Gungeon, Nuclear Throne, and Dwarf Fortress. You play as an apprentice dwarf yearning to make your mark in the dwarven empire through the time honored labor of mining and exploration. On your adventure, you can complete jobs for your guild masters for a choice of rewards, and have the opportunity to collect precious metals for yourself to upgrade your armor, tools, and weapons. As you dig deeper, you encounter motherloads of riches and surpass all of your peers expectations. But be careful, there are many monsters and hazards that await around every corner, looking to monch your beard off. And if you die, there is no running back for your items.

If that sounds like your kind of thing (and I’m assuming there’s at least some amount of Dwarf-appreciation from people reading this) then there’s just a few days left on the Kickstarter campaign and they’ve already blown past the funding target in the first few days, so please help them reach those exciting stretch goals!

August 2021 Update


Lots to get through this month thanks to developing King under the Mountain full time now!

In the last dev update I had just started on Alpha 6 and the first feature added for this was fire(!), as a reminder, here’s a look at it:

There was one very large reason fire was only added as part of this Alpha, and the reason is that it also brought with it weather into the game – perhaps most importantly rain to extinguish those pesky fires outside. Dwarves, quite understandably, get a little upset at walking or working in the rain, but they’re particularly upset about being forced to sleep in the rain (wouldn’t you be?). Here’s a look at the visuals of rain in the game:

The rain effect is done entirely using the particle effect system added in the more recent dev updates. I was worried that this many particles in use at once may have some performance impacts but it would seem that the similarity of the particles allows the graphics pipeline to render a large number of them at little cost.

Rain also pushes the player to finally have a reason to build their settlement either underground/within the mountain, or at the very least in rooms with a roof constructed overhead. There is the happiness malus mentioned above, but more importantly than this it introduces a new system called oxidisation, which is perhaps most important for things made of iron – rusting. Prolonged exposure to rain for an item made of iron or steel will now eventually turn into rusted iron, turning a reddish-brown colour, and eventually this too will degrade further and completely destroy the item or furniture! Fortunately this only applies to items or furniture where iron is the primary material – a wooden barrel with iron hoops will not be destroyed, though the hoops themselves will eventually turn to the rusted iron colour. Much more so than the unhappiness at being outside, I’m pleased to introduce a realistic mechanic which forces the player to seek shelter in the long term.

In addition to iron turning to rust, copper also oxidises, but not in the destructive way that iron does. Instead, copper forms a turquoise/green patina on its surface which also acts as a barrier to further oxidisation (unlike rust which permeates through the metal). Here’s an example of the different colours of these in the game:

Iron and copper axes on the left, rusted iron and copper patina on the right

There’s a more extreme version of rain in the form of thunderstorms, which in addition to rain also have a chance for lightning to strike somewhat regularly. A lightning strike will be attracted to trees, or failing that other entities in the game world rather than open spaces. A lightning strike has a high chance to start a fire! For the most part these fires will immediately be extinguished by the falling rain, though in some rare situations the rain may stop before the fire is extinguished, or even rarer in summer you may come across a “dry thunderstorm” which has no rain but also rarely still causes lightning strikes – one to be on guard for!

The other major weather system is snow, which works for the most part similar to rain, though I wanted a more striking visual effect in the game. In addition to the falling snow using a similar particle effect to the rain, there’s two other additions: a replacement for the ground texture where the ground gets covered in snow rather than showing grass or dirt or similar, and a shader effect to give an impression of snow that has fallen onto entities. As every entity in the game also has a matching set of normal map sprites, defining the direction each part of the surface is pointing (mostly for lighting information), I made use of this to write another shader which considers a global amount of snowfall, and uses this to render a white snow effect on the “upper” parts of the sprites, increasing in amount as the snowfall increases. Look out for that in this demonstration of the overall snow effect:

Along with less visually striking weather effects (cloudy weather and winds mostly), the different weather types are now defined (and moddable like everything else), where in addition to being able to define the actual weather types, there’s an extra level of configuration where there’s a concept of “daily weather” defining which weather types you may encounter on any given day (think of it like the forecast for that day – mostly sun, mostly cloudy, some rain etc.) and these daily weather forecasts are defined by season. To those of you not aware, I’m from northern England, somewhat infamous for always being wet and grey, so unfortunately for everyone else that’s the kind of weather that’s reflected in the game! Put another way, the current and only biome in the game is supposed to reflect a kind of northern European climate, leaning in to Norse culture for the history of dwarves in fantasy literature. When the game introduces other biomes, no doubt they will have their own climate with different weather, but for now you’ll have to put up with the kind of weather I’m used to seeing!

For the longest time, I’ve wanted winter to be much more of a challenge in the game than it currently is. For now the snow is still mostly visual rather than being particularly punishing (though there is one big thing to look out for – if you’ve not built beds indoors by the time winter comes around, your dwarves might freeze to death from sleeping outside!). The next step would be to have the river freeze over in winter, but right now that would be far too punishing as the player isn’t able to secure a sizable water supply that would not freeze very easily. That’s changing soon though, as a big part of alpha 7 is bringing the ability to move water around through pipes and irrigation channels, pumped in by a water pump, which should give the player the tools needed to be able to survive the river freezing over in particularly cold days during winter.

Fire and weather effects were the main part of alpha 6, so it was released this month and a few bugfixes for it have gone out too. That’s not all that was added though – one of the best features is that upon starting a game, the player is now able to select exactly where on the map they would like their settlement to begin – no more rerolling the map for that ideal start location! Beyond this were some smaller bug fixes, a tidyup of the sprites for male dwarves eyebrows (they were a slightly different colour to their hair previously) and also the addition of new hair and beard styles for the dwarves (slowly building towards the long-awaited design a settler backer reward) so look out for those too.

And with that, alpha 6 was completed, so it’s on to alpha 7! The initial major part of alpha 7 brings together mechanisms, pipes, channels and a rework to allow liquids to flow dynamically in the game world so I’ll surely be bringing full details of that in next month’s update. That’s not all though, I’m hoping I’ll finally be able to share some of the “Add a farmable crop” kickstarter rewards which will be part of the next release, and especially the wide range of natural wildlife which are due to be added to the game (themselves containing a number of addition thanks to kickstarter backer rewards). So I’ll see you then, and in the meantime the best place to get involved with game’s community is the King under the Mountain discord server!

 

 

Huge news for King under the Mountain (July 2021 Update)


Hi everyone, it’s been far too long since the last dev update for King under the Mountain. Well, there were a lot of factors that fed into that, but rather than go through them, I just want to share the big news with you all – King under the Mountain has a publishing deal! There’s many great parts to this announcement, but perhaps most important is that as of 3 weeks ago, I’m no longer trying  (and failing) to fit gamedev around a full time day job and family life, instead thanks to publisher funding I’m now working full time on developing the game! The roadmap is in place, most of the artwork required for it has been created, so now I’m just powering forward to bring the game to Steam Early Access as soon as possible. We’re aiming at a January 2022 early access launch which is just 6 months away – almost no time at all compared to the time the game has been in development so far!

You might even be wondering why it’s taken this long for me to sign up with a publisher – or why I have at all with how relatively close the early access launch is. Well on the first point, this is the first time I’ve spoken to a publisher who really understands the vision for the game. I’ve spoken to others who wanted the game completely done and dusted in 18 months time, but I see games in this genre as really benefitting from a long early access period – just look at the growth in gameplay and success of games like Prison Architect and Rimworld. Some publishers weren’t willing or able to invest the amount required to allow me to quit my day job, so that was a non-starter.  As to why would I sign up with a publisher when I’ve already got the game so far along the road to the early access launch? Well, as you can see from the increasingly sporadic dev updates, I just haven’t been able to find the time needed around everything else to progress the game – it would have still taken a crazy long time to get the game to Steam from where it was. In addition, any publisher worth their salt brings with them some great marketing clout – instead of this now being a hobby project with one guy working on it, there’s a whole team pushing the game forward, with multiple people dedicated to marketing so many more people should hear about the game, rather than the small niche it’s in currently.

So who is this mysterious benefactor? A fairly new publisher called Boombox, which is a partnership between Philippe Erwin who brings many, many years of experience in production and business development in games from senior positions at big names like Activision and Warner Bros, and Alexander Poysky of Poysky Productions, who produced Regions of RuinBetween the Stars and Travellers Rest (among others). I’ve actually been in touch with Alexander for over 2 years already, specifically around publishing King under the Mountain, and everything just lined up on both sides recently that we were able to come up with an arrangement that works for both of us. I’m very excited to be working with them and their wider team!

So now that I’m working full time on the game, I was able to wrap up development on Alpha 5 in just a few days. You might remember from the previous update that I was due to go onto constructing roofing and flooring. Well I’m pleased to say that’s done now! Here’s a little look at constructing roofing in the game (with a bit of a preview of rain as well):

Roofing isn’t super important yet but it will be once weather effects are added (which is the current development goal!). It does change up the happiness bonuses a little though – dwarves now get a happiness bonus from working in a zone completely enclosed with walls or doors and a roof. Of course, any mined out areas come with a roof already so perhaps this will encourage players to dig into the mountainside? You may have noticed in the video that the “Quad” option for building walls has been replace by “Room” which also fills in roofing in-between the walls.

Finally you can also put your own constructed flooring down. Along with this, flooring now provides different movement speeds  depending on the type of flooring. You will find that gravel is quite slow to walk on, but any flooring constructed by dwarves speeds up movement considerably, so it can be worth laying down paths between high traffic areas. Of course, the AI pathfinding now takes the floor speed into account, so it will plan out paths based on the flooring available. This might mean if you do build quicker paths between areas, you might need to widen them to account for the higher traffic passing by!

Having wrapped up Alpha 5, it was released as Alpha 5.3 to the Itch page. Now that we’re fully focusing on the Steam Early Access release, the game is not currently available for new purchases on Itch.io. Current owners will still be able to download any and all future updates, and it also shouldn’t be too long before we start pushing updates to Steam as well. At that point, we’ll make Steam keys available to anyone who currently has a copy on Itch (i.e. anyone who backed the Kickstarter or has purchased the game since) so look out for that news in the near future.

Next it came time to make a start on Alpha 6. Looking into it, I was still waiting on a few of the art assets which were being produced which made Alpha 6 all work together. To avoid any waiting around (though those assets have since been completed), I ended up swapping the contents of Alphas 6 and 7 with each other, so now Alpha 6 covers fire and weather effects. On that note then, I started with fire, and as a good indication of how much more progress is being made with me focusing fulltime on gamedev, the entire fire feature has been completed as well! Here’s a look at it:

The game’s now getting to a point where the different systems really start to get to interact with each other. Fire spreads to nearby things depending on if they’re flammable, which itself is determined by the materials that form each item/entity in the game. Unfortunately for your dwarves, they count as flammable too, but at least a dwarf will roll around or seek out water (when not running around in a panic) in an attempt to put themselves out. Everything else will require the use of a new order to extinguish flames, which involves filling a container with water and dumping it over the fire to put it out. Failing that, fires will either spread to nearby entities or else eventually consume and destroy the thing on fire. Here’s a tip – don’t build things around the blacksmith’s forge out of wood!

There’s good news for your flaming dwarves though, with fire done I’m now working on adding all kinds of weather to the game, first of all rain which you can see a little of in the roofing video above. Rain has a good chance of extinguishing fires, but only if they are outdoors! Rain will make your dwarves a bit upset at walking or working in it, but especially upset at having to sleep in the rain (wouldn’t you be?) so you’ll want to dig those bedrooms out fairly quickly. Rain will tie into the more advanced modelling of farming crops which is now part of alpha 7, and perhaps most awkwardly of all, introduce the system of oxidisation to certain metals (i.e. iron and steel items will eventually rust and become useless if left outside). And that is just the first type of weather! Look forward to snow and cold in winter which will be harder to survive, thunderstorms with fire-causing lightning strikes, and more, all to be released as Alpha 6 in the next couple of weeks.

And that’s where we’re up to! I am very sorry this update is such a long time since the last, but now with the publishing deal in place, I can’t imagine missing another one until the not-too-long-in-the-future Steam release and beyond! See you next month, or if you want to keep more up to date, join the King under the Mountain Discord server.

 

April 2021 Update


It’s the April 2021 dev update for King under the Mountain! I am truly sorry to have missed a couple of monthly updates. Until the Steam Early Access launch, the game is basically a hobby project and real life has endless ways of getting in the way of that. I’m happy to say it’s fully back on track though and we’ve had some great progress this month!

The major milestone achieved was the addition of the initial list of particle effects that have been added to the game thanks to the particle effect system. In fact this month I had enough time that I was able to stream some real time game development on Twitch, and below you can watch me go through the steps needed to create and add a new particle effect to the game (from 12:24):

So there’s been a whole bunch of new visual effects added to the game using particles. One I’m particularly happy to get added is leaves falling from trees in autumn, which was promised all the way back in 2016 with one of the very first looks at the game!

While it’s not exactly a particle effect, setting up that system also allowed me to add a much needed quality of life feature – progress bars when working on jobs! No longer do dwarves just stare at a blank wall or piece of furniture until it happens, now particle effects and a progress bar all appear to really tie everything together. Here you can see mining incorporating chips flying off the rock wall being mined, a cloud of dust as the wall is removed, and the progress bar that’s displayed.

Rather than list them all here, you can try them out for yourself with the latest version (Alpha 5.2) from the usual Itch.io page.

And that’s not all either – perhaps the single most requested display feature has finally been implemented – you can now run the game in borderless fullscreen mode! The new setting should be set by default if you were using the old exclusive fullscreen display mode, and the exclusive fullscreen option is still included for those that prefer it (mostly for older hardware that might struggle with games not running exclusively).

As ever, there’s some bugfixes included, mostly thanks to the help of the community and member SirRockstar in particular who’s been invaluable in providing reproducible problems with larger settlements. There was an issue with soup getting mixed up with water in a kitchen and buckets ended up full of soup and stuck! In fact there’s now an in-game option to get  a dwarf to empty the contents of an unused container as a workaround for similar problems in the future, though primarily I want to stop them from happening in the first place.

Also a big thank you to community member Lyserg who has translated the game into Turkish. The latest update includes his translation as part of the community translations mod, and perhaps just as importantly also includes the Turkish flag to display alongside it.

Looking ahead, the roadmap has been updated and the only part remaining for Alpha 5 is constructing roofing and flooring to have proper rooms and buildings in the game. I’ve been toying with the idea of roofing not needing any input from the dwarves, just being a kind of UI setting which has an effect in-game, but that doesn’t really go with the simulated world I’m aiming for in King under the Mountain so I suppose that means placing roofing will need a dwarf to get the right resources and do the work after all! Following that, I’m very excited to get stuck into Alpha 6 as it’ll be the first time in a long time we’ve had new art assets added to the game, things that have been ready and waiting to go on the artwork side but waiting for the implementation to catch up!

That’s all for this month. Again, sorry for the lack of communication for a while but we’re back on top of things now. Please drop by the game’s Discord server if you haven’t already, it’s the only true community hangout at the moment, and see you next month!

January 2021 Update – Particle Effects


Welcome to the first King under the Mountain dev update for 2021! This month has been entirely focused on implementing a particle effect system into the game. But that might lead you to ask…

What are particle effects?

Particle effects are a graphics technique where lots of small and usually simple images or models are rendered and often animated to produce a single complex effect. Here’s an example from the official Unity tutorial (the particle effect is the pink glow and sparks):

In the above example,  a simple coloured sprite is being used lots of times for each of the particles flying off the main large effect on the kart’s wheel.  If you look closely you’ll notice they’re also decreasing in size as well as moving in an arc until they disappear entirely.  Simply put, a particle effect is created by applying several effects on lots of instances of small “particles” like this. Particle effects are used extensively in games, for explosions, spell casting visuals, impact effects, almost any visual effect you can think of is often done using particles, though in other cases techniques such as using shaders give a better result. As an aside, a shader is a program that runs on the graphics card to adjust the geometry of models/shapes, or the colour of individual pixels – sort of – which can have some incredibly powerful effects, see shadertoy.com for some good examples to play around with. The dynamic lighting and flowing water in King under the Mountain are both achieved using a shader.

Particle Effects in LibGDX

King under the Mountain is written using LibGDX, which is a game development framework, which is a bit different to a game engine – an engine is a bit more prescriptive about asset formats you have to use, how levels/maps are handled and that kind of thing, whereas LibGDX is at a lower level than an engine, giving you access to underlying graphics and audio programming interfaces (OpenGL and OpenAL) with a good amount of “helper” code on top for common game development tasks. That said there’s much, much less that you get “out of the box” for using LibGDX compared to a standard engine, for example I had to implement something as seemingly basic as multi-line text in LibGDX!

One of the utilities that LibGDX does provide is a good particle effect implementation and GUI editor for defining your own effects:

You can see some of the many parameters that can be applied to a set of particles in an effect (you can have different sets of particles each with their own “emitter”), such as the angle of emission from the starting point and the range of velocity they have. The blue-line-graphs are used to adjust these values over the life of the particle. There are more parameters which have not been used in this example such as rotation, gravity and “wind” that can be applied (all with the ability to have a different amount over different times).

When you load up the particle effect editor, it starts with an example particle effect of lots of semi-transparent red circles (up to 200) used to create a flame effect:

The first particle I decided to implement myself was a simple but important one for a game about dwarves digging into a mountainside – chipping away bits of rock while mining!

Unlike the example flame effect, this uses far less particles at once, but also makes use of rotation and gravity to give the effect of a chip flying away from a point.

But what about lighting?

In most games the above would be great and all you’d probably need to look at with particle effects in a game built using LibGDX. In the case of King under the Mountain however, things are made a bit more difficult by the dynamic lighting system. If you’ve ever looked in the data files, you’ll likely have seen that almost every sprite in the game has a matching “NORMALS” version, like with the following:

The _NORMALS file is a visual normal map (or bump map) that uses the red, green and blue colour channels to describe which direction each part of the “surface” is pointing in 3 dimensions. This information is combined with light sources – each light source is casting light from a certain point, and this is combined with the normal map to figure out how much light will be hitting any given point. At least, that’s my attempt at explaining normal mapping without getting too technical into vector maths! It’s much more commonly used in 3D games rather than 2D ones, but one of the very first things I wanted to implement in King under the Mountain was a truly dynamic lighting system so that a dwarf carrying a lantern around tunnels and halls would be suitably evocative, and help distinguish the game from its peers.

It helps to see everything combined in-game:

In the above screenshot, the top left is the game world rendered without lighting, using the sprites as they exist in the data files, also known as the diffuse sprites/layer. Top-right is the same scene but using all the _NORMALS versions of the same sprites to build a normal map of the entire scene. Note that the sack in the lower-right does not have a normals-sprite for the label on the sack, so this is not rendered in the normal map scene, meaning it will be lit the same as the layer below (the sack itself in this case). Bottom-left is the lighting information, which is made by using a shader to add an amount of light based on the normal-map version and data from point lights in the scene (a white light from the cursor in the upper left, a yellow light from the miner’s helmet in the lower right, and a small amount of global lighting so unlit areas are not pitch black). The lower-right is the combined final result that you see in-game, which is made by simply combining the two images on the left hand side.

That’s a very quick run-through of the lighting system, but I bring it up because it occurred to me that I wanted the lighting system to work with the particle effect system, at least for some particle effects that want to be “in the game world” compared to ones which should not be affected by the lighting and would be more like UI information (for example, thought bubbles above settler’s heads).

The naïve approach would be to have two sets of my rock chipping particle effect running at the same time in the same place, one with the diffuse (standard colour) rocks and one with the normal maps (even though normal maps don’t really work when rotated – this is an issue I’m going to live with for now). Unfortunately, there’s a lot of randomness in a particle effect but there’s no way to set a “seed” (an initial value used to make a random number generator give the same sequence of results multiple times – like the map seed when starting a new game) in the LibGDX particle effect library, and in fact the randomness is buried quite deep within the workings of the library so there wasn’t a simple option of just replacing all the random number generation with random number generation using a supplied seed.

Instead I had no option but to take a copy of the main part of the LibGDX particle effect codebase and modify a lot of it, I ended up making it be aware of an optional extra set of sprites for the normal maps, and any randomness would apply to both sets of particles that were created at the same time. It doesn’t seem like much but it took a lot of effort to have a particle effect which could spit out diffuse and normal-map versions of the particle in the same way at the same time!

 

And a little extra on top

There was just one main hurdle remaining – the particle effect shows chips or rock flying away to the right, but what if the miner is facing a wall from the left, or above, or below? But also where should the particle be positioned relative to the entity in game that is creating it (if it’s even attached to an entity at all)? The LibGDX particle editor saves and loads in its own file format, named by convention as a .p file. It would be a bad idea for me to add or make changes in this file as then I wouldn’t be able to load the .p files in the visual editor in the future, so each particle effect in King under the Mountain is defined with a type in JSON (like almost every “type” of thing in the game files) that looks like the following:

{
  "name": "Chipping rock",
  "particleFile": "rockparticle.p",
  "scale": 0.4,
  "usingParentOrientation": "LEFT",
  "isLooping": true,
  "isAffectedByLighting": true,
  "usesTargetMaterialAsTintColor": true,
  "distanceFromParentEntityOrientation": 0.8,
  "offsetFromParentEntity": {
    "x": 0,
    "y": 0.3
  },
  "attachedToParent": false
}

The key to the direction problem is the “usingParentOrientation” property with a value of LEFT – I then added some code which readjusts some parts of the particle effect, like the initial angle of emission based on this property for use with other orientations. “attachedToParent” with a value of false means the particles won’t move (once created) when the parent entity moves – this would be true for things like speech and thought bubbles which would also have “isAffectedByLighting” as false so they appear above everything else and are not affected by the lighting system.

Putting it all together, we can now have rocks chipping away with any mining direction!

 

What’s Next?

All the particle effects! Or at least, a good set of effects for where the game is now, focused around different job types and crafting types. It’s always been a long-held ambition to have leaves falling from trees in autumn according to the changing colour of deciduous trees during autumn, and this finally makes that possible (or rather, fairly easy instead of some long-winded and complex way of achieving it with a different approach).  However many particle effects I come up with at this point, I’m sure there’ll be lots more that could be added to the game as it is – just looking at the animation above, when a wall block is removed it could really do with a burst of clouds of dust type of effect, things like that. I’d absolutely love for the player community to suggest more that they’d like to see – now that the particle system is in place it should be fairly straightforward to add more effects – so get involved via the Discord server.

It’s a bit of a shame that after the initially swift progress of Alpha 5 that I’ve had to spend the entire month adding this single feature, though it is quite a big one which will add a lot in the future, and was a bit of hurdle to get over but we’re there now! The intention was always that this can also be used for the “Visible job progress” item on the roadmap but there’s also lots more that could be included now or later. Hopefully, particle effects are wrapped up soon, then constructing flooring, roofing and rooms is the next step to complete Alpha 5. See you next month!

December 2020 Update – Alpha 5 initial release


Another month, another year even, and so it’s another dev update for King under the Mountain! There was another fantastic burst of progress this month culminating in the first release of Alpha 5, covering half of the items from the Alpha 5 roadmap already – so I’ll jump straight in to the new developments!

First of all there is now a (very bare-bones) embark screen (i.e. “Start new game” screen). This allows you to set a name for your settlement (or let the game randomly generate one) as well as set the seed – the number used to initialise the random generation – before starting the game proper. You can enter text into the map seed field if you like, though the game will turn it into a long number as shown. This means if you discover a map you particularly like, you can use the same seed again in the future to recreate it, or better yet, share map seeds with other players. In the future this screen will contain a lot of options to customise your starting settlers, items, even the map itself before starting a new game, but it’s nice to have even this in the meantime.

Speaking of customising settlers, you can now rename them in-game. Perhaps not too exciting by itself but it leads on to…

Twitch integration! While playing the game on Twitch, you can now connect your account using the game’s options menu, and this will reveal the options shown above to have settlers in-game automatically have names based on current Twitch viewers, with an extra option to prioritise Twitch subscribers before other viewers. While this feature has been tested and works well as far as I can tell, I don’t believe anyone has tried this feature out properly on a Twitch stream yet, so please let me know if you’re going to give it a try!

Thanks to one of the several very talented artists I’m working with, there are now new visual assets for the way floors overlap onto each other. On the left in the picture above is my old programmer art wavy-edge type of flooring overlaps, and on the right something looking much much better for different types of floors (see if you can spot how the dirt onto stone looks different, it’s subtle!). Also the grass flooring itself has had an overhaul to look better too. There’s a lot of artwork in progress and also already completed for features to be added in the not too distant future, but I’d prefer to keep the reveal of those for when the features are actually implemented properly.

So you can name your settlement now, but why does that matter? To help you identify different saved games! Above is the load game screen that’s just been added to the main menu (though I’m sure most of the time players will just hit “Continue game” to continue their current save). This means you’re not limited to a single saved game at a time anymore! Long overdue like most of the features in the pre-Steam Alpha roadmap and I’m very happy to see it added. The save files themselves have been overhauled so that they use compression, so in previous versions a save file would be 30 to 50 megabytes, now one is generally around 2 and a half megabytes!

Speaking of long-overdue Alpha features, stockpiles have been reworked (they are not quite so fixed in what they can store anymore) and stockpile management/filtering has been added. Click on a stockpile and click on the Settings button to get the view above, this lets you customise which item groups a stockpile stores, down to the level of the items under those, and you can even select the materials for those items if you wish. Since the above screenshot was taken, a priority control has also been added to stockpile management, so you can set which stockpiles should be filled first or last, or somewhere in between.

Finally there’s a few small improvements to the settler management screen following player feedback. There’s a display of number of beds at the top of the screen, clicking on (i.e. filtering to) a profession keeps the other settlers in view but greyed out, and there’s some sort options at the top to view the settlers by name or decreasing unhappiness (which was the old default).

Currently I’m working on a particle effect system – the small, short-lived visual effects you see in most games. This will (hopefully) be things like sparks flying off a blacksmith’s forge, pieces of stone chipping away when mining or crafting, water droplets splashing when filling a barrel, little visual touches like that which really start to bring the game together. As always it’ll be fully extendable / easily moddable, but it is quite a chunky feature which will take some time, so I thought it best to release an initial version of Alpha 5 before getting stuck into it – which is all of the other new additions you see above! Once that is done (and it also includes showing the progress of a job being worked on) it’s on to constructing flooring and roofing – having an area be outside or “inside” will start to become important. Especially a little later when weather is introduced which will really shake up the current gameplay! The goal is for there to be a slight punishment to things being left outside which I think should change the dynamics of building a settlement quite a bit.

Until then though, as ever, the best way to get involved is joining the King under the Mountain Discord where I’m usually on hand and always very happy to hear any feedback or issues players are experiencing. See you in 2021!

November 2020 Update – Alpha 4 Complete!


Welcome to the amazingly-ahead-of-schedule November dev update for King under the Mountain! Very good news this month in that everything on the roadmap for Alpha 4 has now been delivered, and a little extra to boot! So without further ado, here’s a run-through of what’s been changed or added.

The biggest addition is that there is now a full job prioritisation system! A new top level menu, “Priority” has been added which gives you the following new options:

Job priority menu

As you can see in the screenshot, when this menu is open the priorities are shown in-game. Previously settlers would pick whichever the nearest job to them was, in order of the professions that they had activated. Now the same still happens, but respecting the priority assigned to a job first – so all the “Highest” priority jobs will be assigned first, then “Higher” and so on. Finally you’ll be able to instruct your dwarves what it is you want completing next! As well as being able to set the priority of jobs waiting to be assigned, such as orders like mining and logging, furniture which creates jobs, like a crafting station, can also have a priority assigned which gets passed on to the jobs it creates. This goes even further in that some rooms like the kitchen and farm plot generate jobs without being specific to any furniture, so those rooms can also have a priority assigned (when interacting with the room/zone) which gets passed on to any furniture that already exists or is set to be constructed. So there’s a lot more going on than you might think! I’d love to get some feedback on the way this has been represented in-game, both from the choice of colours which I’m not very sure about, and the use of arrows to represent the priorities too. Oxygen Not Included by Klei (a fantastic game) has a similar system, but uses numbers from 1 (lowest) to 9 (highest) to represent priority. Do you think that would be better here?

There’s another equally huge (at least in terms of quality of life for the player) addition in the form of an entirely new management screen to go alongside the existing “Resources” and “Settlers” screens – crafting management!

The crafting management screen

This screen first lists each type of crafting, along with any furniture that crafting can be performed at, and the rooms that furniture can be placed into. Right now, every type of crafting is only performed at a single crafting station which is found only in a single type of room, but the game allows for more complex setups and they could be modded in right now.

Clicking on a type of crafting shows the set of different items or liquids that are produced by that crafting type. These rows allow you to set a total number of items to “maintain” in the settlement, that is, have a total number of items which may or may not be in use. This can be set as a single figure for the whole settlement or scale based on the population as shown. Items are consumed or effectively removed when they are used in furniture construction (such as tools on a workbench) so once this has happened, more will be created. Barrels and cauldrons feel like a special case because once they are placed as furniture, they no longer count as an item, though they appear identical visually, so I’m interested to see if people find this confusing and end up with more barrels and cauldrons than they expect. This row also gives you a total count of how many are currently in your settlement – a more detailed breakdown can be found in the “Resources” screen.

Clicking on one of these item or liquid product rows shows the different crafting recipes that produce the desired output. A crafting recipe is a set of input items or liquids, which get converted into a set of output items or liquids, though currently every crafting recipe only produces a single type of output, but this doesn’t have to be the case. Most crafted outputs are produced only by a single recipe, a good example of an exception are wooden planks which can be crafted out of wooden logs or mushroom logs, which are counted and tracked separately, or metal blooms which have specific crafting recipes for specific materials. Any input items which don’t use a specific type of material, allow the player to now pick a material to always use in that crafting.

There’s also a mini set of priority options for the crafted items and liquids, setting this will set the priority of which crafting recipe is selected next – recipes of the same priority are chosen from randomly, at least for all of the recipes that have their input requirements available. Each crafting station also has a new “Crafting” button to launch this screen filtered to showing everything already expanded for the crafting type it uses.

The crafting types, furniture, crafting recipes and default amounts to produce are all easily moddable, and this screen is a good representation of the mapping from the data files to how they are represented in-game.

Between the addition of crafting management and the priority system, players should now have the tools they need to manage settlements that were getting a bit too complex without them. Being able to manage and prioritise the production of beer in particular should be of great use, as the previous release probably led to an over-abundance of barrels being crafted for most players!

While those two are the main additions (and what was listed on the roadmap), that’s not all for Alpha 4! There’s even more quality of life improvements in the form of new “Cancel” and “Demolish” options in the build menu.

Build menu with new Cancel and Demolish options

The cancel option works much like its counterpart in the Orders menu – it is used to mass-cancel any queued up constructions (furniture, bridges, doors and walls). Deconstruct is used to set constructed furniture, bridges, doors and walls to be removed. No longer do you have to click on each thing individually and set it to be torn down!

Along with this work on managing constructions, the game now keeps better track of which material was specified to be used by the player in the construction. An earlier update (one that automatically resets material selection when none of that material is available) had broken this functionality, so now that improvement still works alongside the game again correctly respecting any choices by the player. In other words, set a wooden piece of furniture to be constructed with “Any” material and the game will handle it as best it can, potentially even resetting what it has selected initially, but if the player manually chooses a material to use, it will always stick to that selection.

Although there’s not much interest in modding yet, I’ve added a placeholder sprite as a fallback (literally a square with the text “placeholder” on it) which the game will now use if any sprites are unavailable for some reason. This shouldn’t happen in the base game, but when attempting to mod something, a modder can easily forget that a change in one place may mean new sprites are required. Until now the game would have rendered nothing or even crashed if these weren’t available, but now the placeholder graphic should make it clear where these are needed.

Although I’m making this game as a one-man team for the design and development side of things, it wouldn’t be possible without a bunch of very talented freelancers working on the art and music. There’s currently a lot going on in the artwork side of things, to get everything produced for King under the Mountain to press on towards the Steam Early Access release. There’s even quite a lot that has already been produced which hasn’t been revealed yet that I’m very much looking forward to sharing in future updates. This Alpha 4 release does contain one artwork improvement though – the constructed stone and wooden walls:

Old walls on the left, new on the right

These constructed walls, the stone version in particular, were actually my own programmer art of attempting to copy the Prison Architect style for how walls work (although being able to handle a thickness of more than one tile). In fact the very very first code written for King under the Mountain was figuring out these walls and how to render them, as you can see from my channel’s very first video from all the way back in 2015.

There’s a lot more to come, including overhauling quite a bit of how the environment looks in the game, so look forward to that!

Finally, in the process of writing this update a community member was having issues running the game. After a bit of investigation we figured out that the laptop used no longer had enough memory to start a new game or load an existing one. The additions are adding up! To help with this a little though, a secret feature has been added to let players modify the size of the map when starting a new game. This is done by editing the seed.txt file alongside the game launcher. Previously this was a text file with the number 0 in it only. You can change this to a different number to set the map seed for the random generation, in other words setting it to a number other than 0 will cause the game to generate the same map each time, much like seeds used for random generation in games like Minecraft. This file now contains a second line, which reads “400×300”. This corresponds to a map size of 400 tiles wide by 300 tiles tall. You can change this text, and as long as the format is the same (i.e. “XXXxYYY”) the game will use that size for the map instead. This was added to let computers without enough memory to generate the current map size still run the game with a smaller map, but you may want to try a larger map too. A word of warning – the minimap does not currently scale properly, the size of the minimap in pixels is the size of the map in tiles, so a very large map will cause the minimap to obscure the whole game. This will be improved in a future release, I just wanted to get something added quickly for the players affected to still be able to run the game. Picking the map size and random generation seed will be built into the UI properly at some point. At some point I’ll have to think about optimising the memory use, though ideally the longer I can put that off, the smoother things will be. There is a potentially fun side effect from being able to control the map size, you can now create a tiny “pocket world” as a challenge of playing the game with very limited space and resources.

A small “pocket world”

And that’s it for this month and Alpha 4! Alpha 5 should see the remaining very-clearly-missing quality of life improvements in the form of stockpile management and support for multiple saved games/settlements, and then goes on to the lay the remaining groundwork systems – a particle effect system and constructed roofs and flooring – to support the big content additions of alphas 6 through 10. Thank you to all of you sticking with the development of the game! If you haven’t done so already, you can wishlist the game on Steam at store.steampowered.com/app/930230/King_under_the_Mountain/ though if you already have access via Kickstarter or Itch.io you will be receiving a Steam key for free!

October 2020 Update – Alpha 4 Released!


Hello and welcome to the resumed King under the Mountain dev update! I’m happy to announce that the remaining pieces of work for the brewing beer update were completed, so this has formed the initial   Alpha 4 release.

In a slightly different format I thought I’d explain the process (for the player’s point of view) to making use of this new and perhaps crucial  feature.
Read more

The “Game’s Not Dead” sorry for the delay Update


Hello followers of King under the Mountain development! This is the much-needed huge apology for the radio silence for the last couple of months, it’s always been a great motivator to have the monthly dev updates out somewhat on time, but there hasn’t been anything posted from the end of June until now. Well, the main message is not to worry, development isn’t dead, I’m always going to stick to finishing this game until it’s finished, or else I wouldn’t be able to create anything afterwards!

I’d have liked to have put an actual new version release out alongside this post, but it’s been so long since the last update I figured it was better to post this first and then aim to (finally!) release the brewing beer update. Following that will be manual selection of crafting by the player (quite a big change from the current automated process! Perhaps players would prefer a mix of the two?) and then it’s on to more content on the road to Steam Early Access.

It’s not been all-stop for the last couple of months either, I’ve been working with an artist to produce a lot of the new assets that are going to be required between now and the Steam release, primarily this has been a lot of different animal species to be added to the game, including backer-specified rewards, and of course, elephants.

Still, I wanted to post this really brief update rather than put things off even longer to a proper update with more details. Perhaps I’ll finally release that brewing beer with the next monthly update? Again though, more than anything I want to apologise for the lack of communication and I’ll be doing my very best that it doesn’t happen again.

 

June 2020 Update


Welcome to the monthly King under the Mountain dev update! Very happy to say that development is back on track now after all the disruption from covid-19 and other sources the past few months. That said, I was expecting to have more gamedev time than I have had this past month after my day job changed to 3 days a week, turns out they can’t make do without me so I’ve been asked to work most of those extra days! Will see how that pans out.
Read more