My takes:
We have two modes of operation we have to deal with when talking about the game's AI. We have group think, and we have individual think.
Group think: This is the response an individual unit has towards another based on it's association with other units, both itself and the unit it's interacting with. Group think almost requires a separate AI response path in of itself, where it can be resolved against the unit's individual think response to come to some response. This is akin to what is referred to as Faction Ai. Though it's more general than that. Group AI can simply be a weighted response choice every unit takes into account when facing a decision. This would require a series of defined "groups" or bonds and a strength to be assigned to these bonds. These groups or bonds each then have a list of all other groups or bonds that form a matrix of connection strengths (both positive and negative). The difference between what i would call group think and faction relations (already in game) is that responses that come from the group think winning over individual think results in group think bond changes all the time, but responses that result from individual think do not always change group bonds. This is a key difference in behavior.
Individual Think: This is directed towards simulating an individual...obviously. They have varying levels of aggressiveness, bravery, etc. They take offense to a unit that attacks them, but their response is not only dictated by self preservation or previous interactions with that particular unit, but every response must also be weighted against the group think. Depending on the faction, group think may lose most of the time to individual think, or win most of the time. Personal enemies may be saved to a list of hostile units in the individual's AI, (group think may get something like this too, kind of like an Ace's list of who to really want to kill/look out for if you come across). A friend's list may also be saved so that units you help out make return the favor if you ask for their assistance later, while others may ignore you if you had made a similar request to a stranger.
Every unit would have a couple modifiers in the engine for behavior.
The main one is the groupindividual think modifier. For simplicity, we can just say that is a number from 1 to 99. This number can be added or reduced by certain outcomes from events the unit experiences. It does not change often.
We have the Group event modifier. This is something added to the groupindivdual modifier depending on the type of event. this is generated per event by the unit based on what the event is and personal modifiers listed below. This is float that represents a percentage, positive or negative of the groupindividual modifier that will temporarily be added or subtracted from that modifier for this event.
Our decision resolver is a random number generator that generates a number from 1 to 100. The groupindividual modifier then acts as an upper bounds, with any number falling within the range of 1-it results in the group response being used. If the number is outside of that range, the individual think response is used.
attributes:
aggressiveness
bravery
loyalty
greed
These are looked at by the group event modifier to change how likely it is a unit will respond with the group response as well as used to formulate an individual response. Loyalty is added, despite seemingly being redundant to the whole group thing, but this is in relation to loyalty to other particular units provided by a "friends list" each unit maintains. There are units that have personally helped the unit in some way. There is a similar list of foes that each unit maintains. These lists get cleaned out over time, as over a given period, their weight is reduced toward 0. Once it reaches 0, it is removed from the list. This removal is mitigated by continual interaction with a unit (refreshing the bond, both friend and foe).
What all of this does however, is simply provide a mechanism for choosing between 2 options, the group action or the individual action. These are simply a list of possible actions in themselves. Both pooled from the same selection of actions given by python scripts, but given different priorities.
The priorities are determined by either the individual's attributes or in the case of group think, the group's attributes. The unit will try to do the top priority first, but if met with sufficient resistance, move to another until it reaches the end of the list. Unless of course it succeeds.
Python actions allow one to script the behavior response of a unit in as much detail as one wants. Make an attack as complicated and skilled as you can or make it uncontrolled, leaving the details to the "instincts" of the unit.
Which brings me to instincts.
Instincts are actions hard-coded into the engine. These are what the units act on for the first few frames of physics simulation any important action has prior to a AI reaction is formulated. These consist of how to retreat, evasive maneuvering to avoid collision or weapon blasts, returning fire to neutralize a hostile, basic navigation. Instincts are used to fill in the details of python directives in a given action command. So how much of them gets used after the initial response time is up to the script. Instincts are basically self preservation determined, choices are made based on if it likely results in avoiding death and accomplishing a certain goal. (fly to the left of a unit, so long as unit isn't going to crash or still getting hit)
so a little pipeline would look like this ...
Code: Select all
campaign
|
/-> group think ->\
--> event -> response -> instinct --------------> action -> event and so on.
\-> individual think ->/
|
campaign
anyways, add your own ideas and such. off to job #2