Best Practices When Programming

On this page we are going to cover some "best practices" when programming your game, and at the same time explain a little bit about the inner workings of GameMaker. Before continuing, however, it is worth noting two very important points:

With that said, lets move on and look at some general tips for writing good GML code that you can apply at any time...

Programming Style

Use Local Variables

Arrays

Data Structures

Collisions

Texture Swaps And Vertex Batches

Particles

Surfaces

 

Apart from the main things mentioned above, there are other more general things that can help with performance and that are considered "good practices" too:

But, as we mentioned at the start of the page, all these optimisations are optional and if your game runs fine with 60 vertex batches, 80 texture swaps, additive blending, etc., then don't worry about it too much! Just keep these things in mind when programming your next game...