O'Reilly logo

Programming Game AI by Example by Mat Buckland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Ü
NOTE For this book, I chose to aggregate the Regulator instances in the
Raven_Bot class because it makes their use more explicit. You may prefer for
the objects requiring regulation to instantiate their own instances and use them
to control the flow of logic in the appropriate method (usually their
Update
method).
Summing Up
This chapter has provided an overview of the design of AI for agents capa
-
ble of playing a deathmatch type game. Although your understanding is
still incomplete, you have seen how an agent’s AI can be decomposed into
several small, easily managed components, which are capable of communi
-
cating and working together to form a unified behavior. The remaining
chapters will provide the plaster to plug the gaps in your knowledge.
Practice Makes Perfect
1. So far, Raven bots can only sense opponents they see or hear. How-
ever, they are still unable to feel the terrible burning and ripping
sensation of a steel bullet casing tearing through their flesh. Write
code to update their sensory system so that a bot is able to sense when
it is being shot at. Create another field in the
MemoryRecord structure to
record the amount of damage each opponent has inflicted in the last
few seconds. This value could be used as part of the target selection
criterion.
2. Try out different target selection criteria. Observe how they affect the
gameplay. Change the code so that each bot uses a unique criterion
and play them off against each other to see which one performs best.
Raven: An Overview | 331
Summing Up
This page intentionally left blank.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required