Single Pathfinding Sprite for Each Enemy?

  • I'm trying to create a "pathfinding" sprite that can be used and pinned to every enemy that requires it (essentially only ever having ONE pathfind sprite for every enemy, npc, etc. in the game).

    For the absolute LIFE of me, I cannot figure out why this incredibly simple few lines of events aren't working:

    ...and the function it's calling:

    For some reason, only one pathfinding object is moving at once. (ie if there are multiple flies on the screen, they all just sit there updating the destX and Y)

    Am I missing something?

  • ome6a1717 Try comment (or delete) the "system for each fly" line. It can possibly help (or not).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • NoSoul8 - nah that didn't work. Disabling that wouldn't; it would also break more things below that line (that have nothing to do with pathfinding). I'm wondering if just the more pathfinding objects on screen, the less it's able to find a path and stick to it?

    I've narrowed down the problem to the pathfinding object triggers. (on path found; arrived, etc) It's not pushing the booleans to the sprites. Not sure why, though - it's literally picking a UID by an instance var.

  • I wouldn't call that incredibly simple logic, pathfinding is difficult however you look at it. It won't be anything to do with a limit of objects on screen as I had a theme park game with hundreds of guests pathing at once. You have some risky events in there running every tick but it's difficult to break down the logic from looking at them.

    Returning to the original problem, I don't quite understand it :

    I'm trying to create a "pathfinding" sprite that can be used and pinned to every enemy that requires it (essentially only ever having ONE pathfind sprite for every enemy, npc, etc. in the game).

    How does the game work? Why are the enemies not pathfinding on their own and instead you've included a pathfinding object that compares its instance var with the enemy UID? Also it looks like your screenshots are cutting off important parts of the events so it's difficult to assist when some of the logic you have is missing from view.

  • plinkie - the way the pathfinding behavior works is that it has to search the entire map when created or enabled. Because the layout is over 16k by 16k, it takes about 4 seconds on creation. So if we had 50 enemies each with their own individual pathfinding sprite, it would take a few minutes to load the game. (and before you ask, the game is a very small pixel scale, so that amount of memory shouldn't be a problem).

    Things will be dynamically created and destroyed in the end, so the best way I figured to have pathfinding in the game was to only have 1 object generate the map and just link each pathfinding sprite to any sprite that utilizes it (enemies, your dog, etc.) Hopefully that makes more sense?

    Also, side question; what looks dangerous every tick?

    UPDATE: Also, confirmed - it is not selecting the appropriate sprite on the UID check. Not sure why, though, the numbers match. I've been having a lot of issues with integers and strings ever since I switched to the new runtime.

  • Doesn't make any sense to me, hopefully someone else can decipher it. I would just use the pathfinding behaviour on the fly or it gets a little convoluted, then again I've never used a 16kx16k layout.

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