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

Chapter 4
Sports Simulation —
Simple Soccer
D
esigning team sport AI, and particularly AI to play soccer, is not
easy. To create agents capable of playing a game anything like their
professional human counterparts takes a serious amount of hard work.
Many high-tech teams from notable universities around the world have
been competing in a robotic soccer tournament, Robocup, since the early
nineties. Although the ambitious goal of the tournament is to produce
robots capable of winning the World Cup by the year 2050 (I’m not kid-
ding), there is also a simulated soccer tournament running alongside the
robotic one, where teams of simulated soccer players compete on virtual
turf. Many of these teams use cutting-edge AI technology, much of it spe-
cially developed for soccer. If you were to attend a tournament, you would
hear, between the cheers and the groans, teams discussing the merits of
fuzzy-Q learning, the design of multi-agent coordination graphs, and situa-
tion-based strategic positioning.
Fortunately, as game programmers, we don’t have to concern ourselves
with all the detail of a properly simulated soccer environment. Our goal is
not to win the World Cup but to produce agents capable of playing soccer
well enough to provide an entertaining challenge to the game player. This
chapter will walk you through the creation of game agents capable of play
-
ing a simplified version of soccer — Simple Soccer — using only the skills
you’ve learned so far in this book.
My intention is not to demonstrate how every tactic and skill should be
modeled, but to show you how to design and implement a team sports AI
framework capable of supporting your own ideas. With this in mind, I’ve
kept the game environment and the rules for Simple Soccer, well… very
simple. I have also chosen to omit some obvious tactics. Partly because it
will reduce the complexity of the AI and therefore make it easier for you to
understand the flow of the state machine logic, but mainly because it will
give you the opportunity of consolidating the skills you have learned in a
proper, real-life, full-blown game AI project if you decide to tackle the
exercises at the end of this chapter.
133

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