I've covered in brief what the AI in lithic will do in the blog post, In this thread I'll track progress and give updates.
As lithic is a game where survival is a challenge for the tribe, the AI is meant to look after the details of this so the player isn't swamped with micro-managing day to day survival. The AI runs through a set of decisions based on survival and when all these checks are good it will go into "free time" mode. It's this free time mode where a tribe develops culture and new technologies and it's here where we want the player to be able to focus.
How a character decides exactly when they are tired, how much food the tribe needs to have stored and pretty much everything else is governed by traits individual to the character, there are three scales each ranked from 1-100, these are Proud-Unproud, Selfish-Selfless and Passive-Aggressive. A Selfish character will gather less food and sleep more often than a selfless one, but will also expose him/her self to less risk than a Selfless one and be less likely to go and aid another tribe member who needs help, for example.
For our first alpha release the AI will be fairly basic, it will make sure the character's in a player's tribe can look after themselves, find food and water and sleep when they need to. It checks these things in this order - of course this may be subject to change.
This AI checks between every 2-5 seconds. How often a character does a new AI check is based on their Intelligence score so that smarter characters act faster to changing circumstances.
Am I tired? : if a character's fatigue meter is at a certain limit or it is night time then go to sleep - if no bed is available then find or make one.
Am I Hungry? : (Or thirsty): If our hunger meter is at a certain limit, then go find something to eat. This can either be food foraged directly, food in the tribe store or simply some food we're already carrying
Does the tribe have enough food? : (This is where it starts to get complicated) Is there enough food stored in the tribe store house? Exactly what this means is again dependant on each character, Gatherer class character's will be more likely to pick this option as will selfless characters but there is a bit of random in there.
If there isn't then we need to gather some: this can be as simple as going to the nearest known source of food, if the character knows of food sources then it does a check to see which is the best one to gather from. Is anyone else going to gather there? How far is it from me? How far is it from the tribe store? How much food is available there?. Based on this the AI selects a food source and goes to gather some. If it can't find one, then it goes into a search routine where it will travel to an area that could contain food and search for some. This search may take some time and isn't guaranteed to succeed but the character does find some food it will remember that location as one it can go back to in future.
Knowledge of food source locations is specific to characters - just because one character knows a food source exists doesn't mean that they all do!
Free time! : If all the above are OK, then the AI will go to free time - exactly what each character does is dependant on personality traits but its in this free time mode that characters develop culturally and socially, making non-essential ornaments, dancing, speaking to each other and passing skills and knowledge between themselves.
Everything below is not yet in the AI, but will be put in as we develop Lithic. They will all go above free time, free time is the final choice a character makes only when everything else is done.
Do any of my tools need repairing?
Does anyone need help on a task they are performing?
Can I learn anything (Is anyone teaching)?
Can I teach anything to someone performing a task? (i.e. is someone doing a task I'm better at and so can train them)
Can I teach at the tribe meeting place? (I,e, give a lesson on a skill I have that is high ranked)
There are certain over rides that prevent the AI from doing anything else, we're calling these "Special States". These are points where we feel it's best the player takes over and decides what to do next.
Famine! : (I am hungry and have no food, the tribe has no food and there is no where to gather fresh food) This is a panic state, exactly what the AI does depends on its personality. A selfish, aggressive character may try to use force to take food from another tribe member. A Selfless, Unproud character may try to beg for food from others. Some personality traits may even lead to the character leaving the tribe all together and striking out on their own.
Combat: (The character is in combat) Obviously, we don't want characters wandering off to find something to eat in the middle of a fight. Combat might not be a central theme in Lithic but it can happen.
Hunting: A character who is one a hunt and has found some prey to hunt won't leave the hunt till its conclusion
Player controlled: Fairly obvious, if the player is possessing a character then its AI is off and they have full control.
That's a fairly brief over view of what we're doing with AI, I'll keep this thread updated with new developments as they happen (which won't be for some time as I'm moving on to building terrain and the code that generates new worlds for a while).
If you've got any questions then ask away, I'll get to them as soon as I get the chance.