Jump to content

  • Log In with Google      Sign In   
  • Create Account

Bizarre Pathfinding Bug, Please Help


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 DontReferenceMyPointer   Members   -  Reputation: 139

Like
0Likes
Like

Posted 16 March 2013 - 01:54 AM

[I am unsure as to if this is the best place to put this, please redirect to the proper place if I am incorrect]

 

In order to properly describe the bug, I must explain the order of events leading up to the bug:

 

1) Player Left Clicks Character to Move Character to the Active Character Handle [works]

2) Player Right Clicks to Set the Destination of Character in the Active Character Handle to the Point of Click [works]

3) Alpha* Pathfinding Ensues to Produce a Path of Tiles to the Target Location [works]

4) Character Follows Pathing Instructions to the Edge of the Final Tile [works]

**Note: The Character Enters the Final Tile When it Meets the Edge of the Final Tile**

 

Now, if I add in a final step to correct the character's position within the final tile to reflect the mouse click, something strange happens.  Periodically, the pathfinding will work properly, yet, the Character will stop following pathing instructions after passing through a single tile and freeze until I give it a new path.  Even more strange, the new "final step" is in no way accessed during the steps (i.e. if I put a reporter method within the new code, I get no output from the reporter when the character freezes mid-path.)  If I then take the code out, the pathing works without a hiccup except for the fact that the character position is not corrected to the point in the tile that was clicked.  There are no freezes in the pathing without the corrective code...which is to my knowledge not accessed when the pathing freezes!

 

I have tried for hours to fix this problem, however, I cannot find a way around it.

 

Any insight into how to further debug this problem would be a phenomenal and welcomed helped.  As well, if there is something I am not considering please let me know.

 

If you would like me to post my code just let me know.  I am programming in Java in Eclipse.

 



Sponsor:

#2 DontReferenceMyPointer   Members   -  Reputation: 139

Like
1Likes
Like

Posted 16 March 2013 - 02:40 AM

I figured it out:

 

The final pathing correction would always work the first time.  Ends up there was in error in a previous pathing step that would not work if the distance between the center of the tile and the character's position wasn't divisible by the unit speed of the character.  So, even though the final correction wasn't being accessed at the time of the pathing freeze, it changed the parameters of earlier, erroneous, pathing logic for the next path resulting in a pathing freeze.

 

Wow...lesson learned: do not make the assumption that old logic will fit the parameters of new logic when debugging.

 

I don't know how to delete my own topic, but this is case closed.  Sorry everyone!



#3 incertia   Crossbones+   -  Reputation: 779

Like
1Likes
Like

Posted 18 March 2013 - 05:52 PM

It's generally not a good idea to delete your own topic, because somebody else might have the same logic error as you, and your own solution may be the root of their problem.
what




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS