Post tutorial RSS Tips from the Game Maker’s Companion

Learn about the very nature of Game Maker itself from these tips handpicked from the Game Maker's Companion! Learn ways to optimize your games and never use the “Solid” option again!

Posted by on - Basic Other

Having just read the Game Maker's Companion, I've compiled a list of "tips" that concern the program Game Maker itself and can be applied to any project. Most of these have to do with optimization:

  • Don't use precise collision detection wherever possible
  • Avoid setting variables to strings (text) wherever possible because it is more difficult for Game Maker to interpret.
  • Make use of the Constants feature so that you can make your programming easier to understand. For example, create a constant called "WALKING_SPEED" to a value of "5". This way, you can set "hspeed" to a value of "WALKING_SPEED" and Game Maker will read it as a value of "5". As an added bonus, you can easily edit the value of constants without having to dig through your code to find where you defined such things as "WALKING_SPEED".
  • Avoid giving Objects Collision Events wherever possible because Game Maker performs a collision check every frame for these instances.
  • Avoid use of Global variables
  • Run your game at 60 frames per second and enable "Use synchronization to avoid tearing" for best visuals!
  • When you use a Key press event to change between Objects, sometimes Game Maker executes a "key press" event for both the first Object and the one it changes into, and sometimes it does not, all depending on how Game Maker stores the Object internally.
  • When you leave a "move_to_contact" distance as "-1" this "arbitrary" distance is 1000 pixels.
And last but most importantly:
Don't use it!

Don't use the "Solid" option in Game Maker

When a collision between Solid instances occurs, the following happens:

  1. Both instances are set to their previous positions (even if they are on paths)
  2. The Collision Events for both instances are triggered
  3. Both instances are reset to their new positions
  4. Another collision check is made, and if the instances are still colliding then they are once again set back to their previous positions.

As you can see, this is a less than optimal way of handling collisions. The Solid option is designed purely for "beginners", and should not be used for sake of efficiency and control. Unfortunately the only way to fix this (as far as the book was concerned) was to use a script.
But with the BGP Library Extension, you don't need this script! The "Jump to Previous" and "Move to Contact with Instance" Actions will fix this "Solid problem"!

I hope this has been a helpful collection of tips to any and all that use Game Maker, and I fully recommend reading the Game Maker's Companion to learn about all of this and more.

Good luck Game Making!

~Bluish-Green Productions

SabreXT - - 296 comments

I don't get why the use of global variables is frowned upon so much. No one ever gives an explaination beyond "just don't" which makes me question the wisdom of it. Sometimes they are extremely usful. I also read that it's the only reliable and effecient way to carry variables between rooms which is sometimes what you want.

The library extension seems usful. I don't use drag and drop myself but it seems usful. Did you make it yourself?

Reply Good karma Bad karma+1 vote
punkrockseb - - 3 comments

dont use globals because they take up the most space from the variabales.
local use less memory and variables in script take the least amount of memory

Reply Good karma Bad karma+1 vote
BluishGreenPro Author
BluishGreenPro - - 534 comments

Yes, I made the library myself.
As for transferring variables between rooms, I find it easiest to make a single Persistent controller Object to handle everything. (Or multiple ones for different segments of a game).

Reply Good karma+1 vote
Guest - - 687,512 comments

This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.