《programming game AI by example》
-
I'm reading this excellent book. I considered to use steering behavior in our MMORPG game server project. but if we use it all,it would consume a lot of cpu time which would be unacceptable for a server project. does any one have any experience on this topic?How could I find a proper way to use steering behavior in MMORPG server? Thank you very much.
-
I'm reading this excellent book. I considered to use steering behavior in our MMORPG game server project. but if we use it all,it would consume a lot of cpu time which would be unacceptable for a server project. does any one have any experience on this topic?How could I find a proper way to use steering behavior in MMORPG server? Thank you very much.
You write the search algorthim as an iteration, with adjustable resolution and trigger(s). If two objects are more than X apart the search doesn't run at all unless there is a special trigger. If you haven't been "spotted" there is no need for an enemy to search and so they usually just walk a defined set of waypoints called "pathing". So movement especially for NPC's or bots usually have two different behaviours being "pathing" and "searching". Often there is also a way to get "unspotted" and NPC's/BOTs may be leashed to some co-ordinate. If they get more than some distance from the leash point they will drop "seaching" behaviour and resume "pathing". The trigger whatever that is usually establishes the "target" and it is at that point the search AI kicks in. The game design thus far made sure searching is used sparingly. Now when the search algorthim kicks in, it sets a resolution grid based upon how far the target is away. You don't need a fine grid for a target far away. So you will have a raycast which you run to each point on the grid. So when target is a long way away you still only get a small grid just they represent a big distance. That is the bit your code you currently have probably doesn't do and so you have a huge grid when the target is a long way away. So now with your grid you run the AI search algorthim to work out what direction to move to the target allowing for walls etc. If the target is a long way away the direction will only be rough but that is all it needs it will fine up as it gets closer. The problem you probably have with the AI search they have given you is the grid is massive and it gets bigger and bigger the further a target is away. That would be how the vast majority of games not just MMORPG games work. Suggested start point for reading Near-Optimal Hierarchical Pathfinding (HPA*) | AiGameDev.com[^]
In vino veritas
-
You write the search algorthim as an iteration, with adjustable resolution and trigger(s). If two objects are more than X apart the search doesn't run at all unless there is a special trigger. If you haven't been "spotted" there is no need for an enemy to search and so they usually just walk a defined set of waypoints called "pathing". So movement especially for NPC's or bots usually have two different behaviours being "pathing" and "searching". Often there is also a way to get "unspotted" and NPC's/BOTs may be leashed to some co-ordinate. If they get more than some distance from the leash point they will drop "seaching" behaviour and resume "pathing". The trigger whatever that is usually establishes the "target" and it is at that point the search AI kicks in. The game design thus far made sure searching is used sparingly. Now when the search algorthim kicks in, it sets a resolution grid based upon how far the target is away. You don't need a fine grid for a target far away. So you will have a raycast which you run to each point on the grid. So when target is a long way away you still only get a small grid just they represent a big distance. That is the bit your code you currently have probably doesn't do and so you have a huge grid when the target is a long way away. So now with your grid you run the AI search algorthim to work out what direction to move to the target allowing for walls etc. If the target is a long way away the direction will only be rough but that is all it needs it will fine up as it gets closer. The problem you probably have with the AI search they have given you is the grid is massive and it gets bigger and bigger the further a target is away. That would be how the vast majority of games not just MMORPG games work. Suggested start point for reading Near-Optimal Hierarchical Pathfinding (HPA*) | AiGameDev.com[^]
In vino veritas