AI Tracking VS Chasing
by Kevin Mitchell · in Technical Issues · 09/04/2007 (4:45 am) · 4 replies
I am trying to developer my own AI brain from the bottom of the pit and I am thinking about having the enemy tracking the player instead of chasing him. My problems with chasing is that if i make a fast hook around the corner then the AI can get stuck on a wall so I'm thinking about making the player track the enemy instead of tracing. Note I'm making a traditional RPG like FFXI, Star Ocean, or Grandia.
My tracking will work like of like this.
-Walk around to random places with in a certain radius of you original spawn point
-If you detect the enemy within 10f then start tracking while distance from origin is less than 30f->50f (havent decided depends on my map size)
-Every few millisecond fill an array of 100 with the position of the current client's position (unless the players position hasn't changed)
-Every on destination end go to the last listed players position
-If max Distance from origin has been reached then fade away and respawn at home
-If collide with player then Activate Battle Mission using the internal monster data for the loaded Mission file
Does this sound like I'm on the right trac or will I be going to a odd path for processes? I'm not a beginner programmer but as for scripting I'm not sure if its the best algorithm for torque's threading power.
My tracking will work like of like this.
-Walk around to random places with in a certain radius of you original spawn point
-If you detect the enemy within 10f then start tracking while distance from origin is less than 30f->50f (havent decided depends on my map size)
-Every few millisecond fill an array of 100 with the position of the current client's position (unless the players position hasn't changed)
-Every on destination end go to the last listed players position
-If max Distance from origin has been reached then fade away and respawn at home
-If collide with player then Activate Battle Mission using the internal monster data for the loaded Mission file
Does this sound like I'm on the right trac or will I be going to a odd path for processes? I'm not a beginner programmer but as for scripting I'm not sure if its the best algorithm for torque's threading power.
About the author
Riding Solo since 2005. Current Project: Fated World 2005-Present "... because Torque3D is not just for Tribes style First Person Shooters - but anything which you have the will to create" ~ Steve Acaster
#2
this is probably theoretically impossible when the target is around a corner or something,
but when the target is in plain view, you probably want to calculate an intercept.
.. which i did the math for once a couple years ago but have now forgotten and lost the source code! :(
09/05/2007 (1:30 pm)
One thing to think about also is that what you really want instead of merely following the target is to *intercept* the target. ie, instead of going to where the target is, go to where the target is going.this is probably theoretically impossible when the target is around a corner or something,
but when the target is in plain view, you probably want to calculate an intercept.
.. which i did the math for once a couple years ago but have now forgotten and lost the source code! :(
#3
09/05/2007 (2:29 pm)
I definitely like the concept of chasing someone... sounds complex though..
#4
09/05/2007 (2:32 pm)
I almost have it done but i dont know how to add an array to the monster datablock or the AIplayer that will be global to the whole object;
Torque Owner Nikos Beck
It might look terrible because if the user makes a tight turn the AI will walk right past them rather than turn directly towards the player.
There are literally a hundred different ways to handle path-finding.
You could have waypoints. The AI will wander between waypoints as a patrol. When the player is spotted the AI will move towards the player as a waypoint. If it collides with a wall, it picks another waypoint and then moves towards it, while keeping an eye on the player.