Тёмный

The Struct Accessor - Replacing DS Maps - GameMaker Tutorial 

DragoniteSpam
Подписаться 10 тыс.
Просмотров 3,3 тыс.
50% 1

Опубликовано:

 

31 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 12   
@prowokator
@prowokator 4 года назад
That note of $ accessor not giving hard crash was great piece of info. Cheers!
@indiepunch3443
@indiepunch3443 4 года назад
Thank you for this video.
@ivanshiek
@ivanshiek Год назад
I would like to see more examples of Structs, like which Events do we put them in or why was it necessary for you to remove the script function bracket? Will the Struct not run in the script if it is in the function? You need to understand that we don't have the same knowledge of how GMS2 works in order to use these tutorials properly. Basically, you should make a video on actual application in a game rather than showcasing what it does. We need to see what can be done with it in different scenarios like an RPG game, platformer, top-down ship flying, or shooter. I am currently about to make a ds_map array, this video just told me it was obsolete, so now I need to know if I should do Structs instead?
@sabriath
@sabriath 4 года назад
the only thing missing would be writing/reading of the structs in order to serialize the data.....but since you can write code within the struct to do that for you exactly how you want the data saved, I guess that's a tie? lol Personally, I've always hated ds_map, it never was versatile enough to store huge chunks of data, and small chunks are easily stored as arrays or other forms....so it became pointless for my style of programming. I used to create huge data storage within arrays, using double-linked list programming within them to make fake "allocate" and "free" code to use them (it would return the array position to store data that you allocate space for)....when buffers were introduced, I switched to using that instead....and now structs are here, so I've already converted all of the code for it. I am loving structs....only 1 thing that would really make them the best, is if they had a deconstructor function, and the ability to free itself from memory within its own code without getting an error (maybe add itself to the "free me" pointer list behind the scenes for the next game step instead of actually deleting the memory at that moment).
@DragoniteSpam
@DragoniteSpam 4 года назад
Destructor methods would be really nice, in case you needed to free a data structure or unload a sprite or something whenever a struct is freed - although apparently that's not in the plans for the foreseeable future, which is a shame. For the time being I just give things a Destroy() method and call it myself when needed. Also, here's a video on de/serializing them: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-3HWe4vwU6TU.html
@marcoaziel
@marcoaziel 4 года назад
I've recently purchased GameMaker again after not having used it since around the time yoyogames purchased it-- I was delighted to see addition of structs. Besides the absence of hard crashing when using the $ accessor, are there any other technical differences between using struct[$ variable] versus struct.variable?
@DragoniteSpam
@DragoniteSpam 4 года назад
Nothing major. Variables can get syntax hightlighting so it's usually easier to see if you misspelled something with struct.variable_name than it is with struct[$ "variable_name"], though.
@HistLoveRadio
@HistLoveRadio 4 года назад
GML is a slow interpreter, however, have you thought of using the YYC option instead of the VM? All my games are compiled natively witch is known to perform better!
@DragoniteSpam
@DragoniteSpam 4 года назад
There's still a lot of overhead. Variables in GML, for example, are actually structs containing things like the data type (float? int? string? array?) and a value (number? text? pointer to the actual array?) and a few special-purpose flags, which is faster than interpreted code but still takes more time to process than something written in pure c or c++. If the VM is 10x slower than native code, the YYC might be 2.5x or 3x. Anyway look in the YYGML header file in the runtimes folder if you're curious about some of the inner workings. If you know your way around it, there are a few edits you can make to the generated c++ to speed it up further.
@seditt5146
@seditt5146 4 года назад
But... Why when the dot operator already exist?
@DragoniteSpam
@DragoniteSpam 4 года назад
If you use a struct like a map, you might want to look up a value stored with an arbitrary key, which you can't really do with the dot operator.
@seditt5146
@seditt5146 4 года назад
@@DragoniteSpam I don't fully understand how that works though, you can't add "key/value" pairs at run time can you? If not I can't seem to wrap my head around why one would not use dot operator and if you can add new members to the struct at run time I would love to know how. I currently am using structs for a Vector library but am running into issues with performance being at least 2-5x slower when attempting to return a new struct from my arithmetic operations. Such as C = A + B; I have to return a new Vector for C or I need to do A.add(B) which is far from ideal as it alters A, something you do not generally want. Anyway, better understanding of the internals of how structs behave in GMS might give me a better idea how I can improve the performance because I still can simply not use structs for anything high performance because they are simply to slow :(
Далее
Voy shetga man aralashay | Million jamoasi
00:56
Просмотров 1,2 млн
Why EVERY Gamemaker dev should use Structs
18:33
Просмотров 7 тыс.
Maps - Data Structures in GameMaker
25:11
Просмотров 2,2 тыс.
My Wife and I Made an Indie Game and it Made Millions!
14:45
RESOLUTION guide for game devs & GameMaker
8:50
Просмотров 65 тыс.
JSON SAVING in GameMaker with STRUCTS
8:38
Просмотров 9 тыс.
Structs Part 1 [GameMaker Studio 2.3]
10:07
Просмотров 8 тыс.
Structs - light objects [Game Maker | Basics]
8:13
Просмотров 1,5 тыс.
Data Structures in GameMaker Studio 2 - Introduction
15:23