Reldens beta.32 - Animations!
A few days ago, there was a meetup on the "Web Game Dev" server (for those who don't know is this one: https://discord.gg/wFJgWnJV). I've got into the presentation because Endel from Colyseus was going to present the new Auth features, but sadly I've arrived late but got caught by the next presentation: BobbyD from DotBigBang (https://discord.com/invite/9GPQ58Y4aW).
I quickly realized he was a very experienced individual, so I asked him if he would mind taking a look at Reldens and giving me his opinion. He was more than kind, sparing some time for me. Among other things, he pointed out something I had never noticed: the player animation was kind of "jittery," and the camera movement was causing the background to "jitter" as well.
Been fully honest: I've always though the animation was like that because the movement itself, but OBVIOUSLY IT WAS NOT, by recording and slowing the game play BobbyD showed me how bad the "jitter" was in both cases.
Needless to say, it was time to get to work!
Took me some time, but finally I've fixed both issues:
- First, I addressed the background issue. Without much research, I stumbled upon a Phaser bug related to camera movement: https://github.com/phaserjs/phaser/issues/5018
By setting the camera "lerp" to something less than 0.04, the background now follows the player smoothly, and the interpolation prevents the "jitter" entirely. Though setting the camera without the "lerp" should also work, I decided to make the "lerp" values configurable so we can disable it at any point.
- As for the second issue, I initially thought it affected every sprite animation. However, after observing it in different scenes, I realized it was ONLY AFFECTING THE PLAYER! The "enemies" animations were running perfectly. After comparing the code, I found that some interpolations had been mistakenly removed. By removing a few lines, voila! The player animation was running smoothly now!
I will be releasing beta.32 tomorrow morning and will also update the demo (https://demo.reldens.com/) which, as of now, still features the "broken animations", so enjoy their final moments! :D
Again, special thanks to @bobbyd!
UPDATE: The new beta.32 is out! Enjoy!