In-house animations for every home!

Animations are super important in Knights Province. The game is meant to be playable in different styles, but one of the bigger focuses are – chill, laid-back experience where players can enjoy building their towns and interact with others towns (including AI). Animations help to reach and support that goal in several aspects:

Setting the Scene – Animations help create the right vibe in the game. They make the town and its people seem alive and active, adding a lively feel to the game world.

Reinforcing the idea that Building Stuff Feels Good – The game is all about taking your time to build a town, and animations make that process enjoyable to watch. Seeing buildings go up, trees and grain grow, and resources being moved around and processed keeps the game engaging and satisfactory.

Feedback that Works – Animations give feedback to players about execution of their orders. When you tell a building to be built, animations show the progress. It’s a clear way to show what’s happening.

Explaining How Things Work – Animations make it easier to understand complex game parts, like management and processing of resources. Seeing resources being gathered or worked on helps players grasp how the game economy works.

To sum up, animations are a big deal in Knights Province. They’re not just there to look cool – they make the game feel relaxed, enjoyable, and engaging, exactly what the game aims to be.

Stepping one step down the abstraction ladder, it helps to categorize and describe what animations are there and which ones make the bigger impact (bang for buck). The most important ones are the units. They form up the majority of interactive and animated entities in the game. Each unit type has its own distinct look, tools and loads they carry and activities they do. Of course there are many other unit-less animations, but those ones are in a relative minority. We’ll focus on units for this article.

Breaking down an animated unit in the game, it consists of four parts: the unit model, rig (equipment), animation, and optional distorts.

Unit Model – The unit model is the visual representation of the unit in its base form. It includes the 3D character model, textures, and basic skeletal structure. This is the starting point for all animations and is what the player sees as the character. Typical unit starts his life in so-called A-pose:

Rig (Optional) – The rig in KP is a description of how different auxiliary parts get added to the unit – like a carry, work tools, interaction objects, etc. While optional, more than half of the unit`s time is spent having some rig applied. One additional use of the rigs is that due to game being still in development, rigs allow to easily take a base unit (e.g. Swordsman) and replace his default rig (sword and shield) with a rig containing a cap and an arbalet, thus making him look like a new unit (Arbaletman).

Animation – Animations are the movements and actions that bring the unit model to life. These include walking, attacking, working, or any other actions the unit can perform within the game. Animations are crucial for gameplay dynamics. Most of the animations are looped, meaning that they can be repeated seamlessly.

Distorts (Optional):

Distorts are additional alterations applied to the unit animation. They include changes in skeletal animation values and boundaries. For example Porter carrying a heavy load needs to have his arms bent to hold the load and slightly different walk animation so that it’s clear that the load is indeed heavy and a burden.

While the unit model and animation are essential, the rig and distorts add an extra layer of sophistication and visual appeal to the animated units within the game.

All 4 components working together allow one basic walk animation to be adapted to several dozens of uses. 

Now, there’s a new spin on that system – in-house work animations. They have kept me intimidated since the beginning, since I’m not that experienced with skeletal animations and I didn’t spend a proper amount of time analyzing the requirements. It all seemed just too big and fuzzy. Now, finally, I have had enough time and focus to address the thing. Analyzing the problem is the first thing to do. While looking and acting very similar to the unit animations, in-house animations have several key differences:

Combining Several Skeletal Models – while some animations are very simple (e.g. idle units just chilling and looking sides) there are also quite complex animations involving independently animated mechanisms (e.g. Tailors spinning wheel, or Brewers cider press).

Working with Tools and Objects – units need to change tools they hold and some of the tools that the unit needs to work with require special treatment. One such example is a baker’s rolling pin, it needs to be making good contact with both of the baker’s hands. Dough had to be in the equation too.

Non-Looped Animations – some of the animations are just intermediary between others, e.g. a unit walking out of his house into the working areas. It starts in one place and ends in another, without rewinding back. Others are seemingly looped, but without interpolation between last and first frame (e.g. Mill blades, always rotate on and on) which technically makes it non-looped, just really well aligned.

Non-Animations – it is rather handy to use the same mechanism for non-animated elements. For example, it’s much more handy to model the Brewery ladder as a straight standalone object and then move it into place tilting the right amount by all three rotation axes.

Special Non-Skeletal Animations – waving house flags are a good example of such animations that are much easier to be made without skeletal structure. They use a special shader for that and are not part of the in-house animations focus, same as burning particle effects.

Knowing the approximate set of requirements, it was time to evaluate possible solutions. Biggest problem seemed to be creating unit animations. Main requirement was a standalone tool focused on one thing that it does well. Preferably free or open-source, or at least not very expensive:

AccuRIG – a tool for automatic rigging of the skeletal models (here, the term “rig” is used in it’s industrial standard meaning – it refers to the creation of the skeleton and setting up vertex weights for the bones that affect those vertices). The tool features a big set of sample animations, some of which could be suitable for the Knights Province. Unfortunately, not all animations could be found in the stock library, and the resulting rigged model format and set of bones were quite unwieldy for the game’s needs.

Cascadeur – is a groundbreaking 3D skeletal animation tool. One of Cascadeur’s standout features is its advanced physics-based animation system. Using principles of physics and biomechanics, Cascadeur can generate organic and lifelike movements that adhere to the laws of physics by specifying just a few key poses. Demo reel looks amazing. Its UI is quite sophisticated and not easy to grasp and use efficiently without spending time learning it though. The resulting rigged model format and set of bones are also not fully compatible with the game’s needs.

Both Lightwave and Blender – could be used, but both are mature complex tools with overwhelmingly large sets of features and it would have taken more time to learn them.

After tinkering with distorts, it appeared that the task was not so complicated. I could take an idling unit animation, fold its arms and make it look around. Voila – idle Baker looking out of his Mill! That ought to do it for simple animations, but more unique ones still required an animation to be created from scratch.

Choosing to develop custom animation tools presented a compelling alternative. Such an approach would allow to tailor the animation tool’s features and capabilities to the specific needs of Knights Province (which are quite minimalistic). It would keep unneeded features out (and keep the UI clean of their clutter). Third important point is WYSIWYG – animations would look exactly the same in the tool used to create and alter them as in the game. Moreover, the process of creating personalized animation tools offers a valuable learning experience and better understanding of the animation workflow.

Armed with the KISS principle (keep it simple, stupid), two separate tools were planned and made, each one focusing on one aspect of the games animations creation process:

Motion Rigger – a tool allowing to interactively set up Rigs and Distortions (since both are closely related and co-dependent). Handy for cases where base idle unit animation is almost enough, but the base unit’s pose needs to be changed to a leaning one and the head movement added.

Motion Animator – a tool for creation of new animations from scratch. Sometimes it is just simpler to create something from a blank slate. A good example is Stonecutters animation of sitting on a stool and shaping a boulder with a hammer and chisel into smaller stones.

Most of the time creating these tools was spent in two big areas:

Creation of UI – one of the main UI elements in both tools is the timeline. It’s there to control the skeleton bones movements over the animation length. This is done with keyframes – frames where exact bone orientations are set (majority of the time bones only rotate, they don’t change their length or offset). Orientation between keyframes is interpolated. Thus, allowing to set up a whole animation with just a few key poses (for both animations and distorts).

Timeline was created using games GUI elements with slight modification and expansion. For example, the lines themselves are based off of the game results charts. It would be next to impossible to make it in the VCL, which is good for simple interfaces, not the interactive charts. Overall I’m very happy about how it turned out. Knights Province GUI library is a powerful tool.

Creation of the Underlying Algorithms and Data Structures – animations sound easy on the surface, but there are several caveats. Firstly there’s groundwork required to allow for storage of the animation data with new keyframes information. Game’s older animation format used md5-like text files with aux data on a side. It was time to switch to something more structured and orderly – like XML. Another rework was concerning rigs and distorts – they were stored in the same file and processed in one flow, which is incorrect, since they are not really dependent on each other. Skeletal models handling had to be made more abstract, since before that it was assumed to be handling only units (with full skeletons). Game’s animation library itself was reworked and optimized, removing duplicate walk and idle animations (which the game had plenty of). Animations timing was also retouched, so that e.g. projectiles (and their sound effect) could be launched the instant the unit animation says so, but be “delayable” as the game engine needs it (to make archers act in slight dissonance).

To top it all off, there’s the PreviewHouse tool that was upgraded to allow it to set up and position workers, static and animated elements tied to certain house animations (which were refactored as well).

Creating the tools is one thing, creating the workflow is another level. Thanks to the tools sharing a lot of code and elements, being WYSIWYG and easily tweakable, the workflow came out naturally. Now the doors are open and the main limiting factor of animating the game to the brim is creativity (and time). Small note, mounted units are still an open question, but that’s a call for a future Krom.

Whole thing took around 5 weeks and ~400 commits. That’s a big hunk of work. Am I happy with the result – absolutely! Tools are simple, yet effective enough, allowing to create and tweak animations WYSIWYG, being fully modifiable and expandable. Now I’m feeling confident about in-house animations implementation, workflow and tools – they are here to stay.

Knights Province began its life almost exactly 10 years ago now with first semi-serious pre-production renders being made in the 3rd decade of September 2023 followed shortly by first code work. What a huge and never ending journey it led up to this day and beyond! On that note, I’m happy to reveal that Alpha 12 release is nearing!

Posted in How things work, Live progress, News, Tools | 2 Comments

Adding bridges to the game

Following periodic requests, I’ve checked and revised the decals used to place bridges in Knights Province.

Usually they have been faked with “Pier” decal, but it has one unfortunate property – it’s unwalkable. Not to mention gaps between boards don’t look that good.

Taking “Pier” as a base I have made 2 new decals for bridge body and bridge side. Here’s how they turned out:

Best of all – bridge body decal is walkable 🙂

Posted in Screenshots | 2 Comments

New Knights Province server

As shown in a previous blog post, KP development suite has a great automation tool – Runner / Stadium which can crunch simulations of hundreds of games with AI players in a matter of hours. Such automation is good not only for AI tweaks, but also for tracking down bugs and improving overall game performance and balance. These things go hand in hand – better AI can use more of game mechanics and features, which lead to more bugs being discovered and more sub-systems being used that affect the game’s performance, making it more representative of what actual players will experience. Larger target being – let the machine do the dirty work of discovering bugs instead of players.

Continue reading
Posted in Hardware, Tools | 2 Comments

How does one fix AI starvation?

Knights Province AI opponents in Skirmish have a known occasional issue of not producing enough food for their servants, resulting in citizen starvation and early collapse of their town economy due to that. Let’s look into what it takes to fix that issue!

Continue reading
Posted in How things work, Live progress, Tools | 5 Comments

Serf army gets more equipment

Had an inspiration for 3D modelling. Only a few ware models are missing now

Posted in Artwork, Screenshots, Sidenotes, Tools | 2 Comments

Starting Alpha 12 wip cycle

It’s been a long time since Alpha 11, but at last, Alpha 12 is entering its public Wip cycle! Starting from today, you can find a link to fresh Alpha 12 wip build on Discord.

Long story short – lots of coding, game design, artists interactions and debugging went into Alpha 12 over the past year. There are several new big changes and improvements in the game:

  • Sheep farms, Sheep, Pastures, Wool, Gambesons!
  • Reworking object picking (aka hitboxes) UI/UX
  • Reworking HUD UI/UX
  • Waterfalls and multiple water levels
  • New text localizations – French, German, Spanish, Polish and Turkish
  • And as always – a lot of smaller features and improvements

Here’s a video highlighting main features by Wychor on the official Knights Province channel – make sure to subscribe!

Now let’s look into these features more closely.

As always, a word of caution – anything described below is not final and can change during or after Alpha 12 release.

Sheep, sheep farms, pastures, wool and gambesons

One of the things that bugged me from the early days of this project, was that Leather Armor, albeit looking cool in all those modern movies and TV series, was not actually period correct. It is Gambesons that were mainly used. Now with Fences that were added as a prototype in Alpha 11 we can finally do that – add Sheep, Wool and Gambesons. Each piece deserves a separate paragraph to introduce and to explain:

  • New kind house is added – a Sheep farm (this is one funny name that may stay or go). There works a Breeder who tends to the Sheep. Sheep farm has a new unique thing about it – it has a backdoor, through which a Breeder can access the pasture.
  • A Sheep farm needs to have a pasture next to it. Pasture is an area on terrain next to the Sheep farm, enclosed by natural obstacles or other buildings and fences. Pastures can be shared between several Sheep farms, but as playtesting showed, they work out best when they have size restrictions of 4 – 80 tiles.
  • When the Sheep farm is complete and has a breeder inside and enclosed pasture next to it – then Breeder can bring out baby sheep! They will graze in the pasture slowly growing up and growing wool on them. The rate depends on the pasture terrain – unfieldable terrain tiles provide 0 nutrition, fieldable tiles are x0.5 nutrition and grassy terrain tiles are x1. However, the main source of sheep nutrition is grain that Breeder gives them.
  • Once sheep are mature and wooly enough, a Breeder will come inside the pasture to trim them for Wool. Raw wool gets processed right in the Sheep farm by the Breeder and gets turned into hanks of wool (called Wool in the game, for short). It’s a new ware in the game. Wool is produced two at a time.
  • Now serfs can take Wool from Sheep farms and bring it to a new house – Clothmakers, where a Tailor (new profession) will take the Wool and turn it into Gambesons.
  • Gambesons are now used instead of leather armor to equip tier 2 warriors in the Fort.

With that in mind, the old leather production chain (CowFarm -> Cowhides -> Tannery -> ArmoryWorkshop -> LeatherArmor) is no longer in use. Cowhides, Leather and Leather Armor and Tannery become obsolete and are removed from the game. The sheep concept is a testbed for all other animal breeding concepts. So changes to the meat production line and stables are also on the roadmap.

Better object picking

With fences having a bigger role now, it was time to rework object picking – a way game detects what object should get selected when a mouse click occurs. Now you will be able to select more of in-game objects – fences, trees, ore decals. Selection precision was also improved – now the objects are being selected by their shape, not by the footprint on the terrain. Here’s a developers view on the object shapes:

Updated objects HUD

There is also a new HUD for selected objects. It has more focus on the object’s avatar and is intended to be closer to the final looks it will get in the future. It is still in the prototype stage.

Sidenote: Apparently, finding a good UX/UI artist is really hard. I have been searching for several months now with mixed success.

Waterfalls and support for multiple water levels were added

Now there can be up to 4 different water levels (each with its own waterbody setup). Water shader was also slightly improved. Setting up waterfalls is a chore, but I’m hoping to improve and streamline that process based on your feedback.

This change also caused the rework of the way waterbeds and shorelines are set up – now it’s dynamic and depends on the actual tiles that are covered with the water. So there’s no more “underwater” surfaces. Any surface can be a waterbed now – even hot lava xD.

Among other noticeable improvements

In-game changelog – now you can see what is new and what has changed since previous builds.

Improvements in AI city planning – e.g. now AI will try to restore road/building plans if the worker building them dies

New music track (Bells) by Juan I. Goncebat

New maps by Wychor (Lake Plateau, Erlond, Nile)

New animals for new waterbodies

New terrain surfaces, including cave floor with 3 different stone densities (had to revive my Substance Designer skills)

Grain fields render performance improvements (from 9 fps to 46 fps!)

Further Alpha 12 plans

  • Playtesting and tweaking sheep/pastures/fences/AI interactions
  • Upgrading all the missions to the new non-leather/gambesons flow and non-singular waterbodies setup
  • Creating a sheep-oriented mission for the Introduction campaign
  • Fixing Alpha 12 bugs (https://github.com/Kromster80/knights_province/milestone/9)
  • Getting HUD wrapped up (continuing the redesign and/or adding missing bits)
  • Lots and lots of smaller fixes and improvements

Download links to new Alpha 12 wip builds will start to appear in the Discord #new_versions channel (along with changelogs). Give them a try! I’m looking forward to your feedback on Discord

There’s also a new channel for Knights Province videos – The videos on the channel will be about announcements, development updates, map highlights, and more. Right now the channel already has some playlists with mapmaking, development and gameplay videos made by other KP community members. Let us know if YOU are someone who makes KP videos and would like them featured in the official playlists.

Posted in News | 17 Comments

HUD redesign – work in progress

So I’ve been working on the Knights Province HUD redesign lately. It is a two-fold endeavor – design and programming. Here’s how it goes:

Some terminology first – typically, HUD is a short for the Heads-Up Display – GUI elements that pop up over the “world” view, showing some general information and/or the selected objects info. Here and below I will be specifically referring to the in-game object’s HUD that appears when an object gets selected (a house, a unit, a tree, etc).

So basically I’m quite content with the current blocky HUD. It was always planned to be a temp solution. Something that can be slapped together and work. Grey at first, recently it got nicer with colored background textures and subtle shadows, but still – it is a temporary solution. It serves its purpose of being a “sketch/prototype” very well. I’m glad to have it functional and would like to keep it that way. However changes are due.

What was the push for the change? Fences and sheep!

Looking at other games (specifically Age of Empires) I always liked the idea of being able to select every major object and trees to see its info. Now with fences it is doubly important to be able to select them and view their details (e.g. player ownership).

HUD design and coding is one part of the endeavor. Object picking in-game is another one. Suffice to say – it took some noticeable amount of time and effort, but now it seems object picking is working rather well and is future-proof (with improvements already queued).

Back to the HUD topic though. Being able to select more kinds of objects meant that the HUD needed to be updated to show the new objects in a pleasant way, or, even better – redesigned! Being so used to the existing design I would not be able to radically change it without taking a long break from the game development and coding, so I have had to hire a freelance artist to help. Just_bu stepped in. Below are just some of the sketches (ideas) she has made:

You may notice they have an odd style and gamma – this is intentional. On this stage we were generating UX/UI layout sketches. Seeing what needs to go together and what can be moved. Checking out the balance between form and size.

Unfortunately, Just_bu had to move on to a higher priority project some days ago. Now I’m posting the vacancy description once again, hoping to get a new pair of hands on the case. Important to say – Patreon donations helped to cover the costs. Big thank you, patrons!

After running some research and seeing different UI ideas, I saw that Knights Province UI tended to gravitate towards certain structural layouts. Being reasonably sure about that, now I’m starting to update the game engine too. Refactoring old “rigid” forms into more flexible “modular” design. Here are some modules I have isolated as example in the old UI:

And after some extensive research I was able to create the following table, that covers most of the in-game entities and the HUDs they need (a fragment):

It contains the entities (rows) and modules they need (columns). Pretty straight-forward. With just minor complications arising from allied/enemy states and cross-module dependencies. No road-blocks though – just a lot to code and refactor! xD

One of the bigger and nicer HUD elements I wanted to cover in more detail is an object’s avatar. It is going to be a central piece of the new HUD. I’ve chosen to reuse the in-game 3D model for it (instead of hand-drawn graphics), to speed up and ease up the development. The model gets rendered into its own texture and post-processed with a nice glow effect.

Avatar being rendered into its own texture with glow and antialiasing is somewhat performance costly, but I’m hoping to optimize that later on, when it becomes accepted (cos who knows, maybe new UX artists will bring in superior HUD ideas that do not involve avatars).

Here’s another wip example – Store HUD getting “modular” overhaul – wares module is now common between it and the Camp, Fort and Barracks (all houses with “a lot of wares” stored inside):

Objects HUD redesign is a “soft-ball” of sorts. If it goes well I plan to redesign other in-game GUI elements (minimap, build menu, etc.) later on (maybe in Alpha 13). Main menu redesign is lower priority (think Alpha 14 or later).

Once the big HUD overhaul/refactoring is stabilized I will be able to release new Alpha 12 wip build (with beta sheep and better fences and waterfalls and other nice features). So, armed with that, work goes on!

P.S. And as always, I’m happy to read your comments and discuss on Discord 🙂

Posted in Live progress | 15 Comments

Short 2020 overview

2020 is nearing its end. Thank you everyone for following the project!

What about code?

2020 in commits

What about gameplay?

2020 in highscores

Happy New 2021 Year! Let’s hope it will be a much better one! 🙂

Posted in News | 3 Comments

Alpha 11.3 update

Here’s a third minor update with a bunch of bugfixes and small improvements:

  • Fixed a crash when ordering to attack an already demolished house under FOW
  • Minor naming changes (lance > pike, pike > halberd, house > building)
  • Smooth scrolling for lists
  • Fixed a bug when a keypress would leak from reassignment of a hotkey into a players name editbox in Options menu
  • Fixed crash on loading a savegame with fences being built or attacked
  • Fixed small memory leak on hotkeys resave
  • Fixed harmless junk text getting written into settings on hotkeys resave
  • Fixed crash on reopening Highscores after GFX reinit

Knights Province Alpha 11.3 (installer) Knights Province Alpha 11.3 (7z package)
Posted in Downloads | 16 Comments

Alpha 11.2 update

Here’s a second minor update with lots of bugfixes and small improvements:

  • Fixed stone stockpile placement after house get demolished
  • Fixed error on loading a savegame with a dead group assigned onto a quick-select (Ctrl+0..9)
  • Fixed a couple of minor memory leaks
  • Changed “erase” to “remove” in various MapEd menus
  • Don’t list the horses in the map maker when selecting the resource for wagons #283
  • Messages with buttons should allow for no glyphs #282
  • Fixed mines placement locations visible behind the FOW #270
  • Fixed a bug when Save/Load of the mission unlocks every profession in the school #267
  • Added script action UnitUnlock, like the HouseUnlock #279
  • Fixed a bug when Stonecutter was unable to mine the stone from map corners #281
  • Possibly fixed error on game start when GetDocumentsPath was returning extra slash on the end
  • Calls to Action.(House/Group/Unit)OwnerChange if the new owner is the same as old one will be logged and ignored
  • Fixed stockpiles “auto (collect)” behavior (it was reversed) #266
  • Fixed error in saving a mission from MapEd with default human hand preceded by empty hands
  • Lasso selection should expand a bit when made close to map edge #278
  • MapEd places units under rotated camp wrongly (when applying skirmish) #272
  • Fixed ability to queue the last (5th) unit in the School #280
  • Updated list of patrons in Credits
  • Allowed for grain on snowground25% terrain [#284]
  • Added some snowground25% terrain to Winter Stand to equal out the starting locations
  • Improved KT panel layout a bit
  • Fixed dust puffs locations offset after canceling a house plan (also responsible for crash if they were to be spawned outside of the map bounds)
  • Fixed crash on unchecking Skirmish setup options in MapEd
  • Adding faulty savegame into the crashreport in case a crash occurs
  • Fixed crash on scanning or loading a map with empty script file
  • Fixed CRC calculation being 1-off
  • Implemented undo history depth in MapEd (default 512) [#286]
  • Slightly improved GUI of Records\Global layout
  • Added points assigned for each place into highscores (will be filled once KT is updated)
  • Renamed “Rank” into “Place” in highscores
Knights Province Alpha 11.2 (installer)

Knights Province Alpha 11.2 (7z package)
Posted in Downloads, News | 6 Comments