
Hello, fellow Vikings!
I know I haven’t posted too much new video content lately so I’d love to share with you what I have been up to. One of the things that excites me the most about the city builder games is the simulation of living, breathing society. The citizens don’t just walk back and forth between the gold mine and the town hall, like in a typical RTS game. They have homes and families. They have names, lives and interesting stories. After you set up a working economy you can watch them go around their business and start really caring. And since Nordic people of the Viking Age are famous for their grit and strong will, it’s super important to me to breathe life into the citizens of Viking City Builder.
I’ve started by playing my favourite city builders - Banished and Dawn of Man. I’ve immersed myself in those worlds and spent a lot of time watching my citizens. Then I’ve played a little less obvious inspirations of mine, like RimWorld and Frostpunk. I've also watched a lot of youtube videos on Viking life. What was their daily routine etc.
After that I felt I know WHAT I want to achieve. Now I just needed HOW. How to turn my idea of Viking village life into code.

To achieve what I wanted I needed a really robust AI system. My first implementation of the AI was rather straightforward - I’ve used Behaviour Trees to make units do what I wanted. Unreal Engine has a built in BT system that is easy to use and that I am familiar with. It works great for pre-made behaviours, creating Reactive AI, like in Shooter or RTS games.
But what I felt that is really needed is Emergent Behaviours, something that makes you believe this is an independent being, not a pre-programmed bot. I had to go deeper. So I’ve started researching.
I’ve remembered mentions of technologies like Goal Oriented Action Planning and Utility Based AI. After reading a bit on the topic, I’ve decided Utility AI is the way to go. I don’t want this post to become a book so I’ll try to briefly explain what Utility AI is.

Imagine you have a game like The Sims. Your sim has few needs - let’s say hunger, sleep, hydration and entertainment. So how would you program your Sim making a decision what to do next? If you used Behaviour Trees or other Decision Tree approaches you would have to code a lot of cases: if you are super hungry and not tired - eat pizza. But if you are a bit hungry and super tired - maybe sleep first and then eat pizza. Now imagine having to pre-program all those behaviours for the game.
What Utility Based AI does is allow you to create a fitness function - a function that takes some considerations and produces a number for each of the decisions. E.g. for eating pizza you could create a function like: “desire to eat pizza = 5 * hunger + 2 * boredom - 10 * size of my belly” ;) You get the point.
This is exactly what I needed. Unfortunately there is no built-in Utility AI framework in Unreal, so now I spend my time between reading whitepapers on Utility AI and trying to implement it in Unreal. So you know - if you ever feel like I’m not that active on social media - it might just be that I’m trying to figure out the best fitness function for eating pizza ;)