TribesCurrent IssuesToday we have fixed spawn points for NPCs and some simple paths used to move the NPCs around. Let’s analyze the issues of this approach:
Goals of the Tribes systemThe main goal of the new system is to solve the above issues and in particular:
The goal of this system is to provide a basis of realistic behaviour for NPCs based on daily tasks assigned to it by the tribal object yet still retain the individuality of its race or type. The communication must be two-way, members can send requests or information to the tribal object for help or if they suspect an invasion for example. So for example, a tribe could consist of both humans and krans, the tribal object assigning the krans the task of patrolling and defence while the humans act as resource gatherers and explorers. The tribal object has a set of needs similar to every normal NPC but acts on them in a more dynamic manner and NPCs should be able to alter their own behaviours and adapt them to the situation. Building blocksTo have our goals achieved we need a number of building blocks, listed below.A) NPC movementTo bring the NPCs to life they should have a basic set of actions available at their disposal. Actions will be managed by AI objects or simple triggers depending on occasions.NPCs should be able to:
B) Natural ResourcesNatural resources are a critical part of the evolution of a tribe. This is the list of what must be available to dig, harvest, search :
C) The Tribe and the individual ObjectsAll individuals belonging to a tribe will be managed by an instance of an object called the “Tribal Object”. The tribal object evaluates the circumstances and conditions of the tribe and thus identifies a goal to realise its need. It then sends suggestions to every member it is aware of to update their actions. In this way, the tribal object reflects the long-term needs and goals of the tribe in each of the members goals and objects. The matching of goals to members controlled by the tribal object enables each member to be assigned a different overarching task while still retaining its individuality through its own scripts. Our tribal behaviour aims to follow these rules:
Implementation detailTribe TypesThe PALSAO should be aware of the type of tribe he is managing, because not all tribes will have the same goals, and the same possibilities. For example a tribe of “hydlaa city guards” will have no plans of expansion, no need for new resources, and they will reproduce just by having a new rookie guard sent by the central command. A gobble tribe will have need to consider food resources, to reproduce, explore and expand creating new villages. The Evolution of the tribeApart from the events that will change the course of actions of the tribe (e.g.: players attacking or a plague spreading), the tribal object should have a predefined evolution path, that will guide actions if nothing special happens. Based on the tribe intelligence, it may seek only food and peace, or also expansion and money, it can seek other villages to attack, and decide to build and research better buildings. The standard path should take into account the “Tribe Type” described above and usually go toward expansion of territory, wealth and members number.PathsWe already have a number of predefined paths used to move NPCs around our world. It’s important that the EDLO identifies those paths and use them to seek places where the NPC can fulfill its objectives. For example we have a path to go to work, another to go to rest, we will have some to go outside the city where the NPC can start seeking new resources to dig. We have to define which attributes each path has, so that all EDLOs in game can use the paths present. There will be some paths specific of an NPC, like the road that goes from blacksmith shop to the house of Harnquist (used only by harnquist), and paths that can be commonly used by all NPCs, like the path that brings from hydlaa plaza to the Kada-El tavern.Adaptive Tribal BehaviourThe tribal object holds an incomplete view of the world in terms of its resources but knows the precise location of all its members to allow planning to be significantly simplified. It will hold a set of needs and perceptions, perceptions are triggered by communication from its members or from the environment. During everyday operation, the object distributes tasks in proportion to the status of its needs during that day. During an exceptional operation, such as an enemy stealing all of its food stocks, the need the exception corresponds to is raised to a critical level.At this stage the object utilises a partial order planner not only to fulfil its objective but to allow behaviour to vary in an unpredictable fashion. The planner is passed the initial state of the tribe and aims to get to a goal state where all of its needs are satisfactorily fulfilled. It has access to a tribal rulebase, tailored to each tribe that contains a set of rules. Each rule has a precondition that must exist for the rule to be run and an effect which is what the effect of running that rule will be. For example, a tribe of humans have experienced a heavy attack by an enemy where most of its members have been wiped out their states are both: Food = 1.0 Population = 0.1 Security = 0.01 Money = 0.1 The following set of actions is planned from the human rulebase: Time 0: Precondition: None Action: Order members to chop wood Effect: Wood +0.2 Time 1: Precondition: Wood > 1.0 Action: Order members to sell wood Effect: Money +0.1 Time 1: Precondition: Food < 2.0 Action: Buy food Effect: Food +1.0 Money -1.0 Time 2: Precondition: Food > 2.5 Action: Reproduce Effect: Population +1.0 Food -1.0 So by 3 days after the attack the humans will be back to their full population. This can be viewed as a series of actions and their associated transformations but is structured in a way that behaviour can be significantly altered through altering or adding a few rules. So for the Ynnwn the action to obtain wood might be to raid and plunder a neighbouring village. As we gradually add more capabilities to tribes it would be very easy to add further rules to the rulebase and the tribe’s behaviour able to adapt quickly as a result. If at any stage things don’t go according to plan, the tribal object would also be able to easily create a new plan that suits new circumstances but will still have a solid idea of what it wants to achieve. Rules can also be shrunk down to menial tasks for precise control for example getting three members together to build a bridge across a river to reach a new area. Individual members will contribute to the needs of a group and can communicate basic information to it such as sightings of enemies or resources. Dynamic ScriptingAnother element of tribal behaviour is adaptability to tactics and strategies enforced by players. For now, only short-term combat is considered in which a tribal member skilled in a variety of melee techniques and spells comes up against an aggressor. Dynamic scripting, in essence creates a combat script from rules in the rulebase each of which has a weight assigned and a set of conditions to execute.Each set of weights is unique to each type of aggressor, so there would be one set that a npc uses against a Ynnwn fighter and one against a Enki spellcaster. After each encounter the weights of the rules can then be adjusted according to the effectiveness it had in combat. In this way, the NPC would gradually adapt its tactics against the player’s, which is absolutely required for a challenging NPC in a spell-casting environment. These are just my initial thoughts on this… ConclusionThrough the main technologies of partial order planning and dynamic scripting I believe NPCs will be able to behave significantly more realistic than before with a minimum amount of new code and scripts. The whole system will be tailored exactly to the rules that are set up which will govern the rate of change of needs as well. From my research, these techniques have never been used in a massively-multiplayer game before and it will definitely be interesting seeing them work on such a scale.References Artificial Intelligence in Games (2002): http://www.cs.rochester.edu/u/brown/242/assts/termprojs/games.pdf Adaptive Game AI (2005) http://www.cs.unimaas.nl/p.spronck/Pubs/ThesisSpronck.pdf Machine Learning in Computer Games (2004) http://www.cse.lehigh.edu/~munoz/CSE497/classes/LearningMarc.ppt |