Big thank you to Josia for the tutorial. Find him on X: twitter.com/w7games In this tutorial learn how to code a save and load system into GameMaker. Implement: * Writing and reading variables as text files * Using structs & JSON * Saving and loading multiple objects / rooms * Using buffers
@teinimon2395 Жыл бұрын
Nice timing. I had just finished FriendlyCosmonaut menu tutorials and needed a to learn how to save and load settings. Started looking for a save and load tutorial on this channel and on the website, and came across this video from 6 days ago that I completely missed. Nice one!
@scootie_scootАй бұрын
friendlycosmonaut has amazing tutorials!
@pzaan Жыл бұрын
What an excellent video. The progression from simple to complex situations was tremendously helpful, and you covered everything in under 12 minutes.
@GameMakerEngine Жыл бұрын
Big up Josia :)
@Widestone001 Жыл бұрын
Thank you. You just turned the game I'm making and all my future games into proper games. 😀
@asamadoCH8 ай бұрын
It was a simple and easy-to-understand tutorial on how to handle JSON and how to save and load files. However, this method has the problem that when instances are added to or deleted from a room, the save data becomes incompatible. I understand that to solve this problem, instead of deleting all instances and recreating them when loading, I need to use a method that reflects the saved contents without deleting the instances in the room. I'm looking forward to a tutorial that clearly explains this.
@poxpox13343 ай бұрын
maybe post the problem on the gamemaker forum?
@evaisotalo33865 ай бұрын
Best tutorial for understanding saving, loading, arrays, structs and using buffer. It finally all fell in place for me. Thank you ever so much for taking the time making it. 🤗
@geostargames Жыл бұрын
I always sucked at making saving and loading system 😅 Thanks! ❤
@marcussmithwick632610 ай бұрын
Really appreciate these videos. Recently started using game maker and its an amazing toolset.
@Paul8711gamezzАй бұрын
tysm! this was exactly what i was looking for!
@arti57693 ай бұрын
Wow, I just learned so much from this specific video. Very well done.
@KanjiCoder_RTFM2 ай бұрын
I really liked this tutorial . Thanks !
@christopherorestis69067 ай бұрын
This tutorial is missing a few steps,. I wish this tutorial started from the very beginning with the development of the objects as well as the variables included in each object. The tutorial could also have been slowed down, its not a race. I spent so much time adding in a bunch of code, only for that code to be removed and then replaced with a different line of code. I did learn a few new things though, so I can't complain about that. I just really hope that there will be an updated/extended version of this tutorial that skips straight to the proper method as recommended in the video (using buffers).
@tokensgaming9 ай бұрын
Quick question, How do I find the save.txt in MAC :/
@Palpus_X7 ай бұрын
My god the pacing is PERFECT. Thank you for this
@dylanmuss205211 ай бұрын
I've followed and triple checked everything in the video but I keep getting this error when hitting the save or load key. Variable .save_game(100030, -2147483648) not set before reading it. Any idea what the issue is here? I tried making the save_game and load_game functions isolated to their own scripts without declaring as a function and that seemed to work but then there appeared to be issues because they weren't in the same script. Seems like it is something related to functions.
@GlouGlou633 күн бұрын
So, I've been running into the exact same problem and couldn't for the life of me find what the problem was. Went to sleep, and it turns out I was an idiot : in the save_game() function within the script, I had typed : var _file = file_text_open_write(save.txt); instead of var _file = file_text_open_write("save.txt"); So basically your save.txt needs to be a string. If someone happens to have the same error, check that you haven't done the same mistake as me.
@svenjorgensen510 ай бұрын
If you have a very large game with tons of objects each with tons of variables, this video sort of reads like "how to create a beach with one grain of sand at a time." There's gotta be a faster more efficient way of saving the state of the game.
@rooftoprumble78459 ай бұрын
Hey did you find out how to do it?
@svenjorgensen59 ай бұрын
@@rooftoprumble7845 I eventually took a similar approach to the one in this video. However, I severely restricted when the player is allowed to save, so that it is done when very few interactions are occurring and very few instances are present. It's not how I originally wanted to do it (I originally wanted the player to be able to save at any time during gameplay), however for larger projects if a developer needs to track nearly every object, variable, array, alarm, data structure, etc. with perfect precision, then it can easily open the game up for serious bugs and crashes when saving is done at certain times. Even then, it's still an enormous amount of work. It seems to me that this should be functionality that is built into the engine itself. A save state, like a ROM emulator would do. Especially if you want to bill your engine as beginner-friendly, being able to easily save should be a no-brainer.
@EtsaTwo9 ай бұрын
@@svenjorgensen5it used to be built in.
@svenjorgensen59 ай бұрын
@@EtsaTwo Technically it's still there, however it's marked as deprecated and not recommended for use in the manual. The problem is that even then it was extremely limited and didn't save everything; your game needed to be very simplistic for it to be useful.
@ajejebrazord40688 ай бұрын
Basically, if we need to save and load for console? We need to use the async version and what are the differences from console to console? Thank you!
@GameMakerEngine8 ай бұрын
The best place to go for help is the GM community forum or Discord Forum: forum.gamemaker.io/index.php Discord: discord.com/invite/gamemaker
@mrnobody76005 ай бұрын
It doesn't load the states of objects even though I followed this step by step. X and Y coordinations, image index and many other things don't work. It only loads the object's itself.
@pinatranaves Жыл бұрын
Very good! One question, when exporting the game to Steam or another platform, if someone else takes the game with this .txt saving system and opens the file, will they be able to change the saved data? (examples: character level, upgrades, items, etc.)
@gnysek Жыл бұрын
Of course. But even if you encode it, if someone wish, he would probably find a way to hack save. What I learned - ignore it. If people wants to break they game after they paid for game - who cares.
@Beologe14 күн бұрын
This is a bit hard to understand, as it's so fast, but I feel kind of challenged to understand it :D I just gonna watch it a few times more. But it's nicely done anyway ^^
@jot2b3 ай бұрын
Hi all, will this solution work for adding save/load game function in GM 1.4999 ?
@-Russian_Knight Жыл бұрын
Очень крутые уроки, я перешел по ссылке от одного канала, на который я подписан, но там уже не выходят ролики. И я рад что перешел по ссылке, ведь попал на очень полезный канал, который мне сильно поможет в изучении программы.
@kaspinator52656 ай бұрын
After saving the game to save.txt the JSON viewer complains that there is an unknown character at the end of the file. I manually removed it (it was not visible, as pressing backspace once made no visible changes to the file), and it now works. But after saving again I get the same error. Does anyone know why? Here is the error: Expecting 'EOF', '}', ',', ']', got 'undefined'
@IamNeptunus10 ай бұрын
How should i save values in the array that are not variables? such as room seeds and globals?
@GameMakerEngine10 ай бұрын
Great question. The best thing to do is to go onto the GameMaker Discord or Online Community Form and ask there. People are really helpful and usually someone is on hand to support
@MachineMan649 ай бұрын
I'm having this exact issue, please let me know if you've figured it out.
@IamNeptunus9 ай бұрын
@@MachineMan64 I just made another seperate save and load script and used the first method in this video (so, without the for loop and manually loading each value)
@dimagloom7 ай бұрын
I saved everything into an array: first global variables, then objects. Next, I access element 0 of the array, get the structure and set the values of the global variables. Then we can delete objects and create a loop, as in the lesson, but we start from the 1st element of the array, and not from the 0th.
@kaspinator52656 ай бұрын
Since this method works by deleting and recreating objects when loading a save, does that mean that the Instance Creation Code is no longer useable when using this method?
@genyaarikado177810 ай бұрын
I'm getting the error or when trying to create the instance during loading
@genyaarikado177810 ай бұрын
nvm i figured it out, the problem was cause i didn't save the x and y values for all objects, so when recreating them it gave an error. you need to save at least the x, y, and layer values for all objects if you plant to use them when creating the instance
@genyaarikado177810 ай бұрын
Now I'm having a new problem, because the struct variables are set before the instances creation code is ran, after the loading is finished, the creation code for my objects runs and sets the variables back to 0
@genyaarikado177810 ай бұрын
Fixed this by setting the variables in the variable definitions instead of the create event
@wizeller50405 ай бұрын
@@genyaarikado1778 I am having the same problem. What do you mean by setting the variables in the variable defenitions? In my create event I set all of my global variables. global.strength = 0;, global.speed = 0 etc. But then the struct wants these variables before the create event???!!! Jesus Christ
@Neovoid3034 ай бұрын
@@wizeller5040 All my variables are created when I start my game and the object is deleted and I save once you get in the game so the variables have been set
@Bretthejet9 ай бұрын
I started the tutorial and 2 minutes in it isn't doing ANYTHING when i press S, I thought that i would go ahead and download the project to see what I was doing wrong and when i opened it up and pressed S, it also didn't work there??? really confused at the moment, and I would appreciate some feedback
@GameMakerEngine9 ай бұрын
Hey Brett :). The best place to go for help is the GM community forum or Discord Forum: forum.gamemaker.io/index.php Discord: discord.com/invite/gamemaker
@phaseluv4 ай бұрын
for some reason i can't load the save file from a title menu, how do i implement that
@phaseluv4 ай бұрын
i want to be able to save the game somewhere and load at that point where i saved when i resume the game in the menu
@_FurryOwO_6 ай бұрын
Добавьте это как отдельную функцию Типа save() и load() И что бы это работало как например в Rpg Maker, там сохранения просто сохраняют ВООБЩЕ ВСЕ об игре, каждую переменную, положения персонажей, итд Это было бы очень круто >w
@SiegfriedTheCatfish Жыл бұрын
@GameMakerEngine Please make a Tutorial about Resolution and how to debug in not fullscreen but have to viewport set to 1920x1080 and so on
@Mellowpeekos8 ай бұрын
How would you delete a save file as a option
@Pienotpi7 ай бұрын
I think you would have to use some code that just deletes the file from your computer. Google it probably tho
@ExoudarАй бұрын
I appreciate the tutorial. However, at 6:20 this is not correct. The variables in Create event will still override the ones in the struct. The solution would be to use something like with(instance_create........) and then inside that with you would add every single variables hp = _struct.hp.... I made sure the variables in my save file is exactly the same as the one in object create event. But the information giving here is simply wrong.
@lebobsharkАй бұрын
Thank you. I'm lucky you posted this only 2 days ago.
@charlot659026 күн бұрын
much better solution is to set these variables using the Variables Definition tab, since passing in a struct runs after these are set
@Exoudar21 күн бұрын
@@charlot6590 That is one solution true. There is another I prefer more which is self[$ "hp"] ??= 100; When creating a new instance it would take the 100 value. However, when creating it using the struct, it would take the struct value. In other word, as long as hp is undefined during the create event, it will take 100. Otherwise, take the assigned value from any other source. Variables Definition for me is "not part" of the code. Hence, I prefer not to use it. But thank you anyway.
@ErnestoChe-z1q Жыл бұрын
Good tutorial. Just a question: How to encrypt the data? As far as I know, the player can simply access the saved data and modify it. Is there any solution for it?
@ToadstedCroaks Жыл бұрын
Maybe just let the player have access to it? Unless you are trying to protect an online multiplayer experience, it's actually monumentally frustrating when developers try to obfuscate / encrypt data from the end user. It means they don't have agency for their product that they paid for, and they can't fix issues on their end that the developer hasn't gotten around to fixing on their end .. or maybe never will. Imagine not being able to reset a bugged quest flag because the developer doesn't trust you with your purchase; or some sort of purity decision. Forget trying to mod the game for your own enjoyment.
@dXXPacmanXXb Жыл бұрын
9:36 dont u have to use is_undefined?
@gnysek Жыл бұрын
No, both should work.
@DIRD-nz8qw Жыл бұрын
i use visual how will i do
@pzaan Жыл бұрын
Consider adding a function block and adding the code from the tutorial there. The rest of your project stays in Visual and you get to dip your toe into GML.
@kiber_pivowar11 ай бұрын
How can i make mobile game without purchasing 70$ bundle?
@kiber_pivowar11 ай бұрын
Its not for the commercial use, i cant give so much money just for 1 game
@GameMakerEngine11 ай бұрын
@@kiber_pivowar GameMaker exports are now free! From today :) * kzbin.infotmejf5Zvupk?feature=shared * gamemaker.io/en/blog/gamemaker-free-platforms
@xulld._.49835 ай бұрын
For some reason my saved data is in chineese
@wizeller50405 ай бұрын
haha I wish I had that problem.
@fierorecensione5828 Жыл бұрын
top!
@tctrax6 ай бұрын
for some reason, when following this, I was not able to correctly load variables (they are saving correctly but do not reflect or update).