Physics freezes on checkpoint loaded

  • Okay, I've got a really frustrating problem that's been bothering me.

    In both my completed game and my in-progress sequel, physics objects (like the metallic shrapnel or blood that flies off of a player/enemy on hit) will freeze in place after you die and reload a checkpoint. This doesn't happen in the minimal CAPX I built for this purpose so it must be a bug in my code, but I cannot for the life of me find it.

    Here's my working minimal example: https://www.dropbox.com/s/of4l9fsal6ssr7q/Physics%20Freeze%20Demo.capx?dl=0

    As the on-screen text tells you, you can save and load the demo's state with Enter and Space.

    Here's my example with the bug: https://www.dropbox.com/s/gbdxgcf9w2riyaz/Physics%20Freeze%20Bug.capx?dl=0

    This is a stripped-down version of my game, with just about everything irrelevant removed.

    1. Hold D to move right, and you'll run into the enemy and see a spray of red pixels when you hit it.

    2. Run into the enemy again to have it kill you. Notice the spray of red pixels again. The game will reload the save.

    3. Run into the enemy again. Notice the pixels will all stay in one place.

    4. The red pixels may start moving again as if nothing happened after an indeterminate amount of time.

    The relevant code is in the event sheet #Player, under the group "Player Collisions".

    A thousand thanks to anyone who can figure out what's going wrong!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If I remove "No save" behavior from the blood, this bug disappears.

    You can add "On Load complete -> Blood destroy" event, just in case.

    Also, why don't you use Particles? Physics seems like an overkill here for me, particles should be much better for performance.

  • Okay, well, that's frustrating. In the stripped-down example, removing "No save" fixes the bug. BUT, in the actual game, removing it didn't change anything.

    Anyway, I might switch the blood back to a particle spray, but there will be a lot more things in this game that use the physics behavior.

  • I took another look through the code, and it looks like nothing in my (real) game project is using the No save behavior anymore. The bug still persists. Has anyone else encountered this before?

  • MoscowModder

    I made a simple capx demonstrating this bug.

    https://www.dropbox.com/s/hyo3l5hg1ra74 ... .capx?dl=0

    It freezes on me about 30% of times I press Blood button after Load.

    I suggest you report it here:

    bugs_f151

  • Thanks for putting that together! I've made a bug report with it attached and am waiting for an official answer. In the meantime, I guess I should consider refactoring a lot of things to avoid the physics behavior.

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