Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 487/587 Bruce R. Maxim UM-Dearborn

Similar presentations


Presentation on theme: "CIS 487/587 Bruce R. Maxim UM-Dearborn"— Presentation transcript:

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

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) 12/4/2018

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 12/4/2018

4 Slides based on the Code from Advanced 3D Game Programming by Kenneth Finney
12/4/2018

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) 12/4/2018

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 12/4/2018

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 12/4/2018

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 12/4/2018

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 12/4/2018

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 12/4/2018

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/4/2018

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 12/4/2018

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 12/4/2018


Download ppt "CIS 487/587 Bruce R. Maxim UM-Dearborn"

Similar presentations


Ads by Google