Simulating sentient agents
Kevin Galloway
CS 480
One important consideration when it comes to graphical simulations is the
idea of intelligent thought. Particle engines, for example, have been used
to simulate crowds that flee from giant monsters as well as to simulate
traffic. One thing these two things have in common is human thought, people
don't just flee in straight lines, or bounce off of each like pinballs.
A Framework for Sentient Agents
One way to solve this problem is to create a framework for simulating
sentient behavior. Each timestep one would pass parameters of a thing
(person, robot, Godzilla) into a rules engine that would decide on how
that thing would move, that is, based on a creature's knowledge, it will
react. If Godzilla sees the puny tank in front of it, he will crush it,
but if he sees Mothra and Super Mechagodzilla, he might flee. This
framework will be composed like so:
Population Generator -> Rule engine -> Visualizer
Population Generator
The population generator is one of the most important parts of this
framework. This will create your objects, and give each parameters that
will make them all similar, but still different. For example, your
population generator might create people that are trapped in a building.
Your class might look as follows:
Class Person{
int age;
int speed;
int aggression;
vec3 position;
float vision_range;
};
The population generator will fill these with random, but sensible values,
so there will be no negative ages, nor ages above, say 100. These values
will be placed into the rule engine.
Rule Engine
The Rule Engine has several different components to it, that simulate a
variety of actions that a sentient agent can do. It is composed of a sensor
, decision rules, and actuators. The sensor is how each sentient agent
"sees" its world. One can have an agent have a ray that is cast ahead of
them, and returns true if it hits something. Alternatively, one can just
simply check to see if anything is near or collides with it.
The sensor is incredibly important, as it makes each agent have an
imperfect view of the world, so it does not know everying about the
environment.
Decision rules are what happens if an agent sees something. This operates
on a variety of factors: What does the agent see? Does it have any internal
attributes (importance, aggression, tension) that it responds to? So if
you have a person encounter Godzilla and he's very aggressive and angry, he
might choose to attack, whereas someone not aggressive would flee.
Another portion of the Rule engine is the Global Database. This holds the
information about every individual, and the environment. This is so a
general feel of the crowd (the total crowd's tension or reaction for example
) can be used to modify an individual's behavior. One person fleeing from
Godzilla our aggressive hero could ignore, 30 or 40 terrified people, and
our hero might reconsider his attack.
Combining all of these is what creates the rules engine. Each agent steps
through an iterative process: ask for a decision, get immediate environment
(that is tension level/crowd density/immediate dangers), check for rules.
These rules are all based on what independent attributes each agent has.
The Visualizer
To be honest, there isn't a lot to talk about the visualizer. This could be
anything from points on a polygon, to an incredibly well rendered 3d game.
Really, the sky's the limit here.
Pitfalls:
One thing that must be considered when doing a simulation of sentient
agents is that all actions for every agent must be done "simultaneously".
This does not mean that to do this, one must have parallel algorithms, but
that all movements have to happen at the same time, followed by the rule
engine. If one tries to couple movement and rules, then agents could be
acting on incorrect data.
Designating the environment is incredibly important for this sort of
simulation as well. If agents are operating on a faulty "understanding" of
the world, then weird things can happen, such as walking through walls, if
for example, an agent's speed is larger than the width of a wall.
Links:
http://eil.stanford.edu/egress/publications/ICCCB_paper.pdf
http://pdcc.ntu.edu.sg/dsgrid06/doc/0064_cao-trafficsimulation.pdf
Repast Symphony is a Java agent simulation framework and handy GUI.