• 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!

Lightweight Objects (Structs) Alternatives

Z

zorngeist

Guest
I am completely new to GM (and programming in general) and have been looking for something akin to structs to use in my project. Anyone know if Lightweight Objects are going to make it in before 2019 is over? Described here: https://www.yoyogames.com/blog/514/gml-updates-in-2019

A quick Google has returned a few alternatives to structs. It sounds like #1 is the easiest for the time being, but speaking as a complete noob, I wanted to get some input on this from the GM community. How do you guys handle structs in your projects?

#1 Combining enums with arrays to make structs:
https://forum.yoyogames.com/index.php?threads/can-i-make-a-struct-in-gml.57527/

#2 A redditor's method using deactivated instances:
https://www.reddit.com/r/gamemaker/comments/bdt6q4/gms2_presenting_struct_true_structs_in_gamemaker/

#3 GMStruct:
https://forum.yoyogames.com/index.php?threads/gmstruct-struct-generation-for-gamemaker-studio.29731/
 
R

robproctor83

Guest
I'd love to think they will release them any day now, however I get the feeling it's going to be pushed back... but, I have no idea really.

@YellowAfterlife your GMEdit tool is really nice. I just downloaded it and gave it a run, very good. I'm not sure how much use I'll get out of it though, having to switch back and forth to run the game is a bit tedious, but for large scripting projects I would much prefer GMEdit. Any idea why there is a line across the screen vertically? See the attached image.
 

Attachments

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
I'd love to think they will release them any day now, however I get the feeling it's going to be pushed back... but, I have no idea really.

@YellowAfterlife your GMEdit tool is really nice. I just downloaded it and gave it a run, very good. I'm not sure how much use I'll get out of it though, having to switch back and forth to run the game is a bit tedious, but for large scripting projects I would much prefer GMEdit. Any idea why there is a line across the screen vertically? See the attached image.
That's the print margin, you can disable it in code editor settings

You can use builder plugin to compile from GMEdit, or a macro.
 
Z

zorngeist

Guest
GMEdit has syntactic sugar wrapping around method 1 equivalent (letting you do obj.field instead of obj[Object.field]) https://github.com/GameMakerDiscord/GMEdit/wiki/Using-type-magic

I consider this to be by far the most optimal, likely to be slightly faster than future LWOs due to linear lookup time.
Cool. I'll stick with enum arrays for the time being. GMEdit looks like an interesting tool to have available when I find myself needing more advanced features. Thanks for the input.
 
Top