Project 7: Opponents
Reference for this project:
Chapter 8
- Save the pieces of the project so you can later demonstrate
each one
- Make a directory ~/video/project7 in your home directory
Basic AI: aiDumbBiped01
- In
game design, the algorithms underlying
intelligent behavior are referred to as AI, or Artificial Intelligence.
The aiDumbBiped01.wdl script provides basic animation of models,
enabling characters other than the player to move about in a game.
- Copy one of the levels from a previous project to the project7
directory, and use it for the current project.
- Then, place a player model and add the behavior
script plBiped01.mdl by right-clicking the model.
- Add a third-person camera.
- Build and run the game to check for errors.
- Next, add a second model to the level, such as hero.mdl and place
the new model directly in front of the player, away from any walls, and
facing away, as illustrated below.

Figure
1. A player plus opponent.
- Add the AI script aiDumbBiped01.wdl to the game
- Add the behavior aiDumbBiped01 to the opponent
- Then, build and run the game.
- When the game first runs, the new character should run away from
the player. However, the player will probably stop after hitting
the first obstruction (due to some script bugs? in current version)
<>- Make a new copy of the aiDumbBiped.mdl (from the
template_6/code subdirectory of 3D GameStudio), and place the copy in
the directory of the game.
- Rename the copy aiDumbtw.wdl, and avoid using a long file name
since this may cause errors in the game.
- Open the new aiDumbtw.wdl script file in SED, and edit as
described in Chapter 8, including lines as below:
ifndef aiDumbtw_wdl;
define aiDumbtw_wdl;
- Further down in the file,
else
{
// scale rotation and linear input by the force modifiers
//aiDumbBiped01_ang_force_vec.pan = 0;
aiDumbBiped01_ang_force_vec.pan =
my._max_ang_force_pan__003; //tw
aiDumbBiped01_ang_force_vec.tilt = 0;
aiDumbBiped01_ang_force_vec.roll = 0;
aiDumbBiped01_force_vec.x = my._max_force_x__003;
//aiDumbBiped01_force_vec.y = 0;
aiDumbBiped01_force_vec.y = my._max_force_y__003;
//tw
//aiDumbBiped01_force_vec.y = 0;
aiDumbBiped01_force_vec.z = 0;
}
- Near the bottom of the aiDumbtw.wdl file, rename the action
AiDumbtw.
- Hopefully the opponent will reun around the level, and slide
along walls
- Once the game is running properly, experiment with different
settings for the AI model.
Randomizing aiDumbBiped01
- Even more erratic behavior can be created with some
randomization.
- As described in Chapter 8, add code
if( random(10) > 7.9 )
//randomization
{
aiDumbBiped01_ang_force_vec.pan =110;
} //end tpw
- Rebuild and run the program.
- The model should exhibit fairly random behavior.
- Experiment with other randomizations
FPS AI: aiFPS01
- Add a Spider model as an opponent (download
from Conitec
http://coniroot.de/~pirvu/au/models/zipped/Spider.zip )
- Add the aiFPS01.wdl script
- Change to a first-person camera
- Add the AIFPS01_Guard behavior to the spider
- Rebuild and run the game
- You should have spiders
chasing the player as below (after walking near the spiders)
Figure
2. Spiders.
FPS AI: Path Following
- The random movements of the preceding section may be fine for
some games, but often it is desirable to have characters follow defined
paths.
- Add a path for one of the spiders to follow as shown below
Figure
3. Path added for path-following spider.
- Add the path number ot the propertirs of the AIFPS01_Guard
behavior of the spider. Remove any other opponents from the game.
- Rebuild and run the game.
Report and demonstration:
- Prepare a 10-page report exactly in the following format;
- Cover sheet with names
- 1 Page summary of project
- 1 Page Printout
as in Figure 1 above.
- 1 Page Printout
as in Figure 2 above.
- 1 Page Printout
as in Figure 3 above.
- Q1 No questions for this lab....
- Q2 above
- Q3 above
- Q4 above
- Q5 above
- Q6 above
- Q7 above
- Q8 above
- Q9 above
- Q10 above
- Demonstration: Show your
- DumbBiped game
- Spider Game
Copyright © 2005 by Thomas Paul Weldon
ACKNEX,
WED, MED, and 3D GameStudio are trademarks of Conitec Corporation.
Microsoft, DOS, MS-Dos, Windows, DirectX,
Halo, and
Direct3D are trademarks of Microsoft, Inc.
PAC-MAN trademarks or registered trademarks of Namco Limited
Nintendo, Mario, are trademarks of Nintendo
Atari, Pong, are trademarks of Atari
Intel, 8086, are trademarks of Intel Corporation
id, DOOM, and Quake are trademarks or registered trademarks of Id
Software, Inc.
Autodesk, 3D Studio, and 3ds Max are trademarks or registered
trademarks of Autodesk, Inc.
Alias and Maya are trademarks or registered trademarks of Alias Systems
Corp.