VadimBoev / FlappyBird

Less than 100 Kilobytes. Works for Android 5.1 and above
2.14k stars 135 forks source link

Game speed is affected by display refresh rate #1

Closed overflowy closed 1 month ago

overflowy commented 1 month ago

Hi Vadim,

First, thank you for making this ❤️

On my Pixel 7 Pro @ 120Hz display refresh rate, the game is so fast it is unplayable:

https://github.com/user-attachments/assets/fc7923f0-aa89-4050-b904-9b95b68a34be

Switching to 60Hz fixes the issue

VadimBoev commented 1 month ago

Hi. It's true. I have not studied the problem with the speed of the game on different devices. I saw it myself when I tested it on Xiaomi Red Note 10 Pro and Samsung Galaxy M31s. Maybe someday I'll be able to figure out the reason and even out this moment. Despite the fact that these two devices had 60 Hz

xTacobaco commented 1 month ago

Sounds like you need to implement delta time for the physics/game code. This would be implemented in your render loop (game loop). https://en.wikipedia.org/wiki/Delta_timing

rany2 commented 1 month ago

For a moment I thought I had a "skill issue" moment, but I can confirm setting it to 60Hz fixes it. I think this issue should stay open to avoid duplicates.

VadimBoev commented 1 month ago

Sounds like you need to implement delta time for the physics/game code. This would be implemented in your render loop (game loop). https://en.wikipedia.org/wiki/Delta_timing

Yes, I've already seen it, thank you. There will be time, I will study this issue and correct the situation

VadimBoev commented 1 month ago

Hi Vadim,

First, thank you for making this ❤️

On my Pixel 7 Pro @ 120Hz display refresh rate, the game is so fast it is unplayable:

video_2024-09-22_12-28-10.mp4 Switching to 60Hz fixes the issue

Please check the new release, the problem seems to have been solved: https://github.com/VadimBoev/FlappyBird/releases/tag/v1.1

rany2 commented 1 month ago

Unfortunately it's not fixed for me.

overflowy commented 1 month ago

Hi Vadim, First, thank you for making this ❤️ On my Pixel 7 Pro @ 120Hz display refresh rate, the game is so fast it is unplayable: video_2024-09-22_12-28-10.mp4 Switching to 60Hz fixes the issue

Please check the new release, the problem seems to have been solved: v1.1 (release)

I downloaded and installed the latest version (after uninstalling the previous one)

I confirm it has not been fixed

SRC267 commented 1 month ago

Yea, same here. Can confirm

WadeHusky commented 1 month ago

Huawei Nova 10 pro (120Hz) I can say that the problem is not solved. Delta time still doesn't work correctly...

120 fps -> speed x2

Unfortunately, I will not be able to record the phone screen while playing, since when I turn on recording, the frame rate drops to 60.

VadimBoev commented 1 month ago

Hi Vadim,

First, thank you for making this ❤️

On my Pixel 7 Pro @ 120Hz display refresh rate, the game is so fast it is unplayable:

video_2024-09-22_12-28-10.mp4 Switching to 60Hz fixes the issue

Please check, users report a solution to the problem: https://github.com/VadimBoev/FlappyBird/releases/tag/v1.2

overflowy commented 1 month ago

I just tested it, speed seems fine, but some inputs get ignored:

https://github.com/user-attachments/assets/7518d536-aa15-41f0-9379-65e8fe3c4296

WadeHusky commented 1 month ago

Hi Vadim,

First, thank you for making this ❤️

On my Pixel 7 Pro @ 120Hz display refresh rate, the game is so fast it is unplayable:

video_2024-09-22_12-28-10.mp4 Switching to 60Hz fixes the issue

Please check, users report a solution to the problem: https://github.com/VadimBoev/FlappyBird/releases/tag/v1.2

Vadim, thank you! this actually solved the game speed problem at 120 fps!

VadimBoev commented 1 month ago

I just tested it, speed seems fine, but some inputs get ignored:

video_2024-09-23_17-26-09.mp4

I have moved the topic due to a new problem https://github.com/VadimBoev/FlappyBird/issues/8

thestretivibity commented 1 month ago

You need to multiply each movement by time.deltaTime (which in your case you need to calculate based on last few frames). Nevertheless it's incredible what you've created!

VadimBoev commented 1 month ago

You need to multiply each movement by time.deltaTime (which in your case you need to calculate based on last few frames). Nevertheless it's incredible what you've created!

I have already improved the algorithm, everything is fine