Speed considerationsIf you are making complicated games you probably want to make them run as fast as possible. Even though GameMaker does its best to make games run fast, a lot depends on how you design your game. Also, it is rather easy to make games that use large amounts of memory. In this page we give some hints on how to make your games faster and smaller.
First of all, look carefully at the sprites and backgrounds you use. Animated sprites take a lot of memory and drawing lots of sprites takes a lot of time. So make your sprites as small as possible. Remove any invisible area around it (the command Crop in the sprite editor does that automatically). The same applies to background images. If you have a covering background, make sure you switch off the use of a background color.
If you use full screen mode, make sure the size of the room (or window) is never larger than the screen size. Most graphics cards can efficiently scale images up but they are more slow in scaling images down! Whenever possible, switch off the cursor. It slows down the graphics.
Also be careful with the use of many views. For each view the room is redrawn.
Besides the graphics, there are also other aspects that influence the speed. Make sure you have as few instances as possible. In particular, destroy instances once they are no longer required (e.g. when they leave the room). Avoid lots of work in the step event or drawing event of instances. Often things do not need to be checked in each step. Interpretation of code is reasonably fast, but it is interpreted. Also, some functions and actions take a lot of time; in particular those that have to check all instances (like for example the bounce action).
When you need complicated processing (for example for advanced AI), you better write a DLL for this in a different language and create an extension package out of this to import the DLL using the functions described in the page on Using DLL's.
Think about where to treat the collision events. You normally have two options. Objects that have no collision events are treated much faster, so preferably treat collisions in those objects of which there are just a few instances.
Be careful with using large sound files. They take a lot of memory and also compress badly. You might want to check your sounds and see whether you can sample them down.
Finally, if you want to make a game that many people can play, make sure you test it on a number of different machines, in particular also older machines.