Sports Games AI

  • View

  • Download

Embed Size (px)


Sports Games AI. CSE 348 Daniel Phillips Dan Ruthrauff. Intro. Video game AI primarily focuses on RTS and FPS genres Sports games offer unique challenges Meeting player's expectations Minimizing cheating Larger scale coordination. Traditional Sports Games. Object-oriented architecture - PowerPoint PPT Presentation

Text of Sports Games AI

Sports Games AI

Sports Games AICSE 348

Daniel PhillipsDan RuthrauffIntroVideo game AI primarily focuses on RTS and FPS genres

Sports games offer unique challenges Meeting player's expectationsMinimizing cheatingLarger scale coordination

Traditional Sports GamesObject-oriented architecture

Set number of players and a ballCreate teams and behave within a set of rules

Players have predetermined behaviorsDistinct starting and ending points, with clear transitions between behaviors

Traditional Sports GamesEntirely event drivenNo need for complex pathfinding etc.

Every traditional sport has a "starting event"Baseball = Ball HitFootball = SnapHockey = Puck Dropped

For these reasons, AI can be controlled by Finite-State Machines and Transition Tables

BaseballGood study in AIBased on percentages, risks, and expected behavior

Divided into three areas:FieldingBaserunningBatting / PitchingBaserunningMapped into more complex behaviorsGo - head to next baseGo Back - complement of GoWatch - wait for conditions to be metFreeze - Stop movingGo Halfway - Default assumption for fly ballTurn and Go - Round the base and continue to nextTurn and Look - Round the base but don't GoOnly two basic behaviorsRunning or not running

FieldingBehaviors triggered by one of two events:Ball HitBall FieldedOn Ball Hit, players are assigned one of four behaviors based on ball's trajectoryField BallCover BaseCutoffBackupSeems simple, but fielding is more complicated to implement than baserunningFieldingOn Ball Fielded EventPlayers without the ball naturally transition to other behaviors if neededPlayer with the ball decides what to do with itex - Throw Ball or Run With BallInitial Behavior Assignment - FieldersBall's flight is 100% predetermined Only need the initial velocity vectorCalculate hit type and zone based on the flight pathMap a set of behaviors to each hit type and zone pairThe rules get each teammate working towards a common goalHow the rules are implemented determines how "smart" the AI appearsCheatingDefined as giving the agents access to information that would be unavailable to the player in the same situationex - Madden knowing your plays

Can also apply to when the computer follows different "rules" than the playerex - Unlimited boost in racing gamesDoes not apply to computer's inherent advantages Cheating AI in Fifa. Player = red, CPU = whiteCheatingCommon in older games, but is generally discouraged now and recent advances in AI attempt to minimize cheating

Some degree of cheating can be acceptable if it's not painfully obvious to the playerObvious cheating = bad reviews!"0/10 WOULD NOT PLAY"Rubber Band AIThe more you're winning at a game, the harder the game gets to maintain a challengeAccomplished most often in sports AI by cheating to catch upComputer controls the outcome of "random" eventsFIFAComputer violates rules that user must followNBA JamMost common in racing gamesLosing cars get a speed boostWinning cars get a penaltyRubber Band AI Example VideoRubber Band AI example codeHistory of AI in MaddenOriginal Madden - Madden '93Predictable and limited play callingMadden '95Play calling overhauled and now mimicked actual decisions made in the NFLMadden '96Introduction of multiple skill levels

Passing and running still highly unbalancedPoor defensive AI made it easy to passPoor offensive blocking AI made it difficult to runHistory of AI in MaddenMadden '97Running issue resolved, but AI still lackingPossible to win by only using one or two playsMadden '98Defense now counters the same play if it is called multiple times in a rowMadden '99Huge improvement in defensive AIFans of the series complained the AI was "too good"Madden '00Customizable AIMost significant update out of any Madden releaseCheating in MaddenUnexplainable comebacks in 4th quarterFumble when taking a knee to run the clockComputer opponent breaking five or more tackles for the game winning touchdownBad luck or forced events?No good way to prove either argumentHighly debated until producers of Madden debunked the claims of "comeback cheating"More aggressive play callingControversy surrounding this demonstrates the importance of fair AI to the playersCheating in MaddenOne undeniable method of cheating is Madden's "quick and dirty" difficulty levelsHarder difficulties increase the computer player's physical attributes while decreasing the user's attributes

Generally players would rather be defeated by a smarter AI at higher difficulties than a physically superior teamCheating in MaddenOfficial response from EA Sports concerning Madden's difficulty mechanicsIncreases CPU's reaction time, awareness, and frequency of recalculating factorsAdmit to increasing the CPU team's attributes

EA claims that "even NFL players feel the game provides an excellent approximation of reality"InnovationsChange individual aspects of the game's AI by adjusting slidersDesign a playing experience that they enjoy

Cheating is easier to detect in sports games, so developers were forced to build strong AI with minimal cheating

Put the AI at the center of developmentListen to the users' feedbackArtificial Intelligence in Racing GamesThe first racing game was Gran Trak 10 for the Atari

Player races alone against the clock

No AIArtificial Intelligence in Racing GamesThe first racing game with AI was Super Speed Race

Scrolling graphics

The AI was very simplisticPole PositionFirst realistic racing game

AI opponents that raced against the playerPole Position used Spline to control computer racers.

The opponent follows a preset line and only deviates from the path to passThis preset line is hard coded by developers

This leads to predictable and formulaic behavior

Video ExampleSplineSuper Mario KartFirst game to implement dynamic AI behavior into the genre

AI racers had to navigate complex tracks and pick up powerups

Used path following and obstacle avoidance to create lifelike, competitive opponents

Video ExamplePath FollowingPath following allows the AI to follow a series of preset nodes

Path following navigates to each node by using the steer method seek (this will be explained in a few slides)

Path following allows for dynamic changes to the pathA racer may see a powerup and decide to go out of their way to get it instead of following the track.Creates fluid movementVideo Example

Obstacle AvoidanceAI racers alter their direction if an obstacle is blocking their path

The first step is finding out if an obstacle will be in the way if the racer continues on its current trajectory

If there are multiple objects in the racers path, the closest object will take precedence and corrective steering will be appliedObstacle AvoidanceIn this figure we see three obstacles: A, B, and CWe can easily see that the racer will collide with both B and C if left on its current pathBecause obstacle B is closest, corrective steering is applied to the left to avoid itObstacle AvoidanceFinding the amount to correctively steer is a multi step processFirst we must compute the amount of time it is going to take with the current velocity to reach the obstacleThen we must decide how much we wish to avoid the obstacle byOnce we know these two values, we can determine a point in space to navigate to

This point can then be navigated using a basic steering method called SeekHow Seek WorksSeek allows a racer to steer and reach a point

desired_velocity = normalize (position target) * speedsteering_amount = desired_velocity current_velocityColin Macrae Rally

Released in 2001, this Colin Macrae Rally (later known as Dirt) was the first racing game to use machine learning to develop AI behavior

Previous racing games implemented sets of rules and techniques to control racers like the previous discussed splines, path following, and obstacle avoidanceColin Macrae RallyBecause Dirt featured racing on complex terrain (such as muddy roads, gravel, and other slippery surfaces), the AI designer found it difficult to implement standard car control techniques

Video ExampleColin Macrae RallyHe decided to try a neural network to model the behavior of the car

The final result was a feed forward multilayer perceptron

Colin Macrae Rally

The inputs were various values that described the cars movement, direction, position, and track terrain

The outputs were various values that determined how well the car was following the trackColin Macrae Rally

The Neural Network was successfully able to design the behavior of the racer despite the complex terrain

Video Example

Problems with Machine Learning in Racing Games

The computer learns too well leading to perfect racing

Racing maneuvers such as overtaking and accident recovery are hard to implement with this strategyForza MotorsportTook machine learning in the racing genre to the next level with DrivatarDeveloped by Microsofts advanced AI Research team in Cambridge, England

AI behavior is trained by humansLeads to very realistic racing behaviorDrivatarUses a neural networkThe training sets for the neural network are created by actual people controlling the cars

Drivatar allows the AI to learn not only car movement behavior, but also race strategies

Drivatar succeeds where Dirts neural network failed

Unfortunately, the nitty gritty details of Drivatar are kept a secret as the algorithm is still being used in current versions of ForzaWhat we do know about DrivatarSplits racing behavior into three categoriesTurning ControlSpeed ControlRacing Strategy

Each training lesson teaches the computer a different category

Video of Drivatar Turn Training

Commentary AI in Sports