How to Make a Save and Load System in GameMaker

  Рет қаралды 18,339

GameMaker

GameMaker

Күн бұрын

Пікірлер: 73
@GameMakerEngine
@GameMakerEngine Жыл бұрын
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
@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
@scootie_scoot Ай бұрын
friendlycosmonaut has amazing tutorials!
@pzaan
@pzaan Жыл бұрын
What an excellent video. The progression from simple to complex situations was tremendously helpful, and you covered everything in under 12 minutes.
@GameMakerEngine
@GameMakerEngine Жыл бұрын
Big up Josia :)
@Widestone001
@Widestone001 Жыл бұрын
Thank you. You just turned the game I'm making and all my future games into proper games. 😀
@asamadoCH
@asamadoCH 8 ай бұрын
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.
@poxpox1334
@poxpox1334 3 ай бұрын
maybe post the problem on the gamemaker forum?
@evaisotalo3386
@evaisotalo3386 5 ай бұрын
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
@geostargames Жыл бұрын
I always sucked at making saving and loading system 😅 Thanks! ❤
@marcussmithwick6326
@marcussmithwick6326 10 ай бұрын
Really appreciate these videos. Recently started using game maker and its an amazing toolset.
@Paul8711gamezz
@Paul8711gamezz Ай бұрын
tysm! this was exactly what i was looking for!
@arti5769
@arti5769 3 ай бұрын
Wow, I just learned so much from this specific video. Very well done.
@KanjiCoder_RTFM
@KanjiCoder_RTFM 2 ай бұрын
I really liked this tutorial . Thanks !
@christopherorestis6906
@christopherorestis6906 7 ай бұрын
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).
@tokensgaming
@tokensgaming 9 ай бұрын
Quick question, How do I find the save.txt in MAC :/
@Palpus_X
@Palpus_X 7 ай бұрын
My god the pacing is PERFECT. Thank you for this
@dylanmuss2052
@dylanmuss2052 11 ай бұрын
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.
@GlouGlou63
@GlouGlou63 3 күн бұрын
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.
@svenjorgensen5
@svenjorgensen5 10 ай бұрын
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.
@rooftoprumble7845
@rooftoprumble7845 9 ай бұрын
Hey did you find out how to do it?
@svenjorgensen5
@svenjorgensen5 9 ай бұрын
​@@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.
@EtsaTwo
@EtsaTwo 9 ай бұрын
​@@svenjorgensen5it used to be built in.
@svenjorgensen5
@svenjorgensen5 9 ай бұрын
@@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.
@ajejebrazord4068
@ajejebrazord4068 8 ай бұрын
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!
@GameMakerEngine
@GameMakerEngine 8 ай бұрын
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
@mrnobody7600
@mrnobody7600 5 ай бұрын
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
@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
@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.
@Beologe
@Beologe 14 күн бұрын
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 ^^
@jot2b
@jot2b 3 ай бұрын
Hi all, will this solution work for adding save/load game function in GM 1.4999 ?
@-Russian_Knight
@-Russian_Knight Жыл бұрын
Очень крутые уроки, я перешел по ссылке от одного канала, на который я подписан, но там уже не выходят ролики. И я рад что перешел по ссылке, ведь попал на очень полезный канал, который мне сильно поможет в изучении программы.
@kaspinator5265
@kaspinator5265 6 ай бұрын
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'
@IamNeptunus
@IamNeptunus 10 ай бұрын
How should i save values in the array that are not variables? such as room seeds and globals?
@GameMakerEngine
@GameMakerEngine 10 ай бұрын
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
@MachineMan64
@MachineMan64 9 ай бұрын
I'm having this exact issue, please let me know if you've figured it out.
@IamNeptunus
@IamNeptunus 9 ай бұрын
@@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)
@dimagloom
@dimagloom 7 ай бұрын
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.
@kaspinator5265
@kaspinator5265 6 ай бұрын
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?
@genyaarikado1778
@genyaarikado1778 10 ай бұрын
I'm getting the error or when trying to create the instance during loading
@genyaarikado1778
@genyaarikado1778 10 ай бұрын
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
@genyaarikado1778
@genyaarikado1778 10 ай бұрын
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
@genyaarikado1778
@genyaarikado1778 10 ай бұрын
Fixed this by setting the variables in the variable definitions instead of the create event
@wizeller5040
@wizeller5040 5 ай бұрын
@@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
@Neovoid303
@Neovoid303 4 ай бұрын
@@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
@Bretthejet
@Bretthejet 9 ай бұрын
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
@GameMakerEngine
@GameMakerEngine 9 ай бұрын
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
@phaseluv
@phaseluv 4 ай бұрын
for some reason i can't load the save file from a title menu, how do i implement that
@phaseluv
@phaseluv 4 ай бұрын
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_
@_FurryOwO_ 6 ай бұрын
Добавьте это как отдельную функцию Типа save() и load() И что бы это работало как например в Rpg Maker, там сохранения просто сохраняют ВООБЩЕ ВСЕ об игре, каждую переменную, положения персонажей, итд Это было бы очень круто >w
@SiegfriedTheCatfish
@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
@Mellowpeekos
@Mellowpeekos 8 ай бұрын
How would you delete a save file as a option
@Pienotpi
@Pienotpi 7 ай бұрын
I think you would have to use some code that just deletes the file from your computer. Google it probably tho
@Exoudar
@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
@lebobshark Ай бұрын
Thank you. I'm lucky you posted this only 2 days ago.
@charlot6590
@charlot6590 26 күн бұрын
much better solution is to set these variables using the Variables Definition tab, since passing in a struct runs after these are set
@Exoudar
@Exoudar 21 күн бұрын
@@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
@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
@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
@dXXPacmanXXb Жыл бұрын
9:36 dont u have to use is_undefined?
@gnysek
@gnysek Жыл бұрын
No, both should work.
@DIRD-nz8qw
@DIRD-nz8qw Жыл бұрын
i use visual how will i do
@pzaan
@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_pivowar
@kiber_pivowar 11 ай бұрын
How can i make mobile game without purchasing 70$ bundle?
@kiber_pivowar
@kiber_pivowar 11 ай бұрын
Its not for the commercial use, i cant give so much money just for 1 game
@GameMakerEngine
@GameMakerEngine 11 ай бұрын
@@kiber_pivowar GameMaker exports are now free! From today :) * kzbin.infotmejf5Zvupk?feature=shared * gamemaker.io/en/blog/gamemaker-free-platforms
@xulld._.4983
@xulld._.4983 5 ай бұрын
For some reason my saved data is in chineese
@wizeller5040
@wizeller5040 5 ай бұрын
haha I wish I had that problem.
@fierorecensione5828
@fierorecensione5828 Жыл бұрын
top!
@tctrax
@tctrax 6 ай бұрын
for some reason, when following this, I was not able to correctly load variables (they are saving correctly but do not reflect or update).
@charlot6590
@charlot6590 5 ай бұрын
that sucks
How To Code a Crafting and Recipe System | GameMaker Tutorial
21:33
How Do You Code In GameMaker?
20:02
GameMaker
Рет қаралды 44 М.
Человек паук уже не тот
00:32
Miracle
Рет қаралды 4 МЛН
ROSÉ & Bruno Mars - APT. (Official Music Video)
02:54
ROSÉ
Рет қаралды 331 МЛН
Why EVERY Gamemaker dev should use Structs
18:33
RiptideDev
Рет қаралды 7 М.
SAVE & LOAD SYSTEM in Unity
18:20
Brackeys
Рет қаралды 1,1 МЛН
GameMaker Studio 2 - Best Saving and Loading Tutorial (2.3.1+)
23:01
Use Chris Perkins' Map-Fu to Make Beautiful Battlemaps
7:59
Mystic Arts DM
Рет қаралды 2,5 М.
How to Code an Inventory System
23:16
GameMaker
Рет қаралды 16 М.
Full Item and Item Inventory System in GMS2!
1:10:38
Peyton Burnham
Рет қаралды 50 М.
How to make a Save & Load System work across Multiple Scenes in Unity | Tutorial
21:28
GameMaker Studio 2.3 - How to Create and Use Tile Sets + Auto Tiling
12:30
Let's Learn This Together
Рет қаралды 50 М.
GameMaker Inventory with Structs | GMS 2.3+ New Features
7:48
GameMakerStation - Matharoo
Рет қаралды 23 М.
ҚАЙҒЫЛЫ ХОРРОР ОҚИҒА ► Bad Parenting
36:58