OFFICIAL Tutorial Guidelines and Template

Nocturne

Friendly Tyrant
Forum Staff
Admin
Here you can post tutorials that you have written or recorded for everyone in the community to learn from. All tutorials must be free and threads posted should follow the template given below. Code should use semicolon line termination and appropriate indentation. And it should have sufficient explanatory comments. This improves code readability and promotes good coding practice. Check this pinned topic below for some examples.

This forum is moderated, meaning that after posting your thread it will not be visible until a moderator approves it. Threads that do not use the provided template, or use poor coding practices, or that the staff find inappropriate or of little use will be removed and an alert sent to the user to inform them.

Below is the Thread template that must be used when creating a new thread. It is designed to make it easier for both users and staff to see what the tutorial is about and give easy and immediate access to links and downloads:


TOPIC TEMPLATE

GM Version: <Version Of GM used to make the tutorial>
Target Platform: <Target platform/s (iOS, Android, etc...) for the tutorial. Use ALL for general tutorials>
Download: <Direct link to the download or the Marketplace. Use N/A if there is no download>
Links: <Additional links for videos or extra information. Use N/A if not applicable>

Summary:
<A brief one or two line summary describing the tutorial>

Tutorial:
<The main body of the tutorial. If the tutorial is a video then it should go here, embedded using the Media button in the editor or the bbcode [MEDIA=youtube]oHg5SJYRHA0[/MEDIA]>


GM Version: GM7
Target Platform: All
Download: http://www.host-a.net/u/Mark13673/ObjectCreating.gmk
Links: Original Topic

Summary:
This tutorial is basically an RTS building example aimed at teaching you how to use Parents, create buttons, use global variables, and permit user interaction.

Tutorial:
The example itself should be good for beginners in GML as I have taken the time to comment every single bit of code so that at all times you can open an object and see exactly what it does, what it's for and how it does what it has to do. So if you are just starting in GML then this may be a bit complex but with a bit of reading of the manual and a bit of practice I'm sure that you will get it!

In this example I have made three button objects that, when pressed, create a mask object. This object uses the sprite of the instance to be created (given to it by the button object) for collision checking so that the player can see precisely where he can and cannot place the selected building. In the above screenshot, you can see that the mask object on the left is red to indicate that the building cannot be put there. This is because by giving the mask object the sprite of the object that we wish to create, we can then do precise collision checks using that sprite and have image_blend change the colour of the sprite if there is a collision.

559f[1].png

The buttons themselves are three different objects, but they share a common parent. What is a parent? Well, it is a special object that...

<SNIP - further tutorial text...>

So that's it! A simple example but with lots of juicy details that I hope helps everyone who downloads!

General forum rules and guidelines apply too.
 
Last edited:

Let's Clone

Member
A video tutorial of mine was removed because I did not terminate my lines of code with a semicolon. I don't understand the issue with that, but I'm happy to make the correction.

Would it be possible for you to update the template/guideline to mention this detail? As GML does not require semicolons, it was a big surprise to see my post be taken down for this reason and I think it would be nice for others to know ahead of time.

Thanks,
- Steven French
 

chance

predictably random
Forum Staff
Moderator
As we discussed by PM, you changed your project file to include semi-colon line termination, so I approved your post. Thanks for the fast response.

And your suggestion about more explicit guidelines is a good one. I'll discuss this with Nocturne.

EDIT: The guidelines have been updated.
 
Last edited:

Joe Ellis

Member
I think the rules should allow nutritious code to be posted here regardless of the "semicolon at end of every line" rule, cus it doesn't actually make any difference in gml; semicolon termination is only required in a very few circumstances. I agree that it makes good practice with most other languages, but it will never stop the useful code from running in gml.
Everyone should understand when & why semicolons need to be used though. (In gml, at least)
A semicolon ends an operation, so in the case of using "++variable" then on the next line: "if other_variable = value"
That syntax doesn't make sense\can't work in any way.
This is one of the only cases where it's needed in gml though, which is why I wanted to politely ask if the rule could be changed?
I don't really mind adding a ; onto every line of my code before I post a tutorial here, but as you can imagine, it's pretty inconvenient and menial.
 

Evanski

Raccoon Lord
Forum Staff
Moderator
I think the rules should allow nutritious code to be posted here regardless of the "semicolon at end of every line" rule, cus it doesn't actually make any difference in gml; semicolon termination is only required in a very few circumstances. I agree that it makes good practice with most other languages, but it will never stop the useful code from running in gml.
Everyone should understand when & why semicolons need to be used though. (In gml, at least)
A semicolon ends an operation, so in the case of using "++variable" then on the next line: "if other_variable = value"
That syntax doesn't make sense\can't work in any way.
This is one of the only cases where it's needed in gml though, which is why I wanted to politely ask if the rule could be changed?
I don't really mind adding a ; onto every line of my code before I post a tutorial here, but as you can imagine, it's pretty inconvenient and menial.
True but i think it is an influence thing, bad practices lead to people making bad code
The YYC wont even work unless you've been using ;
 
Last edited:

chance

predictably random
Forum Staff
Moderator
This is one of the only cases where it's needed in gml though, which is why I wanted to politely ask if the rule could be changed?
I don't really mind adding a ; onto every line of my code before I post a tutorial here, but as you can imagine, it's pretty inconvenient and menial.
It's a fair question. Personally, I feel using semicolon line termination is a useful habit for beginners -- especially those who may go on to other languages. But even in GML there are good reasons to use semicolons. They can add clarity and reduce ambiguity. Besides, you may want to use the YYG compiler at some point. Like you said, adding them later is a pain.

YYG dev guys use line terminations. The YYG manual uses them. The tutorials posted on the YYG website use them. So it makes sense for the GMC Tutorials to use them also.
 

FrostyCat

Redemption Seeker
YYC is hardly the only place where people get bitten by semicolon-free GML. There are also reports of it being wildly misparsed like this one and this one. There is virtually no boundary to how pathological semicolon-free GML can get, and news of such pathologies crop up on a regular basis.

On top of that, as a Q&A responder, I can't help but notice a constant pattern with semicolon-free GML. People who buy into the myth of semicolon-free GML chronically have higher incidence rates of bugs with their code, less code portability and hygiene, more trouble learning other languages, and lower retention rates. The original poster in the first example above insisted on a semicolon-free policy with his own code. He did not last as a GML developer.

Not everyone likes them, but the current iteration of GML absolutely needs semicolons for consistent behaviour. Novices don't need "nutrition" preaching needless parser pathologies into their development lives. The semicolon rule for tutorials needs to stick, and if this means less "choice" for fast-and-loose authors, so be it.
 
The original poster in the first example above insisted on a semicolon-free policy with his own code. He did not last as a GML developer.
Are you talking about @Let's Clone ? Because he's still happily developing. He's posted new video tutorials a few weeks ago.

Regardless, what kind of gatekeeping talk is this? ๐Ÿ˜„ "..He did not last as a GML developer". ๐Ÿ’„๐Ÿ‘„
Geezy-pete, this forum's gotten elitist. ๐Ÿ˜‹

The semi-colon, vs no-semi-colon debate isn't worth getting heated over, and it really *doesn't matter*. Just stick with one and go with it. The underlying knowledge of how that gets interpreted is the significant factor. YYG's has gone with using semi-colons, and now they've keeping that consistency through to the (Unofficial) Tutorials on the forum is understandable.. (although personally, I'd question if it's a good policy for them to enforce across unofficial, user generated tutorials.. one would wonder if they're setting the ground work for eventually enforcing strict use of semi-colons).

But lots of other teams go with no-semicolons. And that's fine. (Probably the highest profile one is Github, going with a no-semicolon standard for their internally developed JS).
 

FrostyCat

Redemption Seeker
Are you talking about @Let's Clone ? Because he's still happily developing. He's posted new video tutorials a few weeks ago.
I'm not. I'm talking about the original poster from the first of these two examples:
YYC is hardly the only place where people get bitten by semicolon-free GML. There are also reports of it being wildly misparsed like this one and this one. There is virtually no boundary to how pathological semicolon-free GML can get, and news of such pathologies crop up on a regular basis.
That account (DragonDePlatino) is no longer active, and there is no sign of any more GM content from that person.

Regardless, what kind of gatekeeping talk is this? ๐Ÿ˜„ "..He did not last as a GML developer". ๐Ÿ’„๐Ÿ‘„
Geezy-pete, this forum's gotten elitist. ๐Ÿ˜‹

The semi-colon, vs no-semi-colon debate isn't worth getting heated over, and it really *doesn't matter*. Just stick with one and go with it. The underlying knowledge of how that gets interpreted is the significant factor. YYG's has gone with using semi-colons, and now they've keeping that consistency through to the (Unofficial) Tutorials on the forum is understandable.. (although personally, I'd question if it's a good policy for them to enforce across unofficial, user generated tutorials.. one would wonder if they're setting the ground work for eventually enforcing strict use of semi-colons).

But lots of other teams go with no-semicolons. And that's fine. (Probably the highest profile one is Github, going with a no-semicolon standard for their internally developed JS).
I'm opposed to semicolon-free GML PRECISELY because I know how it gets interpreted --- not consistently at all, with the constant threat of lines bleeding into adjacent ones or getting spat back out on YYC/HTML5. If I'm being genuinely elitist, I'd encourage the semicolon-free style, and let the unwritten rulebook of "what kinds of semicolon-free code misbehave" bite novices when they least want it. Every time someone says their code works on YYC/HTML5 only after adding back omitted semicolons, or when the wild misparses crop up, that's more evidence in favour of enforcing semicolons in tutorials.

By the way, GitHub is working with JS, not GML. If GMS 3 revamps its parser to put newlines on consistent, equal footing with semicolons the same way V8 does with JS, then I can consider supporting semicolon-free GML in tutorials.
 

Let's Clone

Member
Are you talking about @Let's Clone ? Because he's still happily developing. He's posted new video tutorials a few weeks ago.
I thought he was talking about me as well XD. I'm still very much here and happily developing, although I have been sparse with content this last year.
Thanks for havin' my back tho. I'm newly recovered from a bad cold and the rest of Bomberman should be up soon ^_^

I still think that requiring semicolons needlessly is a naive solution to a falsely-perceived problem. When I teach GML, I teach GML. When I teach JS, I teach JS. Every language has it's own rules and I find it helpful and even necessary to point out these rules and differences. I don't want some Orwellian set of pseudo-rules that EVERY language has to preach (IE: I'd like it if people would stay out of my curriculum, especially if they don't pay me. And if my content doesn't educate then my channel will surely die by it's own faults).
I'd rather take it upon myself as an educator to inform people of the nuances - the beauty of coding that I'm sure most of us are infatuated with.

But, as I've proven with my actions, I am willing to concede to this rule and continue to put semicolons at the end of every line.
I imagine my audience is more confused by the numerous ":wq" that I type out because my silly brain struggles to stay out of VIM =P

If GM decides, in a later version, to require ';' to terminate a line of code then I will see it as every other language that does so. Until then, the rule is as silly as the English language... "I before E, except after C, and never after labor day"
 
That account (DragonDePlatino) is no longer active, and there is no sign of any more GM content from that person.
Conclusion; the semicolon's got him. Musta been. ;)

...
I mean it coooould be that he's just busy being a talented game artist, but that's just speculation.

I'm opposed to semicolon-free GML PRECISELY because I know how it gets interpreted --- not consistently at all, with the constant threat of lines bleeding into adjacent ones or getting spat back out on YYC/HTML5. If I'm being genuinely elitist, I'd encourage the semicolon-free style, and let the unwritten rulebook of "what kinds of semicolon-free code misbehave" bite novices when they least want it. Every time someone says their code works on YYC/HTML5 only after adding back omitted semicolons, or when the wild misparses crop up, that's more evidence in favour of enforcing semicolons in tutorials.
Look, Frostry, there's a decent argument that YYG's should enforce semicolons strictly. Which they've had plenty of opportunity to do so, with the move from GM8 to GMS to GMS2. But they haven't done it.

And so if no-semicolon code is a feature of GM, it should prooobably be treated as such. This is a YYG's problem.. not the people who use that feature.

I still think that requiring semicolons needlessly is a naive solution to a falsely-perceived problem. When I teach GML, I teach GML. When I teach JS, I teach JS. Every language has it's own rules and I find it helpful and even necessary to point out these rules and differences. I don't want some Orwellian set of pseudo-rules that EVERY language has to preach (IE: I'd like it if people would stay out of my curriculum, especially if they don't pay me. And if my content doesn't educate then my channel will surely die by it's own faults).
I'd rather take it upon myself as an educator to inform people of the nuances - the beauty of coding that I'm sure most of us are infatuated with.
Tooo thick, @Let's Clone , you're slavering it on waaay too thick. :p ( It is fun to build $#!+ with code tho. )

I don't mind strict syntax. I do prefer it, but I do think the trend is towards less strict syntax.. and just making the languages more intuitive(especially with all the tooling that's around to assist developers now).

But GML is hardly that.. it's barely evolved in.. what, over 20 years? It's little more than a handy scripting tool for the GM environment. No biggie if people use/don't use ';'.
 

Let's Clone

Member
But GML is hardly that.. it's barely evolved in.. what, over 20 years? It's little more than a handy scripting tool for the GM environment. No biggie if people use/don't use ';'.
They took away our image editor :(
Surely it wasn't the best editor, but it had heaps of features that got dropped and I'm still salty about it haha.
 
Top