How I set up my GM projects

Phil Strahl

Member
I thought I record a short video outlining my ways of setting up Game Maker projects for myself and what's my reasoning behind the way I structure my code. In the end, it went beyond an hour and even after editing it didn't get much shorter. (Tip: Watch it at double speed!)

I hope it's of interest to anyone here.

GM Version: GM Studio (all versions)
Target Platform: this version is Windows, but this approach applies to other platforms
Download: n/a
Links: see video below

In this video, I demonstrate how to set up a project with objects that are just driven by code. Aspects I cover are
  • The concept of singletons
  • Where to perform all the initialization of your game
  • How to set up an input controller object (and why that's a good idea)
  • A useful way to prefix your debugging strings to know what object they belong to
  • How and why to defer the initialization of objects to the step event
  • A short look at delta_time and how to use it for framerate-independent counters/alarms
  • How and why to modularize certain actions in the step event using flags

 
Last edited by a moderator:

chance

predictably random
Forum Staff
Moderator
This isn't a traditional tutorial, in the sense that it discusses one particular programming issue. Instead, it covers "general practices" that can improve your productivity and reduce some of the workload associated with building new projects. Most experienced GM users have their own version of these techniques. But it's still worth seeing how others do it.

This particular video is fairly comprehensive, and touches on many setup issues we all face. And the video is presented well, with excellent production value. Definitely worth watching, even if you're an experienced GM user. Always fun to compare your techniques to how others do it.
 

GMWolf

aka fel666
This is pretty interesting, and does give some insight in other ways to set things up in GM.

Though there is something bugging me:
Why bother with using custom variable names, when GM already has the.
Like replacing "sprite_index" with "sprite_current". They pretty much have the same functionality...

I'm also starting to make use of the room editor a lot more. I always resize my objects and change their colors in the room editor. The use of default values and the one time init kind of ruins it.

Still, a lot of useful material there :)
 

Phil Strahl

Member
Why bother with using custom variable names, when GM already has the.
Like replacing "sprite_index" with "sprite_current". They pretty much have the same functionality...
It's just for my personal text skimming: When I see a variable that's ending with "_current" I instantly know that it's the current one. When it ends with "_index", in my coding I usually think "oh, it's for some kind of array".
 
P

PrivateDonut

Guest
I learned quite a few things from this video, which could make my future development projects easier. Thank you for taking the time to create this.
 

MCHLV

Member
I enjoyed the tutorial. It gave me some perspective. I watched it a week ago and now I am trying most of this on a new very short project.
I find it useful. In particular heritating and duplicating objects is easier as everything follow the same logic and thanks to the initialization in the step. (One thing to be cautious of is to check objects are initialized for all calls to collision / with etc). The project is easy to read with only create / step / draw events. I also like the parent variable to clean everything on destroy.
Thank you for this !
 

Phil Strahl

Member
I enjoyed the tutorial. It gave me some perspective. I watched it a week ago and now I am trying most of this on a new very short project.
I find it useful. In particular heritating and duplicating objects is easier as everything follow the same logic and thanks to the initialization in the step. (One thing to be cautious of is to check objects are initialized for all calls to collision / with etc). The project is easy to read with only create / step / draw events. I also like the parent variable to clean everything on destroy.
Thank you for this !
I'm glad you found much in there that's useful in your own projects! :)
 
Top