The goal of these dev logs is to explain in broad strokes how we accomplished what we did. It won’t cover everything that was done, but it will cover anything major. There will be various smaller articles to cover more finite details. We also have a progress log for those of you less interested in the technical side of things, and just looking for the key notes.
Nothing is set in stone, and during game development a lot of features will be re-designed or completely scraped over time due to many reasons. These dev logs provide a snapshot into what the game looks like at the time of writing them, and hold no promise of what will make it into the final product.
The focus of this month for our development in Lamina Island has been our game’s AI.
Since we ended up scrapping Emerald AI to be able to have more control over it, that meant we had to implement our own combat into our AI system. The core of our AI system is based off the three state AI logic of FEAR. Our states are a little bit different then theirs, but the essence is the same. And just like their system, it probably could have been cut down to two states.
Our three states we settled on were “Plan”,”Move”, & “Do”. And this worked great for a long time. We had a general desire system & that would drive the planning, and everything else would work accordingly. Our game however has a few complexities that have pushed this system to it’s limit.
For one while most games have a player entity & an AI entity. One of the core mechanics we are shooting for in this game is the ability to shift between one entity to another. That means all entities are AI & any that we allow the player to control is also player. To accomplish this, when the switch occurs, we have to kill whatever action plan we have on the entity the player is about to control and kick on the AI for the entity the player is no longer controlling.
And the most important limitation? This is our first full scale AI system. The FEAR system was written by somebody with a lot more time and experience to dedicate to their AI than we have to dedicate to ours.
So we ended up having to make a few modifications to the FEAR model. We reduced the world state information significantly. Rather than knowing a blackboard of information & updating it as needed, the only ‘world’ information it has access to is whether or not the action in question is being advertised and what goals said action contribute to.
There was also a lot of processing being taken into consideration by each entity in the planning state. Each entity was running it’s own planning logic, and that planning logic included scanning their local area, global values, and checking all of the pre-conditions as well as attempting to plan 3 steps ahead, so it would evaluate every action to see how it changed the world state before discarding it. And this was before we even added combat into the mix. If there were 100 apples on the ground and the AI was looking for something to eat, it would go through all 100 options, and then see, if eating the apple changed the world state in any meaningful way by estimating the outcome of the action against the remaining 99 options. This would get out of hand very quickly, and was not ideal.
Since we cut the pre-conditions out as well as the ability to plan more than a single step at a time, all of the delays were removed. We also pushed the AI planning out of the entity’s realm of control and instead into a shared ‘master mind’. Now the entities simply hand the master mind it’s desires & what entity it is attached to, the master mind evaluates all the possible actions for the entity, and then returns an action plan for the AI to follow.
This immediately cut down planning time by several degrees. Of course the obvious ‘only look at one step at a time’ caused the biggest change here. Another effect of a centralized planning system however was the ability cache some of it’s evaluations & thus reduce the number of repeated calculations.
I think our biggest issue with getting the preconditions and world state correct, was an inability to clearly define a useful way to represent the world state. We will explore this further in side projects before implementing it in future games, however the AI system as it stands allows for a lot of different behaviors without a high degree of effort in slotting them in, so while it’s not perfect and does not allow for complex series of actions, it will work for what we need it to do.
We also added a mood system which is a bit on the crass side at the moment, but it acts closer to a standard state machine in which it holds a list of desires and triggers can put it into a different mood that would hold it’s own desires. The logic goes like this. The AI’s mood starts out as ‘calm’. Each mood holds a list of desires. A player attacks the AI, now it’s mood has changed from ‘calm’ to ‘aggressive’ and it has a new list of desires. The planning system, when reading the desires will thus give you a different set of actions.
It kinda means we have a little bit of both systems but that’s OK because it allows us to get classic AI logic in for our animals & monsters, but still be able to inject some observatory AI into our Lamina & Heroes. By observatory AI, I’m referring to the kind that kind that is less combat driven and more entertainment driven. While the lamina is in our home base for example, just giving them the ‘desire to eat’, we can slot in a dozen different food and it will go to any number of them and eat them. By slotting in the ‘desire to play’ we can add a number of toys for them to play with and thus give rise to looking like they have a sense of agency worth observing.
There are a million little decisions that went into the framework of our AI system. Too much to cover in a single article while giving it justice. There will probably be a few articles covering different parts of the AI in greater detail. Being an iterative process, I doubt it’s anywhere near complete yet.Now we have a strong framework that we can build upon that is capable of all our goals, and that marks a pivotal point in the project’s development.
The work put into our spawn systems was minor in comparison to the AI, but just as important. That will get it’s own post down the road. The combination of these two however, make the game feel much more alive, and that is the most important part.