Members - Reputation: 100
Posted 30 March 2012 - 03:51 AM
I'm a hobbyist programmer creating an engine to diablo like game. I would like to create an AI for my monsters which would make them move in a realistic (or at least semi realistic) way.
It's quite easy to detect player, find the shortest way towards him and make monsters to charge at that direction. In my experience moving everything linearly it's not the best AI behaviour in terms of reality. Are there any well known algorithms / approaches to make the movement more realistic (or even synchronised to make the monsters work together)?
Members - Reputation: 4606
Posted 30 March 2012 - 05:25 AM
My game: Gnoblins
Developer journal about Gnoblins
Small goodies: Simple alpha transparency in deferred shader
Moderators - Reputation: 1873
Posted 30 March 2012 - 08:36 AM
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
Author of the book, Behavioral Mathematics for Game AI
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
Moderators - Reputation: 5041
Posted 31 March 2012 - 03:27 PM
Furthermore, the scenario of your typical Diablo-clone doesn't really necessitate complex reasoning. Bear in mind, of course, that when I mean Diablo-clone, I mean Diablo-clone. Hordes of baddies, flashy special effects, gold and loot and items and spells flying all over the place. You know, like Diablo. In such a scenario, the two opposing factions (player and mobs) each have the same goal: kill the other. They do so with resolute intensity, pouring all of their focus into that task. The player collects items and skills and levels for the sole purpose of being more effective at killing the mobs, and the mobs use their special mobly powers of mobbiness to... well... kill the player. Maybe some do it in a sneaker fashion (teleport+shoot, retreat+summon, what have you) but the overriding goal is still the same. In such a scenario, there really doesn't need to be a complex behavioral system driving it. A few randomized behavior trees can give the appearance of intelligence on a passing glance, and that is about all that is necessary.
If the intention is to move beyond this, then by nature you are moving beyond being a Diablo clone. But still, it's not exactly a field requiring complex AI. Have you ever been in a bar fight, or a school-yard scrap, or just a ninja-swords-made-from-PVC-pipe-fight with your cousins? Try to imagine that scenario only bigger. Deadlier. In the vast majority of these cases, there is going to be a straight-line approach made to the most dangerous opponent, followed by perhaps a bit of circling and dancing in the course of what is mainly a frontal assault. The main baddy's friends will circle around, maybe some will be too scared to approach, maybe others will try to jump in, but for the most part these untrained combatants will not cooperate and will, in fact, just bumble around doing their own thing and getting in each other's way. Trained combatants, on the other hand, will cooperate. But so often, this cooperation can simply be simulated in-game with a few clever tricks like evenly spacing the mobs around an opponent to threaten him from all sides, throwing buffs on one another as needed, prioritizing certain abilities based on an analysis of the player's build, etc...
In all of this, the actual mechanical act of moving is the simplest part, and any basic A* shortest-path-finder with some dynamic obstacle handling is probably going to be more than sufficient.