Forum rules - please read before posting.

Retro-style movement bug?

I'm not sure if this is a bug or just something I've misconfigured, but if I set my player character to use retro-style movement, sometimes she will come close to completing her pathfinding but will get stuck. If I stop using retro movement, the issue doesn't seem to happen. Like this:

I've been working on this project since last year, and I first noticed this issue no more than a couple of weeks ago. I think I might have noticed it before the last update, but you did send me a preview of the update before it was out, so I'm not entirely sure when I noticed it.

Comments

  • I'm not totally clear from the video: are they simply not reaching the intended desination, or are they becoming frozen an can't be moved elsewhere?

    Is it possible to have this occur with the Character: Move to point Action, and is there a discernable pattern to when it occurs vs doesn't?

    I can't recreate any issues with your values - if you can PM me a package to test, I'd appreciate it.

  • They are simply not reaching the intended destination. If you click elsewhere, they move as normal.

    That little "0" under the player when I show the scene view is the path node that refuses to clear. After clicking to walk somewhere, if I select the player in the hierarchy and look at the scene view, I can see all the path nodes the player will pathfind through/to (say, 0-1-2-3, where 3 is the destination). It's interesting because 0 is a node that follows the player, and it "eats" the nodes it moves through. So as soon as the player reaches node 1, it disappears and node 2 becomes 1, and node 3 becomes 2. By the time the player is about to reach the destination, the node under the player is still 0, and the destination node is now named 1.

    The interesting thing shown in the video is that the destination node (1) has already been "eaten", presumably meaning it has been reached, but node "0" under the player refuses to clear, so the character keeps performing a walking animation in place.

    I was going to say I thought this only happened when clicking to pathfind, but no, I've just had it happen with the Character: Move to point action too. It happened during my intro cutscene, which is triggered by OnStart as soon as you enter Play Mode. This means the NPC never reached the destination, and the cutscene got stuck at that action.

    But this only happened once - I could not reproduce it by running it again. I find this interesting because we've controlled for A LOT of variables here (there is a dialogue the player can pick an answer to in the middle of the cutscene, so the timing does vary, but the exact positions of the Player/NPC are always exactly the same). The only other confounding variable I can think of is screen resolution, since the Game window might not have been sized exactly the same.

    Also, the issue can happen at any time, but I've had more luck reproducing it by clicking very short paths near the player, up and down, until one of them sticks.

    I'm swamped for the next couple of days, but I'll definitely create a test package for you by the end of the week if all the info above doesn't give you a lead.

  • I figured out more details.

    It turns out I'd never seen this behaviour before because my Pathfinding update time used to be 0. I only increased it recently because I needed the player to chase after moving NPCs they interacted with.

    I initially set it to 0.5s, but I ran into the last bug I reported (the one where the hotspot was mistakenly activated when the NPC was moving away), so as a test I set the update time to 0.1, and forgot to increase it later.

    This bug still happens with a 0.5s update time, but it's quite a bit harder to reproduce. But if I use these settings, it's fairly easy:

    I will DM you a test project shortly.

  • (Chris has provided a fix for this.)

    I have another question: for some reason I haven't yet identified, one of my scenes gets really choppy when an NPC pathfinds. The navmesh is fairly simple, so I'm not sure what is causing it. All I know is that the game freezes for a split of second every 0.1s if the Pathfinding update time is 0.1, 0.5s if it is 0.5s, 1s if it is 1, etc. It freezes camera movement and so on, and increasing the update time only spaces out the freezes instead of eliminating them.

    My question is: I'm getting pressed for time, so I don't think it's worth it for me to troubleshoot this one scene. Nor do I need the Pathfinding update time to be higher than 0 for anything other than recalculating the player's path towards a hotspot. Would there be a way to limit the higher update time to the player? Or better yet, to limit it to the player ONLY when there's a pending hotspot interaction? I imagine this would give me a significant performance boost in other scenes too, specially when I have more than one NPC pathfinding at the same time.

  • ^ I fixed the one problematic scene (character evasion was on by accident), but I think this would still be nice to have in scenes with lots of characters.

  • The update time is a global setting, though you could feasibly alter it through script when the Player is moving (e.g. via the OnCharacterSetPath / OnCharacterEndPath custom events).

    If it's a case of the pathfinding itself causing stuttering, you might like to try out the A* implementation available on the Downloads page. This may offer considerably better performance, and can be employed on a per-scene basis.

  • edited February 2023

    I'll give the A* implementation another try, but I tried it a while ago and for some reason the performance was worse? But mainly, I felt the character movement felt less natural than the default. My animations just didn't look right.

    But you're right, I'd be happy to change the global setting via script, so I agree that an option to turn it on while the player is pathfinding is not necessary. But I still think the option to toggle it on only for the Player would be extremely useful! For example:

    For testing purposes, I created an actionlist that teleports 10 NPCs to marker 1 and then, with a 1s wait between them, tells them to pathfind to marker 2. If the Pathfinding Update Time is 0, then that goes VERY smoothly. 0.1s brings us to about 15fps as all 10 NPCs generate a new path every 0.1s, all the way to the destination. But even a 1s update time causes huge spikes, like this:

    The spikes are spaced out by the update time we set, but it's very easy for the NPC pathfinding operations to coincide with one another and cause choppiness. And it feels like an uphill battle to try and account for when to tell the NPCs to go for a walk so that the updates are more spread out. With an update time of 1 and 10 NPCs, I'd need to have increasing intervals (1s, 1.1s, 1.2s etc) between their "Move" actions so that they wouldn't overlap when updating. A lot of trouble for something the game doesn't even require - as long as the player can update to chase moving NPCs, no one else needs to be updating their pathfinding!

  • Thanks for the example.

    I shall see about introducing a per-character update time value. This will likely be something only set through code, however.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.