Pathfinding breaking at high window sizes

0 favourites
  • 6 posts
From the Asset Store
Get Ready for the New Wave of "Bottom Screen" Games!
  • I wanted to address this issue here before writing up an official bug report-- It’s probably going to take me some time to get an easily reproducible case of this in a .capx, and I wanted to see if it’s a known issue or if there’s some sort of workaround.

    Up until recently, I had my game running at a Window Size of 1280x1024. I switched the size to 1920x1080, and started noticing some issues with my objects’ pathfinding.

    Occasionally, my objects (which are using Custom Obstacle Pathfinding movement) would attempt to path through walls (which were added as a pathfinding obstacle once, shortly after the start of the layout). I have not been able to reproduce the issue with any sort of consistency. It’s like the pathfinding just occasionally decides to give the object an incorrect path with little rhyme or reason, causing the object to walk into a wall and continue trying to walk through it until pathfinding is stopped. According to the debugger, a path has been found for the object-- apparently it’s just a bad path.

    After extensive testing over the past few weeks, I’ve determined that the pathfinding issues do not occur at 1280x1024, at all-- not once. Literally, the only thing that I change for this testing is window size-- none of the game logic is changed at all. Simply put, the issue occurs regularly (if inconsistently) at 1920x1080, but not at 1280x1024.

    Ashley (or anyone else who may have dealt with this), does this make any sense to you? Is there anything in the pathfinding code that would be affected by window size? Like I said, I’d be happy to provide an example .capx and write up an official bug report, but I don’t want to waste anyone’s time either if there’s some sort of workaround or if I’m somehow doing something wrong here.

    Many thanx

  • No, it makes no sense - the window size has absolutely no effect on any of the game logic at all, and especially nothing to do with pathfinding since the calculations actually happen in a separate worker which is entirely isolated from the main game code. The window size only affects how the game is displayed. Perhaps the window size has been a red herring and the real cause can be found if you look elsewhere. Having said that though bugs can be strange beasts and it's possible (but seems unlikely) that through some unexpected chain of consequences the window size really does affect it. It's basically impossible to say for sure without a reliable reproduction .capx that allows easy investigation of the problem.

  • Thanks for your quick reply. It made no sense to me either.. I'll investigate further and attempt to whip together a .capx.

  • Here's a screenshot of the problem in action:

    http://postimg.org/image/ca9epgr7b/

    The highlighted object is attempting to path through a wall, which you can see by the node arrows close by (they use the same algorithm as the demo project that comes with Construct 2). It looks like he's actually aware of the wall to his north, but not the one to his west, since he's attempting to path around the wall to his north, but not the one to his west. Which makes no sense, because they're using the same tilemap.

    The wall is part of a tilemap that's been given the Solid property. All characters in the game were given the same pathfinding properties and custom obstacles (including the tilemap) and had their obstacle maps regenerated at the same time, and most of the others in this same scene are pathfinding around walls properly.

    Aside from a really bad cell size/border, what could cause something like this to happen, and so inconsistently at that?

  • Ashley Holy crap, I made a breakthrough on this, and I think it's a legit bug-- though it's likely a pretty rare one.

    My Pathfinding Cell Size was set to 64, and Cell Border set to -35. Kind of an odd choice of settings, but it worked well for me, EXCEPT...

    Check out this screenshot of my 10240x10240 layout-- the areas in red are the collision cells, which are created using the algorithm from the example pathfinding capx.

    http://tinypic.com/r/2n0j0he/8

    There's a horizontal line of collision cells missing! And yes, this ONLY occurs when the window size is at certain settings like 1920x1080! If I change the Cell Border to other settings, that missing line fills in! Bizarre!

    I'm going to investigate further and write up something official..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Glad you found it.

    Just a hunch, but I don't think Pathfinder was supposed to work with inverted cell size.

    Cellsize of 64.

    Cellborder -35. Since borders exist on 4 sides your cellborder results in 70 with an effective -6 check. So the fact that it works is probably inadverant luck rather than by design.

    You should probably re-doe how your using cellborder. Though good find for a bug. It's obscure.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)