Game Development Reference
In-Depth Information
Theoretically, 1/12 of our agents will be making a decision in any given frame. (We
can actually specifically enforce this balance if we like.) This allows us to process
more agents and still have a short enough reaction time to make our agents look and
feel like they are reacting in human-like time spans. We aren't really modeling re-
action time with this method, only taking advantage of the time that it gives us. The
possibility still exists, for example, that the decision would be processed in a single
frame.
We can make use of this time savings in other ways. If we use those extra frames
to process more information about the world in more depth , we can possibly con-
struct better behaviors. Using 12 frames rather than 1 to make a decision can be
rather freeing. Exactly how we would do this depends largely on the type of decision
we are making and the architecture we are using. Although an extended discussion
on these techniques is beyond the scope of this topic, some suggestions are multi-
threading and the well-documented techniques for spreading search algorithms
(such as A*) over multiple frames.
Polling for Changes
While we mentioned above that one of the inefficiencies of constant recalculation
is when the data hasn't changed much, there is the possibility that the data has not
changed at all from frame to frame. If the data that we are incorporating in the de-
cision has not changed, we are processing the same inputs only to repeatedly arrive
at the same decision. To avoid this problem, we first check to see if any of our inputs
have changed. If they have, we can then proceed with recalculating the decision. We
refer to this method of asking the world for information as polling .
Polling has serious drawbacks, however. To check if something has changed, we
have to remember what it was before. This means that an agent would have to re-
member the state of all of the inputs that it uses in all of its decisions. Multiply this
by multiple agents and the data demands can increase rapidly.
Continuously polling the world to see if an event has happened that would re-
quire a change in decisions is taxing to the processor. Imagine the simple act of an
agent determining if anyone in the local area has thrown a grenade that he would
need to react to. That seemingly simple test involves the following steps:
1. Determine enemies in range of agent.
2. Determine if agent has line of sight to enemies.
3. Check each visible enemy to see if they have thrown a grenade since the last
time we checked.
4. Determine if grenade will land close to us.
5. If necessary , process the reaction.
 
Search WWH ::




Custom Search