//****************************************************************************// //**************** Game AI vs Regular AI- January 9th, 2019 *****************// //**************************************************************************// - Round 2, here we go! - As per last time, it's a crowded room (elbow space is in the negatives), and Professor Riedl is ready to go - "As we said last time, the first homework assignment is out - a few of you might have issues because of Python version mismatch things, but most of them should be fixable. I'm sorry. Computers suck." - Again, Homework 2 is actually the first homework - "because I'm awful like that" - As per Riedl's policy, he likes to demo what the working project should look like in-class - so he'll do that now! - (holy cow - he has the messiest desktop in existence) - "I'd encourage you to look through some of the engine code as you go through this" - Running "runbasic.py", you should see some very basic sprites - "I found a guy who made a top-down 2D Halo and stole all his sprites" - To run the actual homework, you can run "randomnavigator0.py" or one of those other files - and a screen should pop up that looks similar to what we had before - The difference is that if we click now, the agent doesn't do anything - that's because you have to implement the navigation logic (in "mypathbuilder.py" or something)! - Once you've implemented this, running the randomnavigator.py file again will show all of the paths you've created - "Currently, it'll stay ON the paths you make, but it'll choose a random sequence of nodes to visit - so it won't actually navigate to the spot unless it gets lucky" - We'll address this in the next homework - "This assignment is all about getting used to the game engine - most of the work should just be you reading the documentation. Actually coding this stuff up shouldn't be too complicated if you're using the right function calls" ----------------------------------------------------------- - Now, when we left off we were talking about how people in the game industry tend to view AI differently than us academic-y folks - Basically, academic researchers tend to view AI in terms of optimality, while game programmers evaluate them by their impact on the experience - This means that game programmers don't care too much if they're "faking" their AI or have to sacrifice features to get a better runtime - For example, AI enemies in most FPS campaigns don't even exist until you walk into the room - on average, they're only in memory for about 5-10 seconds - Alright, now, since there are some people in the room who aren't too familiar with all the gaming subgeneres, here are some common genres of games and an old/newer-ish example of them: - First-Person Shooters: Wolfenstein 3D, Halo, etc. - Typically in this class, we'll be talking about singleplayer campaigns, since multiplayer kinda removes the need for AI - "Really, HALO 4 is about the limit of how complicated AI algorithms get in most games - it uses a lot of clever techniques, but doesn't get ridiculously state-of-the-art" - Quick question: what're the most common AI things in FPS games? - Pathfinding, and deciding what to do next (shoot, hide, etc.) - RPGs: Zelda, Skyrim - These games are special from an AI perspective since they have a lot of NPCs you have to interact with - you have to simulate some daily life stuff, along with dtandard enemy stuff - In Skyrim, there's also some randomly generated quests that come up (not very great ones, mind you) - which we'll talk about a little when we get to procedural generation - MMORPGS: Nethack, World of Warcraft - Basically, an RPG but with multiplayer people - Platformer: Super Mario Bros., - "There'll be a point in this class where you hate Mario" - Really, there's very little true AI in platformers - they're so simple that they're more like obstacles than true AI - God Games: Black & White - These games are - "Black and White was really ahead of it's time - it actually used decision trees and machine learning to control the AI" - Sports Games: Madden, all of EA - We won't talk about these too much, but there's actually a lot of AI going on in these things: AI sports commentators, strategizing against you, pathfinding, local decision making, etc. - "The people who make Madden are football experts, so it's actually a pretty decent simulation - I've seen coworkers try to predict the superbowl by playing Madden AIs against each other" - RTS: Dune II, Starcraft II - You have base, your opponent has a base, you try to destroy your opponent - There's a lot of AI going on here, too: pathfinding, strategizing when to build/attack/defend, (sometimes) terrain analysis (so it knows where the chokepoints, good base spots, etc. are) - "This is one of the few games where the AI is designed to be as tough as possible, since at this point, the best human players are still better than the best AIs" - MOBAS: DOTA, League, etc. - This is kind of a blend of RTS and FPS games, where you only control a single character on an RTS map - Others like board games (AIs dominate in most of them), card games (poker, Hearthstone, etc. - AIs tend to be toned down for these), party games (AIs are terrible at these), etc. - "...alright, that's my basic game literacy part of the course" - "Also, I've never played a MOBA, but I still wrote the MOBA assignment in this course. I know." - Going from there, how is AI actually used in games? - Automation - you need other people to do things (enemies, NPCs, etc.), but you don't have other people to do them - "There are roles that intelligent people simply don't want to do, and for that, you have to make the next best thing" - Opponents/Companions/NPCs - Possibly an AI dungeon master? (not actually "in the game," tries to manage the high-level player experience - could argue sports strategy manager falls under this) - Full-blown game designer or plot writer? (this is just a research problem for now) - And what're the goals of these Game AIs? - "Kill you good," difficult enemies - More commonly, just to create interesting, believable opponents, companions, etc. - To make the game more enjoyable - The play like a human - In brief, game AI IS a part of game design itself - it directly affects the player experience - Now, here're a few common tricks that are considered "AI" in actual video games: - Move into open before firing (no "cheap shots") - Be visible - Have horrible accuracy - "Stormtrooper AI" - Miss the first shot - Warn the player before attacking - Attack "kung fu" style, one at a time - Tell the player what they're doing - React to its own mistakes (saying "oops" if they drop a grenade) - Ease off at the last minute (give the player breathing space) - Predictable patterns/intentional weaknesses - Stacking the deck against the AI (e.g. giving bad cards in Hearthstone, AI intentionally getting worse dice roles, etc.) - (most of these taken from "AI Game Programming Wisdom" - specifically the "Artificial Stupidity" chapter) - Now, these things seem pretty simple, right? No soldier would ever do any of these things in a combat situation - and to an AI researcher, all of these things seem too simple to count as AI - but all of these things are actual techniques that've worked to make the game more fun! - Some more common algorithmic stuff: - Path finding/obstacle avoidance - Nothing's more annoying than your AI companion getting stuck in the door - and because this problem is so notable, it's actually a significant thing to get right - Decision making (FSMs, behavior trees, planning) - Command hierarchies (individual, tactical, strategic planning) - Emergent behaviors (flocking, crowd AI, etc.) - Formations (illusion of coordination) - Smart environments (AI figuring out how to convincingly pick up objects, etc., e.g. sims making food in the Sim) - Terrain analysis (finding resources, ambush points, etc.) - Drama management (dungeon master-esque stuff, like in Left 4 Dead) - Procedural level generation - And again, these "game AIs" are distinguished from academic AIs by (among other stuff): - Resource limits - Complexity fallacy - Fun vs smart things (the best algorithm isn't the right one) - Alright - on Monday, we'll start talking about some navigation and pathfinding stuff that'll crop up in your next homework. In the meantime, have a good week!