Destroying tiles physics memory [concept abandoned]

0 favourites
  • 5 posts
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • I have run into a bit of an unexpected problem with the physics and tilemap plugins. I am clearing out tiles in a tilemap that also has the physics immovable behaviour. Sometimes this causes the following error to be displayed:

    This seems to happen when I clear a large number of tiles in relatively quick succession (3 per second for 10 secs seems to cause it to happen). Creating a bug report will be rather challenging... Anyone any ideas what might cause this and how to avoid it?

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Update - using the Chrome console I note the following extra info:

    [quote:27dl8hf1]Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 33554432, (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.

    Physics_behavior.js:10 Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 33554432, (2) compile with ALLOW_MEMORY_GROWTH which adjusts the size at runtime but prevents some optimizations, or (3) set Module.TOTAL_MEMORY before the program runs.

  • There is this bug here that has a similar issue:

    I didn't find others but I recall there being some reported elsewhere. That particular one had no response but the fix as I recall was the behavior was updated with a bigger TOTAL_MEMORY, which just delays the error till more memory is used.

    If it helps the non-asm.js version of box2d doesn't have this issue, and you can change it in the project properties.

    Best I understand it is asm.js requires the amount of memory needed to be reserved beforehand, and it can't change. Based on ashley's last blog, webassembly would be an improvement on asm.js in that it lets the amount of memory needed to change while the program runs.

    Anyway things like changing animation frame, changing size, or adding/removing tiles on the tilemap all cause the physics objects to be updated and I guess that fills up the memory with asm.js?

  • Thanks R0J0hound - that looks like a very similar bug. I was not able to reproduce this on a simple capx, of course; I guess my original setup was the bigger memory case... :/.

    However, I -think- I might have fixed the problem....

    I tried box2d, but it made no difference; I created a physics-only tilemap (so bitwise updates were excluded from potentially causing a collision polygon problem), but neither of those fixed it.... I was also able to simultaneously destroy 400 tiles (with bitwise updates) but that would not replicate the problem.

    In the end (and I think it's now negated) I created an event log system to ensure that each tile can only be called to erase once per tick. There was a potential failure where the multiplayer peer calls could have caused tiles to be called to be erased on subsequent ticks. So far, so good...

    Cheers.

  • Final update. So far not so good... The only fix for this appears to be to reduce the size of the tilemap. So, since the game cannot be effectively shrunk that way I've decided to abandon using the default physics for falling objects. It appears that dynamically updating a large-ish tilemap is not possible in c2. In isolation I couldn't reproduce this, which is frustrating, so it might only be a factor with large event numbers.

    With physics removed this problem does not occur.

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