Each AI should use up a pretty significant resource of the server running the AI. How do the games possibly manage so many of them? Most education on AI is how to make them smarter, not how to make them cheaper. There has to be well known tips and tricks about scaling AI. What are they?
It's not 'AI' (what actually is?), but mostly hand-crafted state-machines trying to achieve game-specific goals, which directly inspect the current game state instead of trying to build their own 'world model' (of course with restrictions like fog-of-war, visibility-checks and so on so that the cheating isn't too obvious).<p>Really no <i>that</i> much different from what the Pacman ghosts did, just developed further from there (especially during the Golden Age of strategy games during the late 90's and early 00's).<p>With this base, scalability is achieved through fairly traditional performance optimizations (mostly using the right algorithms and data layout, especially for path-finding and 'visibility checks').<p>Also in strategy games, AI is often layered like a military chain of command, where the "commander AI" only makes high level strategic decisions and only has a very 'sparse' world model, while the lowest level 'soldier' AIs are mostly occupied with pathfinding but only know about their immediate surroundings.<p>Also, each game genre has their own highly specialised, hand-crafted "AI" algorithms. A first-person-shooter AI is completely different from a car-racing-game or realtime-strategy game.
Most of the work needed for decisions is shared between AI instances using a few tricks:<p>1. Precomputing information for all agents, like using global shortest path (Bellman-Ford).<p>2. Abandoning per-unit subjectivity (a lot of units will share same view) or in other words: limiting internal unit state, using a shared state between groups of units.<p>3. Decoupling expensive algorithms into multiple simple steps. (Like state machine simplifies regular expression.)<p>4. Using separate AI and visualization thread, and using low amortized cost data structures (priority queues etc.).<p>You may observe all these three rules by anomalies in unit behaviour.
Play <a href="http://www.screeps.com" rel="nofollow">http://www.screeps.com</a> to learn a lot about modern RTS AIs :-).
"AI" is a ridiculously general term. People use it to talk about everything from line-following robots to machine vision and speech / natural language recognition.<p>Most game "AI" has nothing to do with the currently trendy "AI" based on linear algebra and neural nets. It's much, much simpler, partly because it has direct access to the game state and doesn't have to do any sensor processing.<p>"GameAI" tends to be a bag of puppetry tricks. You don't even need the strategic depth of chess, just something that gives you an interesting enough and varied enough move/fire pattern.
There's a number of tech solutions to scaling mob AI. Most of these are also applicable to non-online games as well:<p>- Running AI at a different frequency than the game. The network event loop might run at 30Hz (33ms tick delta) but AI doesn't need to make decisions that often, maybe every 100ms or 500ms etc.<p>- Separate decision making from performance. A cheap execution system can run at a high frequency, while an expensive decision making system runs at a lower one.<p>- AI LOD. Mobs that are far away run much simpler AI that doesn't try to perform detailed animations etc. Mobs that are in unpopulated areas get frozen, and thawed once somebody enters.<p>- In instanced dungeons, mobs don't even exist until the players enter, and once players leave, the mobs just get unceremoniously killed.<p>- Offloading. Mobs are just game agents so in online games it's possible to offload them to other servers that get load balancer as players move about, areas get frozen etc.<p>Basically the big question is: if nobody is interacting with a mob, does it need to exist? In most online games they do not. And even in sim heavy games, maybe they don't need to run the same high fidelity AI when nobody is watching.<p>Then the last tip is:<p>- Make the AI as cheap as possible for the task at hand, but no cheaper. A mob in MMO that is all aggro and easy to kite doesn't need to have complex strategic cognition, and it would probably be a detriment. Everything need a to match it's context.<p>Source: I make games. :)
Two things:<p>1) Like 'opless wrote, AIs in most games are simple; they're designed to execute in real-time.<p>2) From the point of view of a networked game, AIs and players are the same - the server(s) only care about inputs. The difference between keyboard input and AI input need not to be relevant, and this suggest a trivial approach - execute AIs on clients, and send their inputs along with players' inputs.
For many games (shooters etc) making a smart AI is relatively easy. What's hard is making an AI that's provides a realistic and interesting challenge. These "AI"s don't use much in the way of machine learning however.<p>I feel like this isn't what you're getting at though. Perhaps there's a specific example you have in mind?
Most comments here are explaining what's meant by game AI's and how they're not closely related to "AI" as understood in other fields.<p>There definitely is lots of room for interesting applications of "real" AI in games. Apart from NPCs, learning and building models about the player has lots of potential too.<p>The interesting-game-ai field is of hard to keep track of, because the search resuls are full of combat AI discussions, which is pretty uninteresting.
You'd be surprised at how devious some of the tricks are. I'll give you an example from Startopia: visitors want particular services. These have queues. If the queue is too long, the visitor looks for a shorter line. Except... this led to them aimlessly wandering in circles. Oops.<p>So, instead, when they decide they want a service, they reserve their place there and then and then just walk to their spot. A completely hidden variable, cheap to compute, and the AI now behaves "sensibly".<p>In general, the AI of the average opponent in a computer game is way less complex than that of a housefly. Primitive communication and responses to external stimuli is about all there is.
> Each AI should use up a pretty significant resource of the server running the AI.<p>The premise is wrong, in many games AI can be extremely cheap. It's usually not the same "AI" as in other fields. Game dev is a completely different dimension.
I've started playing Destiny 2 and wondered the same thing. There are enemies seen by me and other players at the same time.<p>So the enemies have to be controlled server side not locally. Also there can be (and will be) a lot of enemies around the "Destiny world" at the same time.
What kind of servers do you need for that? That's not just processing HTTP requests and fetching data.