View attachment 29381
Got a new YoYoGames tech blog for you all! Ever wondered what a Finite State Machine is or how to make one? We got you covered (both GML and DnD!)
It's been a while since I've wondered that... but yes, I have.
- initial state: put water on to boil, go to waiting state
- waiting state: if the water is boiling add pasta and go to cooking state otherwise keep waiting
- cooking state: test pasta by throwing it at a wall and if it sticks then go to serving state, otherwise keep cooking
- serving state: put the pasta on a plate and go to eating state
- eating state: eat the pasta and if finished and still hungry go to the initial state, otherwise end.
This is a pretty good introduction to "states" but you've over-simplified something fairly complex...
Take the
cooking state for example: I'd recommend setting an alarm to fire the "test pasta by throwing it against the wall" event otherwise you'll probably run out of pasta long before you get to the
serving state (and don't even get me started on the "cleanup" state.) Depending on the type of pasta you're using: I'd recommend waiting 8-10 minutes and then firing "test pasta" every 60 seconds thereafter. I'd also recommend working in a "stir water" event every few minutes or so during the
cooking state.
In all seriousness: This was a good read,
@Nocturne. Yes, it's a bit longer than average, but you did an excellent job of speaking to the lowest common denominator and providing links for those who wish to go "farther down the rabbit-hole." You couldn't have chosen a more
helpful example than using a FSM for menu buttons (something that
almost every game needs) and are done poorly more often than they're done well. The inclusion of project files/assets is always a nice bonus!
YoYo Games is the home of GameMaker. The easy to use powerful game engine that is the best for 2D games. Making games is for everyone.
www.yoyogames.com
I decided to check out the DND™ tutorial in addition to the GML tutorial.
First and foremost: Thank you so much for including a Drag and Drop™ version of this post. I genuinely appreciate it. I feel that DnD™ is very underrated - Go to the YYG Marketplace and search for "
DnD" or "
Drag and Drop" if you don't believe me.)
It makes me happy to see it getting the attention which it deserves. I'll be honest: I've "taken a quick look" at using DnD™ in GMS2 but I didn't look very closely. This tutorial was the first time that I've seen a "higher level" concept (macros, switch statements, etc.) in this format. YYG has done a terrific job of expanding
what's possible with Drag and Drop™ and has stayed true to it's original spirit (which is to allow someone who knows
nothing about programming to create their first game(s)
and learn the fundamentals of programming in the process... but on the other hand, it seems to have lost some of it's simplicity.
This is the first screenshot in the article:
This doesn't look much more simple than using GML to accomplish the same task... but I haven't used it so take that with a shaker of salt.
One thing that does bother me is how
tall it is (which made this difficult to read on a low-resolution monitor.) If I designed the UI: I would have used more horizontal space and a bit less vertical space. Take the Macros block for instance: I'd move
Value parallel to
Macro. Little things like that, and reducing padding/margins could really add up and make it much easier to skim a project written in DnD™ and/or follow along with this tutorial (which, again, was excellent.)
Edit: On second thought, something like this would help reduce UI clutter without sacrificing the readability of screenshots.
Just some food for thought. I'm looking forward to the next tutorial.
Thanks to everyone at YYG for the hard-work they put into developing and supporting GMS. Y'all are the real MVPs!
PS: Is there (or can there) be a fast and easy way to generate handsome-looking screenshots like the ones in this tutorial? The thought of taking multiple screenshots, removing the background color (and then cropping/padding the images to line-up properly) is just dreadful. If I don't have to do that - I'll start posting simple DND tutorials on the YYG Marketplace and in the Programming Forum.