Welcome to Bug Bash!
Today’s bug is all about the Down Stab / Pogo-sword attack.
- Down Stab allows the player to attack downwards and bounce off damaging instances like a Pogo Stick
The issue/s:
Bounce height from a flat surface is inconsistent. This leads to level design issues in tight spaces where bounce height needs to be consistent.
Sometimes the player falls too far into a damaging object and the player gets hurt when they should bounce safely.
Initial thoughts:
The cause of both these issues is likely lag spikes. Less powerful machines sometimes see drops in frame rate and to compensate for this the game speeds up and slows down as frame rate fluctuates. This means movements become more extreme in some cases. Moving downwards to fast could cause the player to fall lower into a damaging object and take damage instead of safely bouncing. This could also cause the initial bounce location to vary in height making the total bounce height higher or lower in some cases.
Intended solution:
Collision detection currently happens within damaging instances themselves. When a collision is detected with the players sword, they tell the player to bounce. Change this so that the player tests for collisions between the sword and damaging instances just before testing it’s own collisions.
If a collision between the sword and enemy is found, pass on damaging instance to the player to process positional values in order to provide a precise and consistent bounce location.
Within player’s collision detection, test to see if the player is currently executing a down stab by looking at speed and attack state.
If doing a down stab, test current and previous position. If previous position is outside of the collision, revert position and move down into contact with damaging instance for precise and consistent bounce positioning.
Results:
After applying the intended solution the effects were as expected, but we only fixed one of the two bugs. The bounce position is much more accurate with an error margin of about one pixel. However when the game lags the player still bounces too high. It seems the issue might be related to gravity and jump power itself, rather than bounce location alone.
The new bounce method did fix the issue of the player falling too far into damaging instances though. So we’ve managed to successfully squash one of the two bugs.
In order to fix the bounce height issue we’ll need to look further into the jump physics to try and figure out why there is a height difference when the game is not running at a full 60 fps.
That’s it for this Bug Bash. Did you enjoy this post? Want to see more like it? Let us know by answering the poll options below!
Have you played The Cardinal Crusade Demo yet? It features the entire first world!
5 comments