• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Official GML naming conventions?

B

Big_Macca_101

Guest
Just curious to know if there is any form of official GML naming convention out there at all?

Just thought this may be useful to have out there considering almost all other programming language have an official naming convention.
 
D

dannyjenn

Guest
As far as I know, no. But for obvious reasons people tend to name sprites beginning with "spr_", objects beginning with "obj_", rooms beginning with "rm_", sounds beginning with "snd_", etc. (without such a convention you may inadvertently give two separate resources the same name...)

Since the built-in functions and variables are all written in all lowercase_with_underscores, that's what I do when making my own scripts and variables. But I think some people prefer to use camelCase instead. Other people use camel case only for their script names, in order to not confuse their scripts with their variables (I think this is how it's done in Java?) Likewise, some people name all their scripts begining with "scr_" in order not to confuse their scripts with variables, though I personally don't see much point in doing that. But whatever you do you should probably be consistent.

I like to use all CAPS for constants, in order that I can easily recognize them as constants. I see other people doing that as well, though none of GameMaker's built-in constants are like that.
 
obj_name ob_name o_name I've seen quite a few people do the oName method, which seems terrible. I use the _ in there as its easier to find things with search as well as string_pos("obj_", asset) methods to find and label things in game.
 
Last edited:
Z

zendraw

Guest
it depends on the project, if its a fast test project i dont bother renaming, if its a team project, you shuld talk with the others how to name stuff, if its an actual project, i go with o_ s_ snd_ fnt_, rooms i tend to just name them with the name 'forest' or 'castle' etc. otherwise rm_. its up to the situation or preference
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
The way built-in functions and variables are named in GameMaker is generally called snake_case. Shortness always varies by author, but official tutorials and example largely use "obj_", "spr_', etc. prefixes for resources, so you can count that as official.
 
B

Big_Macca_101

Guest
Thanks guys, was just curious considering im looking to make a few open source things and wanted to make them as universally readable as possible and maybe try and change around my coding style!
 
Top