Harmony Among Species...?
What made Chroma Trondheim an interesting world to implement was its variety of inhabitants and the fact that all these creatures needed to interact with each other as well as the player. This was a challenging task.
To implement basic interaction between creatures and to give creatures some situational awareness, I wrote standardized routines which gave each creature the following capabilities:
+ Each creature has a list of allies. If it is attacked, it will try to call for help from any allies within its range.
+ A creature can have a "Focus Object", something that the creature is tracking intently. The focus object can be friend or foe, or just a position vector. This focus object system can be useful for things like following, flocking, and attacking.
+ Through a global death-aware system, each creature also knows when another has died in order to do internal housekeeping on its friend and foe lists and focus objects.
+ If a creature is attacked or otherwise provoked, the attacker becomes the creature's hostile focus object and a fight ensues. If hit, the creature calls for help using its allies list.
+ A creature's reaction to being called for help can be specified. Will this creature go help his brethren, run away, or sit back and sneer at his fellow creature's misfortune?
+ A creature's reaction to friendly fire can be adjusted. Will this creature get angry if one of his buddies accidentally whacks him while attacking someone else?
+ Level of hostility: Is the creature hostile to its focus object right away, or does it not attack unless attacked?
With the simple mechanisms above, I was able to populate levels quickly with intelligent creature who knew how to deal with one another, and on top of the basic behaviors define more specific AI if necessary.
|