Gw Temp


Tutorial - 'Speeding Up And Shrinking Your GM Game' by Quest-Master

An item about Gamemaker posted on


A nice indepth look at how to keep your Gamemaker file sizes low and avoiding lag that plagues many GM games.


I've noticed that GM is *finally* getting a better reputation in the community, and found a lot of people are turned off because of GM's supposed lack of speed and size handling.
Because of this, I've compiled a list of how to keep file sizes low, and avoiding the evil LAG. Also, more important factors are highlighted in red exclamation marks. (!!!)


1. This is a sort of obvious one, but use the smallest formats possible. Some people are using gigantic MP3s, WAVs, and BMPs, and are publishing them. The games are quite short, but these formats kill the filesize. Formats to use include: PNGs, GIFs, and MIDIs.

2. Limit things in the step event of your object. This can lag your game a huge amount too.

!!! 3. This might come to you as a huge surprise. Everyone at these forums tells you "go use GML, not drag-'n-drop." Actually, GML takes longer to interpret by the GM engine then it does to interpret the D&D events. This has already been proven at the GMCommunity, so there is no need to argue on it. Here's an explanation: GM has its own engine that reads the D&D or code. The D&D is already in the state of what GM interprets, so its fast. Coding, however, must first be converted into the state of the D&D events to be read by the engine. What my stand on this, is this: continue using the code. Make functions by simply writing custom scripts in the scripts folder too. Use these instead of writing the same functions over and over again, and this shouldn't be a problem, since the functions can really speed up things.

!!! 4. A new feature, which is in the newer versions of GM, and can sometimes still be used with GM5, is using external resource loading. What this is, is place your images and music files outside of the EXE and load them. Obviously, a lot of you know how to do this, but here's something you think about: what if you want to encrypt the external files? Use the new compression DLLs, such as zLib, and use them to make the resource files smaller, and encrypted. The reason this works, is because the EXE doesn't have to load all of the resources from one file. It just loads them out of your computer, which is very fast

5. Try to set your sprites and sounds to load on use. Don't do it when there are a bunch of sprites and sounds going on, but do it for sparingly used sprites and sounds. This'll reduce that horrid loading time you get when starting a GM game.

!!! 6. Here's another surprise. Did you know that an empty GM .EXE is about 1.38 megabytes? Empty. No sounds, no images, no rooms, no scripts. This should tell you: you need to save as much space as you can when making your game. Trust me on this one. You can try it yourself

7. Limit your use of precise collision checking. I believe that most of this time this kind of collision checking is useless in 2D game development because, obviously, everything in a 2D game is a rectangle. So you don't need that option a lot.

8. I said this earlier, but let me explain it a bit more. If you think you are going to use a script a lot, keep it as a custom script and make it a function. If you don't know how to do this, write what you want in a script in the scripts folder. Whatever its name is, for example, "Word," and you want to use the code you put in that custom script you wrote previously, do this in your object: Word();


I hope very much that this guide answered many of your questions, and aids you in making your game faster and smaller. If you have any questions, ask them here, and me or someone else should answer it soon.

Also: there is a link to this at the forums--