C2 save/load system forgets disabled Physics collisions?

Report Construct 2 bugs here.

Post » Thu Oct 12, 2017 8:16 am

Problem Description

The native C2 save/load system appears to forget the "disabled collisions" state of Physics objects.
After loading, all Physics collisions are enabled regardless of prior state.

The Physics behavior has an option to "Disable Collisions" between objects, on an object-by-object basis.
I'll refer to the data structure that stores that inter-object collision info, as the "collision relationships list".

e.g. Given SpriteA, SpriteB, and SpriteC, you could disable collisions between only SpriteA and SpriteC.
All other collision combinations would still occur normally.

When using the native C2 save/load system, if you save, and then load, the Physics behavior's "collision relationships list" state is not restored.
After loading, all collision relationships are set to enabled.

Attach a Capx

Description of Capx
Image of the capx.

The capx shows a real-time interactive demo of the problem.
There's text in the capx to explain steps to execute and what to look for.

The capx shows two physics enabled sprite objects, a static (Immovable) Orange box, and a moving Blue box.
The moving blue box is attracted to the Red "X" which drags it back and forth in a horizontal sine motion.
On layout start, collisions between the blue mover box and orange static box are disabled.
This allows the blue mover box to pass through the static orange box without colliding.
At the bottom of the canvas are 5 buttons.
  • Save: Save game state via native C2 save/load system.
  • Load: Load game state via native C2 save/load system.
  • Set no-hit: Disables collisions between Mover & Static.
  • Restart: Restarts layout.
  • Toggle text: Show/Hide text.

Steps to Reproduce Bug
Run the capx.
  1. Observe the blue box passing through the orange box without colliding.
    This is due to the event: On start, disable collisions between those objects.
  2. Click the "Save" button, to save the game via C2's native save/load system.
  3. Click the "Load" button, to load the last save state.
  4. Observe the blue box now collides with the orange box.

    The disabled collision state has not been restored.

You can optionally experiment a little further:
  1. Click the "Set no-hit" button to re-disable collisions.
  2. Observe, the boxes no longer collide.
  3. Retry clicking the "Save" and then "Load" buttons.
  4. The boxes now collide again.

Observed Result
The Physics behavior's "collision relationships list" is not restored after loading the game state, and so the boxes begin colliding with each other.

Expected Result
The "collision relationships list" is restored after loading the game state, the disabled collision status between the boxes is likewise restored. and so the boxes pass through each other without colliding.

Affected Browsers
  • NW.js: YES
  • Chrome: YES
  • FireFox: YES
  • Opera: YES
  • Iron: YES
  • Internet Explorer: YES

Operating System and Service Pack
Win7 x64 - Pro

Construct 2 Version ID
Release 247 (64- bit) checked
Built at 13:33:48 on Sep 21 2017
Release Notes
Last edited by fisholith on Tue Nov 21, 2017 5:35 am, edited 3 times in total.
Posts: 333
Reputation: 6,193

Post » Tue Nov 21, 2017 5:27 am

Hey @Ashley, just curious if you got a chance to take a look at this.
I know you have a ton going on, so no worries either way.
Posts: 333
Reputation: 6,193

Return to Bugs

Who is online

Users browsing this forum: No registered users and 0 guests