tag:blogger.com,1999:blog-1272803659321539598.post7256658158479705783..comments2024-03-28T23:38:41.403-07:00Comments on Digesting Duck: Following Moving TargetMikko Mononenhttp://www.blogger.com/profile/11900996590678707801noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-1272803659321539598.post-67301487826454485912010-11-15T08:29:53.003-08:002010-11-15T08:29:53.003-08:00@Phil Carlisle: Instead of using a timer, I keep t...@Phil Carlisle: Instead of using a timer, I keep track of the dtPolyRef that the dynamic end position is over. When the dtPolyRef changes I recompute the path. The dynamic end pos is free to move over the surface of the final nav poly without causing a new path to be computed, you are guaranteed to be able to reach it.<br /><br />It's important to recompute the path if your agents have different abilities - if the agent that's being chased vaults over a barrier and the chaser can't perform that action then recomputing the path is the only safe way to continue the chase.Ghostedhttps://www.blogger.com/profile/00878615103525644821noreply@blogger.comtag:blogger.com,1999:blog-1272803659321539598.post-73290652930778764812010-10-29T06:08:04.952-07:002010-10-29T06:08:04.952-07:00Why not simply add a value which indicates how man...Why not simply add a value which indicates how many nodes to throw away?<br />Example:<br />Path is [node-list] 1->2->3->4<br />where the agent is on node 1 and the target is on node 4.<br />Now the target moves from node 4 to node 5.<br />If the value is set to zero we are looking for a shortest sub-path from 4-5.<br />If the value is 1 we are looking for a shortest sub-path from 3-5.<br />...and so on<br /><br />That way it's possible to set the value to what is more important in your case: <br />short path to target VS speedYAYhttps://www.blogger.com/profile/04242291781994146761noreply@blogger.comtag:blogger.com,1999:blog-1272803659321539598.post-47262171811422284912010-10-29T05:30:34.136-07:002010-10-29T05:30:34.136-07:00Phil, moveAlongMesh() can be also used to calculat...Phil, moveAlongMesh() can be also used to calculate the offset from a formation center, then you would follow that point. It is awesome tool!<br /><br />How often we can reuse path data *is* cache invalidation problem, thus very complicated indeed :)Mikko Mononenhttps://www.blogger.com/profile/11900996590678707801noreply@blogger.comtag:blogger.com,1999:blog-1272803659321539598.post-65321156659388177292010-10-29T05:24:48.484-07:002010-10-29T05:24:48.484-07:00Phil, good points. Chasing is different than follo...Phil, good points. Chasing is different than following. I would even say, that chasing and intercepting would be different algos too, even if related.<br /><br />The good thing moveAlongMesh() vs. A* is that if the target does something stupid, like leaves the navmesh, may end up visiting every single polygon. Move along returns in guaranteed time.<br /><br />Angryant, how would you calculate that? Or implement it efficiently :) For the open areas specifically you could test that if the corner vertices are border vertices or not and react based on that. Like try to use walkability raycasts to optimize the path further.Mikko Mononenhttps://www.blogger.com/profile/11900996590678707801noreply@blogger.comtag:blogger.com,1999:blog-1272803659321539598.post-91626859244632497252010-10-29T05:22:35.781-07:002010-10-29T05:22:35.781-07:00Hey Mikko,
Surely in the ideal following case, yo...Hey Mikko,<br /><br />Surely in the ideal following case, you would want to somehow concatenate the path of follower+followed so that the follower doesnt have to spend time computing a path that is already calculated. Fixing up its own path from the previously followed path (like each path is a sliding window and you want to create an overall window which contains both paths).<br /><br />Adding offset following really complicates things though.<br /><br />You got me thinking though, how often can we actually reuse path data? I suppose its a function of the proximity of the agents and the overlap of the paths the agents follow.Phil Carlislehttps://www.blogger.com/profile/05262518177977960604noreply@blogger.comtag:blogger.com,1999:blog-1272803659321539598.post-10081087848358600932010-10-29T05:02:36.433-07:002010-10-29T05:02:36.433-07:00How about getting rid of the last example like thi...How about getting rid of the last example like this:<br /><br /> * Whenever a path segment is calculated, you also calculate a "zig-zaggyness" value and store that as metadata attached to the path segment.<br /><br /> * When expanding your path with a new calculated segment, recalculate the "zig-zaggyness" of the total path.<br /><br /> * On path expansion, compare the "zig-zaggyness" of the total path to the average "zig-zaggyness" of the segments making up the path. If the difference goes beyond a threshold, recalculate the whole path.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1272803659321539598.post-69290654235431677552010-10-29T04:57:43.503-07:002010-10-29T04:57:43.503-07:00I've been using a re-pathing approach, because...I've been using a re-pathing approach, because my agents are following other agents quite closely and I doubt the repathing will actually be that expensive (given they are only really ever one or two navpolies away at most) most of the time they are on the same navpoly anyway.<br /><br />I dont repath continuously, but sample a new position every N seconds and move towards that, but it does have issues with agents that "lag" that extra amount of time before following that is pretty obvious.<br /><br />I think for the case of "following", then you're case of path-corridor fixup should work well. But in the case of "chasing" it would break down as the images show. Basically following implies you want to take the same path as the previous agent (swat guy following his squad), where as chasing (swat guy following a perp) is a different use case, in that area I think I would replan, because you actually WANT the shortest path to your target and in some situations that means you literally change direction. <br /><br />Imagine you are playing a game as a kid. You are chasing someone, you both stand on the opposite side of an obstacle and the goal is to touch the other kid. Of course its actually quite normal to get aliasing as you try and follow the other kid. Every twitch they make towards a direction should be matched by a change in your direction.<br /><br />So to me the intent is quite different.Phil Carlislehttps://www.blogger.com/profile/05262518177977960604noreply@blogger.com