Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Unit-Groups: Shared memory for units

By itself a single unit has only limited usefulness for experiments. In practice we may want many units to share a view of the world, or to cooperate in building a map or pathing through the world. Unit groups are the best mechanism for such needs.

If a unit is part of a unit group, the simulation will ask the unit group to make a move on behalf of each unit in that group. Usually the simulation will do some pre-processing on that request, and then ask the unit which move it would like to make, returning the result to the simulation.

An example would be a group of units that build a map together SharedAMapGroup. In this example the unit group is responsible for building a localized unit view of the world based on the global view provided by the simulation. So, each time a unit moves, the SharedAMapGroup first intervenes to see if the unit has explored any new territory, and if it has, it updates the local (partially complete) map in the unitGroup. Then, the unitGroup tells the unit to move, passing itself as a map provider.

For each step in the unit simulation, a unit group has the chance to do its own processing via the think function.

Prev: Units Next: Simulations


Generated on Tue Aug 18 03:46:10 2009 for HOG by doxygen 1.3.4