60 FPS hotfix for Windows 10/11 users
Hello. This is a patch for people who are using Windows 10 or 11. If you are on a Windows 7, 8, 8.1, or older PC, then there is probably no need to download this update.
In short:
If you are using Windows 10 / 11, the game has most likely been playing at 50-55 FPS despite technically running at 60 FPS, or 400-500 frames unlimited. This is not the fault of any hardware, drivers, or bad programming on my end, but instead the fault of a certain Windows update released in 2021 that changed the way the system thread scheduler worked and basically neuters the game's performance.
This update is the same version as 0.6.0, but it includes in the zip folder a .dll (courtesy of omicronrex on Github) which fixes the lag issue. Your game should now play at a steady 60 FPS with v-sync on or off instead of running at ~80% speed.
Long version:
I'd like to apologize to all the Windows 10/11 users who may have had a bad time with the game because of slow speed. Unfortunately, I never encountered this problem as I am still using a Windows 8.1 computer, and said issue only occurs with later OS versions.
I had noticed in some recordings that the game seemed to be running somewhat slower than it should be. Weapons like the autocannon fired far less rapidly, and the movement of the player seemed to be sluggish even when boosting. My assumption was that this was just a side-effect of recording software, or people with low end machines like myself simply struggling to handle both capturing and rendering the game at the same time. A few people had streamed the game playing at the correct speed as well, so I just moved on assuming this was what had happened.
However, looking into it further with people using higher end gaming machines as well as playing with the alternate v-sync settings, it became clear that the game was indeed running slower than it should. Just fast enough that it may seem like an intentional speed, but also just slow enough that it may be frustrating to players.
So, what was the cause?
From omicronrex on Github:
By default, in modern Windows, the thread scheduler resolution is about 15.4ms. This means that if a program tries to skip time to save power, it'll only get invoked again in the next possible interval of 15.4 milliseconds. A coarse resolution means threads sleep very imprecisely, leading to massive frame drops and stuttering in game maker games as they fail to present frames on time. By setting a finer resolution like 1ms, we make sure the game thread is woken up on time to present every frame.
Every 16ms (at 60fps), GameMaker will perform the necessary calculations for one frame, and wait for the next 16ms interval. The way this waiting happens is the problem here. You can call a function in Windows to Sleep for a certain amount of time, in a power-efficient manner. However, this Sleep function is not very accurate. For this reason, GameMaker will take the time remaining until the next 16ms interval, subtract the sleep margin, and Sleep for that amount of time. For the rest of the interval, it continuously checks whether the time has elapsed, i.e. it busywaits. This uses 100% of one CPU core.
The inaccuracy of Sleep gave many users bad performance issues, especially after its behaviour changed in certain Windows updates. As the sleep margin was the only known way to affect this, it became consensus that the sleep margin should be set to a high enough value that it would busywait for most, if not all, of the interval. This is a massive waste of CPU resources, and will drain the batteries and burn the thighs of laptop users.
Thanks to this wonderful fix written by them, the game should now run correctly on Windows 10 and 11. If you still have older versions of the game that you want to play or other Game Maker games that seem to be lagging, you can also just add the DBGHELP.dll to the folder containing the .exe. In the future I'll be using a plugin developed from this same fix to also bundle it with the actual game code so there's no need to check/install the .dll, but for now this is just a quick fix.
Files
Get Project Landsword
Project Landsword
Tactical stealth meets top-down mecha combat and excessive destruction
Status | In development |
Author | MezzSoft |
Genre | Action |
Tags | 2D, mecha, Mechs, Pixel Art, Robots, Sci-fi, Shoot 'Em Up, Tactical, Tanks, Top down shooter |
Languages | English |
More posts
- LS Update V.0.6.06 days ago
Leave a comment
Log in with itch.io to leave a comment.