Every known trick to fix performance issues with games developed with the GameMaker engine.
Table of Contents
How to Fix GameMaker Performance
This guide is meant to offer possibly performance-improving suggestions to be used with any of the games developed with the GameMaker engine as a whole.
GameMaker is not known as a very heavy engine. Games developed with this engine usually work on a wide variety of systems, from low-specs to powerful ones. Yet, sometimes users can run into baffling performance issues while running them. This leaves you with a big question:
Why does the game run like this and what can I do to make it run better?
Unfortunately, while Unity lets you modify several settings using command-line parameters and Unreal allows you to modify its configuration files and add you own engine commands into them, GameMaker is very limited when it comes to manual tinkering. In fact, a quick look at the official documentation regarding command-line parameters only shows very little to use in case of performance problems.
This guide tries to bring together a series of suggestions that can help you deal with the performance issues you might be having with games developed using this engine.
Step 0: Extract Game Contents (Zipped Games Only)
Sometimes, the executable you see in a game’s installation directory is actually a self-extracting (sfx) archive rather than what actually launches the game; examples being YumeCore and Gun Crazy. You can easily notice this by looking in a game’s installation directory: If you see only one executable and/or right clicking on it gives you the option to extract the file with 7-Zip or WinRAR, then you are dealing with an archive.
Now when you run the game, the sfx archive extracts the game files to a temporary directory and runs the real launcher. If you quit the game, the whole folder gets deleted as well. That makes manual configuration impossible as the GameMaker config file never stays there, so let’s fix this.
- Download and install either WinRAR or 7-Zip. In this guide I will assume that you are using WinRAR.
- Open the game’s installation directory.
- Right click on the self-extracting archive and select Extract Here.
- Delete the sfx archive after extraction or move it to another location. Then rename the game’s real executable to the name that was chosen for the sfx file so Steam can run the game correctly. If this caused problems, simply revert the name change and run the game from the installation folder instead of Steam Client.
Ensure the Game Is Running with the Correct Graphics Card (Multi-GPU Systems Only)
Some systems use multiple GPUs, such as laptops. Make sure that the game is using the correct one. Usually, forcing the game to use your powerful GPU from your graphics driver’s control panel is enough. But if you are using Windows 10 and above, you need to change the GPU from Windows settings, as it overrides your GPU’s control panel settings. Here’s how to do it:
- Go to this location: Settings -> System -> Display -> Graphics Settings.
- Under “Choose an app to set preference”, select “Desktop app” and click on the “Browse” button.
- Navigate to the game’s installation directory and select its executable file, then click on “Add”.
- The executable will appear in the list. Click on it and choose “Options”.
- Choose your GPU and click on “Save”.
Now run the game to see if its performance has gotten better.
Disable In-Game V-Sync
Sometimes, enabling in-game V-Sync can cause performance problems. Some examples are faulty implementation of it or the game’s framerate being below the monitor’s refresh rate. Disable V-Sync and see if the performance problems go away.
Do note that disabling V-Sync might cause screen tearing. In that case, simply force V-Sync through your graphics card control panel, or third-party apps such as Dxwnd, dgvoodoo or D3DOverrider.
Change “AlternateSyncMethod” Value in Config File
- Go to the game’s installation location.
- Find options.ini and open it with an editor (preferably Notepad).
- Find this line: AlternateSyncMethod=0.
- Change it into: AlternateSyncMethod=1.
- Save your changes.
If the config file did not have this value, then:
- Create a new line under the [Windows] line.
- Copy and paste this text there:
- Save the changes.
The end result should look something like this:
- Now run the game to see if it had any results.
Change “SleepMargin” Value in Config File
First things first, we have to talk about sleep margin and what it is. Here’s a thorough explanation gathered.
Please read the explanation below as it is important to know what this option does before modifying it. Do not skip it and complain afterwards.
Typically, a game runs at 60fps and a frame takes roughly 16ms to render. Every 16ms (at 60fps), GameMaker will perform the necessary calculations for one frame, and wait for the next 16ms interval. When the game is done rendering the frame, it sleeps for the rest of the time in a power-efficient manner. So, if it took the game 8ms to render, it sleeps during the other 8ms so the OS gets that time back and can save power, battery and run other things. The problem is, this sleep function is not very accurate and excessive sleeping results in OS crippling the application because it thinks the machine isn’t that busy and starts to power down the CPU and graphics card.
Sleep margin defines the minimum amount of time that the game has to wait before it switches to sleep function. By changing the number related to this setting (to 10 for example), the game will spend more of its time in a tight loop and run useless CPU cycles up until it has reached that mark, while waiting for the next frame. For example, if your frame takes 3ms to render and the sleep margin is set to 10, the CPU will run useless cycles for 7ms. And if a frame already takes 10ms to render then sleep margin will just do nothing.
However, while this causes a more accurate sleep timing and improves performance, it will also use more CPU time and power, burns more battery and powers up the fans. This is why sleep margin’s value was made user controllable. By default, this value is set to 1 in the engine, and has to be manually changed by either the developer or the users in case of performance issues. This way, everyone can experiment and set this value to what works for them.
Alright, now you know what sleep margin is, how it works and what it does. Let’s get to work.
- Open options.ini.
- Find this line: SleepMargin=.
- Change the value in front of it to a number between 1 and 15. If your game has performance problems, raise the number you see in the config file. For 60fps games, it is generally advised to not go over 15.
- Save your changes.
- Run the game to check the result.
Surprisingly enough, there were some cases that opening a video player, browser, or an additional game caused GameMaker games to perform better. You can try doing this as well, but I’m not sure about the results you’ll get.