Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Krom and Windows (C) builds playing at a higher speed with 120hz monitor. #3014

Open
moisesjpelaez opened this issue May 7, 2024 · 2 comments
Labels
bug This issue describes a bug

Comments

@moisesjpelaez
Copy link
Contributor

moisesjpelaez commented May 7, 2024

Description
Krom and Windows (C) builds are played at a higher speed. The Krom build also plays the audio at a higher pitch.

To Reproduce
Open the project's .wav files
Run the project with Krom Runtime.
Run the project with Browser Runtime.
Compare the differences.

Expected behavior
To run the game at a normal speed on Windows Builds (same speed as browser builds).

System
Blender: 3.6.10 LTS
Armory: 2024.02
OS: Windows 11 Home (x64)
Graphics card: NVIDIA GeForce RTX 3050 Ti Laptop

Test File
Can be tested with the sound example. The handle spins faster on Windows builds (both C and Krom) and the audio pitch is higher with Krom.

Note: I haven't tested Mac or Linux builds.

@moisesjpelaez moisesjpelaez added the bug This issue describes a bug label May 7, 2024
@moisesjpelaez
Copy link
Contributor Author

moisesjpelaez commented Jul 20, 2024

image
image

It seems the problem is in kha.System.refreshRate in Krom builds, as is giving me 60 instead of 120 as shown in the images.

@moisesjpelaez
Copy link
Contributor Author

moisesjpelaez commented Aug 28, 2024

After digging into Kha's code I realized the Display.frequency is hardcoded to 60 for all platforms except html5.

I found a temporary solution for my case, which is modifying Kha's Scheduler as shown in the images. Forcing the oneifhz variable to be 1.0 / 120.0 solves this speed issue.

image
image

I tested it with my:

  • main monitor: 120hz
  • secondary monitor: 75hz
  • android phone: 90hz (edit: I had to uncomment from line 54 to 62 -first image- in order to make it properly run here)
  • android tablet: 60hz

and the frequency keeps consistent across all those devices.

The audio issue with Krom is another thing that I'll open in a different issue.

@moisesjpelaez moisesjpelaez changed the title Krom and Windows (C) builds playing at a higher speed. Krom and Windows (C) builds playing at a higher speed with 120hz monitor. Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a bug
Projects
None yet
Development

No branches or pull requests

1 participant