1 / 22

Building a Sports AI Architecture

Building a Sports AI Architecture. Ushhan D. Gundevia November 8, 2004. Terry Wellmann. He has been programming since 1983 Responsible for architecting and writing AI for Microsoft’s NBA Inside Drive franchise He was also the lead programmer on All-Star Baseball for N64

howell
Download Presentation

Building a Sports AI Architecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building a Sports AI Architecture Ushhan D. Gundevia November 8, 2004

  2. Terry Wellmann • He has been programming since 1983 • Responsible for architecting and writing AI for Microsoft’s NBA Inside Drive franchise • He was also the lead programmer on All-Star Baseball for N64 • Has a Computer Science Degree from Purdue terry.wellmann@high-voltage.com

  3. If you would like to know more • http://xbox.ign.com/articles/372/372418p1.html • http://www.mobygames.com/developer/sheet/view/by_genre/developerId,126714/

  4. Challenges • Real teams spend countless hours practicing together – Why? • To improve an individuals skills and abilities • To train a group of independently thinking individuals to instinctively react to a situation in a manner predictable by other teammates • To stimulate cohesive group decision making in a game is difficult

  5. Things to keep in mind • Keep it simple • Break down decisions into various levels • Spend time on planning • Don’t be afraid to make mistakes • Do not underestimate the power of Randomness

  6. Agent Plans • Examples of Offensive, Defensive and Shared plans • Pass • Shoot • Drive to basket • Run the play • Rescue a trapped ball handler • …

  7. Pseudo code for Agent Plan Class AgentPlan { … float EvaluateInitiation(); float EvaluateContinuation(); void Initiate(); void Update(); … }

  8. Why float? • The EvaluateInitiation and Evaluate-Continuation functions return float values • Always building complex systems, with several plans compared to determine which one is used • Each plan is a building block in a complex system • Each plan individually evaluates the current situation to determine its feasibility • Returns a value between -1.0 and 1.0 • Execute plans if value > 0 • To strongly encourage a plan, return a value > 1

  9. Team Management • Its implemented using a FSM • Each state encapsulates a different goal and a set of responsibilities • Basketball can be assumed to have 3 kinds of states • Offensive States • Defensive States • Common States

  10. Offensive and Defensive States • They mirror each other • Responsible for all aspects of the game play that the user can interact with. • They are ? • Inbound • Transition • Frontcourt • Rebound • Recover Loose Ball • Free Throw

  11. Common States • Neutral situations when the ball is not in play and neither team is in offense or defense • They are ? • Pre-game • Tip-off • Time-out • Quarter Break • Substitution • Post Game

  12. State Transition and Flows

  13. Pseudo Code - Frontcourt Offense State Class FrontCourtOffense : public TeamStateBase { protected: enum TBallHandlerPlans { eBallHandlerShot, eBallHandlerPass, eBallHandlerDrive, eBallHandlerPlayMovement, … }; enum TNonBallHandlerPlans { eNonBallHandlerRescueBallHandler, eNonBallHandlerGetOpenForPass, eNonBallHandlerSetPick eNonBallHandlerPlayMovement … } public: … int Update(int); int ReInit(void); … };

  14. What’s that? • The key elements are the two enumerated types that define priority order • We might also have 2 different update functions for a BallHandler and a NonBallHandler for simplicity • In some situations priorities might not be enough, me may need some explicit if-then logic • Any Idea where?

  15. Pseudo Code for Update Fn for (each plan to evaluate) { //get the proper evaluation value if (planToCheck == currentPlan) evalValue = EvaluateContinuation(); else evalValue = EvaluateInitiation(); //is the current plan the best option //simple priority order plan selection if (evalValue > bestEvalValue) { bestEvalValue = evalValue; bestPlan = currentPlan; } //handle situations the priority method can’t else if (bestValue > 0.0f && bestPlan == shot) //is the drive plan a valid option if (currentPlan == drive && evalValue > 0.0f) //set the best plan to drive, but leave the bestValue as it is – Why? bestPlan = drive; //if the best plan is the current plan, update it else initiate it if (bestPlan == currentPlan) currentPlan->Update(); else currentPlan->Initiate(); }

  16. Agent AI • A well thought-out collections of Utility Functions and data used by the plans to evaluate and execute the things they represent

  17. Shot Plan • Taking a closer look at the shot plan • Three things to keep in mind • Potential success rate • Players skills and abilities – denoted by rating values • Penalties – e.g. defensive pressure applied to the player • Type of shot • Is Dunk possible? • How far is he from the basket? • Does he have a clear path to the basket? • Can he dunk? • Is Lay-up possible? • Same questions as above, but every professional NBA player can lay-up • Last option is Jump shot • Tell the player how to perform that shot

  18. High-Level Agent AI • Command issuing functions • Decisions that require more logic then a simple random no. • Whether to do a flashy 360° dunk or a simple one • Wrapper for Agent Mechanics

  19. Agent Mechanics • Low-Level AI • Manage and select the animations • Simple decisions that require no more than Random nos. • Like commands given to people who have no knowledge about basketball, but can follow simple directions. e.g. walk, jog, run

  20. Conclusion • Sports games present a unique set of challenges • The rules are well defined and allow little room for creativity • Professional athletes have personalities and styles that are recognized by millions of fans • User should be able to capture the abilities, personalities and emotions of the athletes being stimulated

  21. References • Building a Sports AI Architecture – AI Game Programming Wisdom 2 • Learning Goals in Sports Games – Jack van Rijswijck www.gdconf.com/archives/2003/Van_Ryswyck_Jack.doc • A very nice paper dealing with learning in Sports Games, using Soccer as the base.

  22. Thank You

More Related