The WildLife simulation framework

advertisement
Multi­Agent Simulation, Federico Pecora HT­08
The WildLife simulation framework
The exercises listed below are aimed at exploring some fundamental properties of multi­agent simulation where agents implement non­trivial behaviors based on fuzzy rules. The framework employed is WildLife, a framework (implemented in C++/Ogre3D) for simulating animal behavior based on fuzzy rules. They are understood as an exercise proposal and can be of course modified or extended or you can invent new exercises if you want.
WildLife is a 3D simulation framework specifically designed for the Multi­Agent Simulation course. It provides a software framework for developing multi­agent animal simulations. In this lab we will be creating new types of animals with specific behaviors.
All animals in WildLife live in a virtual world composed of a 3D landscape with trees, water and grass. Animals tend to avoid water, and it is possible to specify other ”prohibited” regions of the landscape.
In its current implementation, WildLife contains agents which are either zebras or lions. Zebras have three simple behaviors: flocking, avoiding lions and avoiding the border of the world. Similarly, lions wander around (without flocking) and eat zebras when they are close Multi­Agent Simulation, Federico Pecora HT­08
enough to them. When a zebra senses a lion close to it, it accelerates, as does the lion when it sees a zebra close to it. Preparation – Get and compile WildLife
Copy WildLife from N:\WildLife onto your desktop and open the project file WildLife.sln solution file. In order to compile, Visual Studio requires the include and library paths to Ogre3D and CEGUI. Open Tools → Options → Projects and Solutions → VC++ Directories, and select Include files in the pull­down menu to the top right. Include all directories (recursively) under N:\OgreSDK\include. Now select Library files from the pull­down, and add all directories recursively under N:\OgreSDK\lib. Finally, in order to run, WildLife requires the Ogre3D DLLs, which are located in N:\OgreSDK\bin\release and N:\OgreSDK\bin\debug. Write these two paths in an environment variable called PATH (create it from Advanced system properties, right clicking ”My Computer”).
Now you are ready to build the solution. Once the build is done, copy all filed produced (located in the release or debug directories in your project directory) into WorkingDir\release (or WorkingDir\debug). Now run WildLife.exe, this should pop up the main user interface.
Preparation – Controls
In WildLife you can move around the virtual world with the keys w/s (forward/backwards), a/
d (pan left/right). The mouse can be in two modes: by default, it is used to give direction to forward movement; if right­clicked, the mouse becomes a pointer which can be used to select animals. When an animal is selected, you will see a small window with information on that animal. The F1, F2 and F3 keys can be used to toggle, respectively, default view, fixed animal following view, and perspective animal view. At any moment, the simulation can be paused by pressing p.
Preparation – Configuration
The file ProgramSettings.cfg contains self­explanatory run­time parameters for WildLife, including the number of lions and zebras to be used for the simulation. The file resources.cfg contains paths to the animal­specific geometry files used in the simulation, and should be modified when adding new animals with new geometries.
Exercise 1 – Getting acquainted with the software
a) Roam around the environment and notice at notice the zebras' flocking behavior. Try to increase the number of zebras. Notice that animals do not avoid trees and often run into other animals. Also notice that lions pause after eating a zebra, and that zebras accelerate when a lion is close. Try to relate the observed behavior with the behavioral and perceptual model implemented in Zebra.cpp.
Exercise 2 – More aggressive lions
Enhance the lion so it:
a) approaches zebras faster;
b) only hunts zebras when it is hungry;
Multi­Agent Simulation, Federico Pecora HT­08
c) once selected a zebra to chase, maintains it as a target rather than always switching to the closest one;
d) gets tired and drops the chase after chasing a zebra for a long period of time.
Exercise 3 – More realistic zebras
Enhance the zebra so it:
a) eats grass when it becomes hungry;
b) runs faster when it has had enough to eat.
Exercise 4 – Ceating new types of zebras
A new breed of zebras suddenly appears in the WildLife world, CrazyZebras. Create this new kind of zebra as a copy of the type Zebra. To distinguish the type CrazyZebra from the type Zebra, use the geometry provided in N:\CrazyZebra: copy the folder to WorkingDir\Media\animals; modify the resources.cfg file accordingly, include the option NrOfCrazyZebras in the ProgramSettings.cfg file (and modify AnimalSim.cpp accordingly). Also, remember you have to register the CrazyZebra type in AnimalFactory.cpp.
Implement the following behaviors in your new CrazyZebra type:
a) Sometimes CrazyZebras become suicidal, and instead of escaping from lions, they actively go towards them to be eaten.
b) CrazyZebras do not mix with other zebras, they only like their kind. Thus they tend to avoid other zebras and flock only amongst themselves.
Multi­Agent Simulation, Federico Pecora HT­08
Exercise 5 – Infection!
All CrazyZebras carry a disease of which they themselves do not die, but which can infect other animals. Specifically:
a) Lions that eat CrazyZebras become affected by the disease and die immediately.
b) Normal zebras that are in the vicinity of CrazyZebras become infected. In turn, they can infect other normal zebras. A healthy zebra becomes infected only with a certain probability, which is proportional to the concentration CrazyZebras or infected normal zebras in the vicinity of the healthy zebra.
c) Infected normal zebras die of this disease after a while, but lions that eat infected normal zebras are unaffected.
Download