Members - Reputation: 1171
Posted 05 September 2012 - 09:41 AM
Once the first unit has reached the target tile, it effectively blocks it by standing on it.
The rest of the units in the group remain in an endless pathfinding loop, wasting precious CPU cycles to get closer to a point they cannot reach.
Another problem is that they make a very long pathfinding calculation because other units ,which are standing next to the target, are blocking them (they just go deeper and deeper Into a* until they exceed the iteration limit. This results in a paradox were units standing closer to the target make heavier calculations to reach the target then when they were further away. ( when they were standing the further away their comrades were not yet there to block them)
So what I am looking for is a good stop condition which tells the unit it should stop trying to improve it's position.
My browser game: Vitrage - A game of stained glass
Members - Reputation: 150
Posted 05 September 2012 - 12:25 PM
Edit: or can you make friendly units push other friendly units out of the way?
Edited by Wizuriel, 05 September 2012 - 12:28 PM.
Moderators - Reputation: 3361
Posted 05 September 2012 - 12:29 PM
Of course, that means that first arrivers take the near side and late arrivers have to go around. Therefore, you can move the "real" stop point to a distance just slightly beyond the click point, aligned with the vector between the center of mass of the group and the actual click point. That is, when you click on a spot, drop a line between the center of mass and that point. Take that direction and push the "actual" center point out beyond the click point in that same line... perhaps 1/2 the radius calculation that you did earlier. That way, people will tend to collect near the actual click point as they arrive inside that circle.
I'm just making this shit up as I go, but you can see that there are options to be had in "solving" the problem.
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!"
Crossbones+ - Reputation: 2460
Posted 05 September 2012 - 03:32 PM