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.
Don't use the "Solid" option in Game Maker
When a collision between Solid instances occurs, the following happens:
- Both instances are set to their previous positions (even if they are on paths)
- The Collision Events for both instances are triggered
- Both instances are reset to their new positions
- 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!