Well, it's been a long time since I last wrote one of these and since we're approaching a big landmark in our games development( more on that later) I thought I'd write something that people actually find useful for a change. So in the next couple of weeks, I'll be going over our games AI- the general concepts that make it tick as well as how we adapted those concepts to fit our needs. In this first part, I provide a general overview of all the systems in place. I'll go over each of those systems in depth. Since no two games are the same, this won't be a step by step guide on how to achieve the same results as us. It's more of a showcase of general ideas and approaches when designing game AI. The ideas I discuss can be applied to most games, but I'll be focusing on how we used them in our turn-based tactics game Herald of The Order. As a quick disclaimer I am neither an AI expert, nor am I an expert programmer, so nothing I say here will have much academic backing. I'm just sharing the solutions our team found useful in the hope of at least giving you a good starting point for projects of your own.
Utility AI
The main concept behind our games AI is something called utility theory. In layman's terms, it's the idea that every action a unit can take in the game can be graded with a normalized factor between 0 and 1 and different multipliers can be added to these factors to incentives certain behaviours. If you want a more professional explanation, I highly recommend checking out the works of Dave Mark. He is the author of "Behavioral Mathematics for Game AI". And has several great talks on the subject of utility theory in game AI in the GDC Vault. In our game, a unit can move, use an ability or end its turn. Each of these actions has several considerations, that factor into them. The most important of them is the danger map.
Influence Maps
The main idea of the influence map is that every unit has a zone of influence around them. This influence can be given a numeric value which is positive for members of its team and negative for members of the opposite team. These values overlap giving each position on the map a favorability factor. Using this map your AI can know which positions it's safer to be in and use that knowledge in all of its decisions. You can find a far more in-depth look on the subject around the web, but here's one article I found particularly useful:
http://gameschoolgems.blogspot.com/2009/12/influence-maps-i.html
Behaviours
Behaviours are what we used to tell our AI how to use the information it has. They took all the factors for a given decision and added multipliers to them depending on how we wanted the unit to act in a given situation. We have simple ones which simply use a list of preset values and more advanced ones which calculate factors of their own for when we want to add another layer of logic to the actions of a unit, such as patrolling around a certain position or moving towards the player. We also wanted the AI to be able to adjust its behaviour according to the player's actions and so we needed a blast from game programming past.
Behaviour Trees
Although they're considered outdated, and they are outdated when it comes to low-level decision making. Behaviour trees are still a useful tool for controlling the AI's overall strategy. In our case, the AI goes down a tree of conditions at the start of each turn. Some examples of these conditions are: "Am I being attacked?" or "Is there an enemy in range?". Depending on if a condition is met or not the tree branches off. A branch can either be another condition, in which case it keeps going further down the tree, or a behaviour, in which case it knows how it has to act during this turn.
The bumbling to come
That does it for the mile-high view. In the next couple of weeks, I'll take a more in-depth look at all the different parts discussed above. As I mentioned, in the beginning, we're reaching an important milestone in our games development. The first chapter of our game(6 story missions) is almost done. We'll be releasing it for free by the end of September. We hope that this will help us generate a large enough following to justify the work needed to finish the rest of our game. If not we'll just have to leave it as a passion project sacrificed at the altar of real life.
If you'd like to know how we got here, check out our first blog, summarizing our journey so far. if you would like to see this game finished consider signing up to our mailing list, to let us know you're interested in our work. You can play the current version of our DEMO to tie you over until the new one is finished. And consider filling out this survey to let us know what you thought. As always if you want to see more from us visit our website or our social media pages: Twitter, Facebook, Instagram.
0 comments