1 / 13

Group Behavior

Group Behavior. CIS 487/587 Bruce R. Maxim UM-Dearborn. Flocking. Emergent behavior that appears complex and purposeful, but is really derived from simple rules followed blindly by the agents Composed out of three group behaviors Cohesion (steering toward neighbors’ center of mass)

kata
Download Presentation

Group Behavior

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Group Behavior CIS 487/587 Bruce R. Maxim UM-Dearborn

  2. Flocking • Emergent behavior that appears complex and purposeful, but is really derived from simple rules followed blindly by the agents • Composed out of three group behaviors • Cohesion (steering toward neighbors’ center of mass) • Separation (creates force that steers away from neighbors) • Alignment (keeps agent heading in the same direction as neighbors)

  3. Combining Steering Behavior • In an FPS you might want a bot that combines path following, separation, and wall avoidance • In an RTS you might want a group of bots to flock together while wandering, avoiding obstacles, and evading enemies

  4. Slides based on theCode from Advanced 3DGame Programmingby Kenneth Finney

  5. Group Behavior Rules • Members of a group should not bump into one another (collision avoidance) • Each group member should try to maintain its position relative to the center of the group (swarm centering) • Each member of the group should attempt to match its velocity with the average velocity of the other members (velocity matching)

  6. AIDropPoints • Execute the fps.starter demo and open the World Creator Interface • On lower right side, drill down and click on MissionObjects/System/SimGroup • Call the object AIDropPoints and switch to the World Editor Inspector (F3) • Make AIDropPoints an instant group using the Alt key and left mouse button

  7. Swarm • Switch to the World Creator (F4) • On lower right side, drill down and click on MissionObjects/System/SimGroup • Call the object Swarm and switch to the World Editor Inspector (F3) • Make Swarm an instant group using the Alt key and left mouse button

  8. SpawnSphere - 1 • Exit the Mission Editor (F11) and enter camera fly mode (F8) • Find a good location for an swarm and place it 20 feet off the terrain • Switch back to the Mission Editor (F11) and enter World Creator (F4) • Drill down to Shapes/Misc on lower right and click on SpawnSphereMarker • Place at least two more in the world

  9. SpawnSphere - 2 • Switch to World Editor Inspector (F3) • Select all 3 SpawnSpheres in upper left (Ctrl and left mouse click) • Click on expand all • Changes the radius field to 10 and press Apply button • Save the mission and exit to the desktop

  10. Code Modifications • Add this line to the server\script\game.cs function onServerCreated and disable the aiGuard code exec(“./swarm.cs”); // exec(“./aiGuard.cs”); • At the end of the same game.cs file add this line to start the bot placement process Schedule(3000, 0, “CreateBots”); • Save game.cs and copy the file swarm.cs to the server\script folder

  11. Test Swarm • Run the test application again. • Open the console and type InitSwarm( ); • To add some more bots to the swarm type SpawnASwarm( ); • Close the console window and watch them go

  12. Chasing Swarm • Replace the SwarmBotDB::DoScan function in the file swarm.cs • Add the code for functions AIPlayer::FindLeader AIPLayer::GetClosestHuman • Save the file and get ready to test the new behavior

  13. Test Chasing Swarm • Run the test application again. • Open the console and type InitSwarm( ); • To add some more bots to the swarm type SpawnASwarm( ); • Close the console window and watch them go • See how close (or far away) to get swarm to chase the player avatar

More Related