Jump to content

Physics glitches (Arcade, tilemaps)


Recommended Posts

Hello everyone,


I've started to experience some glitches with the arcade physics system. Here is the game, so you can experience the problems yourself, and the GitHub if you'd like to look at the source:





1) When the characters velocity is high and they are pushing against a wall, they tend to fall through the floor. As I lessen the velocity, I can see them start to dip down into the geometry of the world, and then pop back up at the last second. For example, if you walk against a wall (arrow keys), then roll (x), you will dip into the geometry a little bit. If you roll and then immediately attack (z) you will do a stab. This stab moves you quite fast, and for me, drops me through the floor almost every time.


One possible contributing factor is that I am tweening a variable to have a certain shape of change, and while they are in one of these states I keep their velocity locked to that value. Could this have something to do with the problem?


Tween on the motion of this.movement.rollVelocity (to which x velocity is entrained):

this.tweens.roll = game.add.tween(this.movement).to({rollVelocity: dir * PLAYER_ROLL_SPEED()}, 50, Phaser.Easing.Exponential.In, false).to({rollVelocity: dir * PLAYER_SPEED()}, 300, Phaser.Easing.Quartic.In, false);    this.tweens.roll.start();

PLAYER_SPEED() and PLAYER_ROLL_SPEED() are on the order of 700-1400


2) After upgrading to 2.2, the character "bounces" in a strange way when they land, but only sometimes. If I watch the y velocity, it goes to 0 when they hit the ground, as expected, but then spikes to 13.333 a few times. When you crouch the character (down arrow), it does the same thing but for occasional single frames it goes to 26.666 on some frames, and 13.333 on others. This leads to a weird sort of bouncing. If you open the console right now, it will simply print the y velocity every frame so you can see this happening.


3) I am using the camera function FocusOnXY to move the camera around relative to the character. In this way I am getting a more complicated type of movement out of it that is not just locked to the character. After the upgrade, it seems to be somewhat choppy, as if it is not updating as fast as the character is. I suspect this is due to the decoupling of the update loops and the physics system. I wonder if there is a way around this?


For any insight you are able to give, I am extremely grateful. Thank you. If you need any additional information from me, please let me know.

Link to comment
Share on other sites

Would it be possible to put a flag on the arcade body that would cause it to change the exact method of its collision detection like this:


Instead of checking only the delta position of the body, it would instead check each position pixel by pixel. So, if the bodies velocity would propel it forward 10 pixels, instead of just checking the collision of the body moved forward 10 pixels, it would check 10 times, moving the body 1 pixel each time.


I realize this is far more expensive, but my thinking is that if there was just a flag that sent something into this mode, it could be used sparingly. For instance, I would only need to turn this flag on as the character was rolling or doing something that caused her to move exceptionally fast.

Link to comment
Share on other sites

  • 2 weeks later...

I tried to write a simple game with Phaser 2.2.1 but my character easily fell through the floors. If you jump about 30 times at least one time he'll fall through the platform. It worked well with Phaser 2.0.1.


I had to adjust game.physics.arcade.OVERLAP_BIAS from the default of 4 to 10 to make this go away. It doesn't seem like a very satisfactory solution though but at least I don't have to throw my work away or port to another game engine. For now at least.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...