GameMaker - Better Saving & Loading (JSON)

  Рет қаралды 46,317

Sara Spalding

Sara Spalding

Күн бұрын

Пікірлер: 171
@SaraSpalding
@SaraSpalding 3 жыл бұрын
IMPORTANT: I have made a new, updated version of this video for version 2.3.1+ using structs and arrays! kzbin.info/www/bejne/iGmXnoVrZ7aUg8k
@MadJaze
@MadJaze Жыл бұрын
I dont know anything about to save data in JSON files but Im here learning a lot, although there is another and updated tutorial. I´ll watch after this one of here.
@JohnDoeagtfdyutasgdjak
@JohnDoeagtfdyutasgdjak 6 жыл бұрын
You should make an online multiplayer tutorial! There aren't many Game Maker tutorials out there that cover the subject (not to mention effectively, or completely), and I feel like you could make an effective tutorial. Not only that but the Game Maker community for both GMS1 and 2 would benefit as a whole. I've been watching your tutorials for a few years now, and I would definitely want to see this!
@AurrenTV
@AurrenTV 6 жыл бұрын
The problem with online multiplayer is that it exceeds game maker itself. Sure you could set up clients ready for playing multiplayer but the networking solutions would need to be done outside Game Maker and would involve the use of networking knowledge as well as money to set up the infrastructure (servers) even if you plan on peer to peer you still need hole punching servers. LAN however is easily possible and it is easily found on the internet for GMS2/GMS1.4 but it isn't online multiplayer
@AurrenTV
@AurrenTV 6 жыл бұрын
Getting everyone to port forward their router is a terrible idea for a commercial game, there would need to be some kind of server connect clients together using udp hole punching so people don't have to do that. (and that's just for peer to peer, not even touching on dedicated servers)
@AurrenTV
@AurrenTV 6 жыл бұрын
Say you release a game on Steam (also for the purpose of your argument you're not using Steam's mediation server for peer to peer, and are just using GM's network functions.) It's a 4 player rogue-like (the most common kind of game for indie devs.) They want to play multiplayer together but before buying the game have no idea what port forwarding is let alone that this game needs it to function. They press host and get a nice prompt saying ("Please port forward ports xyz on your router.") the friends who aren't hosting are fine but 1 out of 4 people will still need to go through port forwarding, which is highly unprofessional. You'd see refunds from people saying the game is broken because you're expecting players to have networking knowledge.
@AurrenTV
@AurrenTV 6 жыл бұрын
If you're talking about everybody (possibly thousands of players) connecting to a dedicated server made in game maker then yes, only one machine needs to have their connected router port forwarded but game maker wasn't designed to make dedicated server programs with: GM made games only run on a single core meaning there is no multi threading (something servers generally require, especially logic/ packet heavy game servers). I'm pretty sure I've read somewhere game maker networking fizzles out at sub-50 connected clients. Lol, I don't mean to be a contrarian, if that's how it comes off.
@sn4pi
@sn4pi 4 жыл бұрын
​@@AurrenTV Well I made an Online Multiplay Shoot 'em Up for my class mates and me to play. Had an in-game lobby, fluid ping and worked really good as a whole. And I only needed Hamachi for it to work! In my opinion all is right what you say except the part "The problem with online multiplayer is that it exceeds game maker itself." I managed to do alot with GameMaker only, and simply buying a server or needing to pay for the sake of programming a game should be obvious beforehand and has nothing to do with GameMaker itself. You could say the same things for Unity or UnrealEngine in terms of Online Multiplayer therefore it makes no sense to say that GameMaker can't come up with good-enough networking solutions. I mean I even amde a voice-chat through GM Networking ^^
@DarkKnightDad
@DarkKnightDad 6 жыл бұрын
thank you soo much for your video, you cannot imagine how elegant is the loading/saving thanks to this code. I even extended the code so that I save game variables (in a map) and inventory list (in a list) and enemies locations and types (in a map within a list, like what you did) and finally the whole thing in one big wrapper map ^____^
@illdie314
@illdie314 6 жыл бұрын
The vertical line symbol above the backslash is called a pipe.
@checkbox.entertainment
@checkbox.entertainment 6 жыл бұрын
It's about time a good tutorial is released about saving that isn't using ini files! Ini files can get corrupted quite easily.
@caiomartins4343
@caiomartins4343 Жыл бұрын
I did everything the same in the video, but now when I save and load the game, the player duplicates. In other words, one player remains as I saved, and the other reverts back to the beginning of the game. What should I do?
@alexmagnus3339
@alexmagnus3339 6 жыл бұрын
You posted this video just as I wanted to make saving enemy locations and your location in "Your First Platformer" possible!
@andre_4046
@andre_4046 6 жыл бұрын
did it work for you? cuz i have alot of rooms and it won't load the enemies correctly for me(they are always at full hp and at the same position)
@animaitor99
@animaitor99 4 жыл бұрын
I have been doing this list in a map with list thing in my game and didnt even know i could save it all into a JSON . Thx Also i came here after your brief explanation you did when building your game for Ludum Dare 47.
@jorgemuffareg7146
@jorgemuffareg7146 4 жыл бұрын
Thank you! I know it's a simple solution and me as a developer should know this but... you saved me!
@SaraSpalding
@SaraSpalding 4 жыл бұрын
Glad I could help!
@owenbevt3
@owenbevt3 6 жыл бұрын
Thanks for a tutorial on this I can follow. I do think Game Maker could make this all so much simpler they seem to have compleatly droped to ball on there usual ethos of making everthing very accessable when it comes to saving.
@owenbevt3
@owenbevt3 5 жыл бұрын
how dose this work with different object types (with different variables)? sould each type get its own wrapper?
@jealouscrow4593
@jealouscrow4593 6 жыл бұрын
Perfect. Was wondering when a full tutorial on this would be made.
@soubakouh
@soubakouh 4 жыл бұрын
INCREDIBLE!! you save me :'D
@giankeberlein8648
@giankeberlein8648 4 жыл бұрын
Hey man I really like your tutorials and find them very useful! I could not be more thankful. Unfortunately, I would like to ask you a question about this one because I didn't get it very clear. So the question is: if i want to add another map/list inside the root list just to have, for example, a map for keys data and a map for enemies data. When "adding" it to the root list, in the "ds_list_mark_as_map" function, should I still reference the position to be listed as "ds_list_size -1"? I mean, would it still be listed correctly?
@ion2618
@ion2618 4 жыл бұрын
I was wondering if you could make a tutorial for how to use this with the Action RPG?
@biddumtv3663
@biddumtv3663 6 жыл бұрын
Great tutorial! Say I have a persistent object, obj_controller that creates global variables for my game. Would I save that instance and its attributes (like how you did with x,y,sprite,etc..) and then load them into the game or should I create a new key-value pair in the ds_map and save/load that way?
@dkrobinson1187
@dkrobinson1187 6 жыл бұрын
This works very good! just one issue, when i create the .exe file and run it this feature stops working. any idea why?
@jack5590
@jack5590 5 жыл бұрын
Love your videos. The key you referred to is called the pipe or bar key.
@jk-gn2fu
@jk-gn2fu 6 жыл бұрын
A great example. I made very similar one before, but this example has a much cleaner codes than the one I made.
@andre_4046
@andre_4046 6 жыл бұрын
so i have alot of rooms(i was following your tutorial shaun), in the save file i also put the room in which i am currently, but when i load it the enemies i killed are still there and alive(i did save their hp) can anyone help me please edit: instead of using a object i put the code in 2 scripts (loading and saving) don't know if that makes a big difference i need it to be in a script so that i can call it in my menu
@JordanM56
@JordanM56 5 жыл бұрын
How can this be expanded to include multiple different types of objects all with different variables?
@jorgemuffareg7146
@jorgemuffareg7146 4 жыл бұрын
@@karstenpedersen2132 nice! I think it would be interesting to use switch(_obj){ case: }
@gotcowdota
@gotcowdota 4 жыл бұрын
If anybody else cannot find where GMS2 is saving your files, drop this code in just after your save. It will pop up the directory where files are being saved in a dialogue box when you run your game. You can then remove the code from your game once you've found the file. file_text_close(file_text_open_write("temp")) // opens and closes a temporary text file var r=filename_path("temp"); // creates a temporary variable with the filepath for that file file_delete("temp"); // deletes that file show_message (string(r)); // display a message with that file directory file_text_close(_file); // closes the file to prevent memory leak Don't leave this in your final game, obviously.
@craigrobishaw9796
@craigrobishaw9796 2 жыл бұрын
Really useful video. exactly what I needed mate. many thanks for sharing
@BlueMiaou
@BlueMiaou 5 жыл бұрын
Great tutorial! Definetly a life saver.
@mahmoud.zayedd
@mahmoud.zayedd 6 жыл бұрын
Owsome 👌
@ethanhopkinsmusic
@ethanhopkinsmusic 3 жыл бұрын
I have objects with different variables. Would I add a second "with statement" to include those other objects?
@techiemay
@techiemay 2 жыл бұрын
What do I do if I want to add more things to a struct, but there is already a save file that doesn't have the new variables in the json file? How do I avoid the game crashing? This would be very important for if I were to publish to steam and need to update the game.
@tuliohenry5484
@tuliohenry5484 5 жыл бұрын
I'm getting an error when i try to load my game from the beginning saying then the data structure doesn't exists, how can i fix this
@FoxyOfJungle
@FoxyOfJungle 4 жыл бұрын
Me too! Can someone help??
@dinar8749
@dinar8749 4 жыл бұрын
I don't know if this will help, but it works for me after much pain and suffering trying to get it working in the first place. For the loading, I had to make his load file script in the video that loads the buffer (for buffers, when it's numbers you're using use one of the buffer number ranges constants in the game maker manual, BUT if you're using text (string) then use buffer_string...this stumped me for ages since gamemaker kept saying "buffer out of range, going back to 0" and I couldn't find any guides). Then you wanna do some stuff like... //checks if file exists first (don't worry about name or "dat" that's just related to my game) "if (file_exists("XGA.SAVEFILE.dat")) { var _map_decoded = LoadJSONFromFile("XGA.SAVEFILE.dat") var list = ds_map_find_value(_map_decoded,"ROOT") var size = ds_list_size(list) //loops through whole ds list containing all the ds maps on each list part (I think?) for (var i = 0; i < size; i++) { var listvalue = ds_list_find_value(list,i) global.variable you want to change or whatever = ds_map_find_value(listvalue, key) Where "key" is whatever you set it to be when you saved your game using ds_maps beforehand. ..... } Then you destroy the list and ds map to prevent a memory leak Hope this helps...even though it's over 6 bloody months ago 😂
@Will-ei2jz
@Will-ei2jz 4 жыл бұрын
Dinar 87 I’m having the same problem when I load my game: Illegal buffer index -1, obviously you wrote this a while back but I’m a little confused about how you fixed this issue?
@Limekys
@Limekys 6 жыл бұрын
It hard for me, but very good tutorial of saving game! Thanks, i'll try to learn and will do it!
@drtt1gg3r1
@drtt1gg3r1 4 жыл бұрын
I've seen this type of tutorial a couple of times from different YTbers. And the one thing that none of them show is saving objects that have lists/maps tied to their instances. They all say it can be done but none of them show it. Could you please give or show an example of saving/loading objects that have lists of other objects tied to them. EXAMPLE: In obj_player there is a variable that stores the id of another object; obj_inventory. obj_inventory is an object that stores a ds_list. In that ds_list is a bunch of instance id's of items the player is holding. How would you set this up for save/load?
@Karak-_-
@Karak-_- 4 жыл бұрын
Well, I would definetly *not* create inventory system based on instances in first place, that's for sure. I would asign a number to each type of item as an enum and then I would save in a ds_list or ds_map ids of items. Because in all honesy, instance id are "tempoary".
@treehann
@treehann 2 жыл бұрын
I popped this video open because i was annoyed at how Game Maker’s native function ds_map_secure_save encrypts per device. I want to still be able to save data that can only be read by Game Maker when it loads, but not readable by a human. Essentially i want to have non-tamperable save data that i can move from machine to machine. Pardon this question but because the video is 30min long, i wanted to ask before i watched if it solves the problem i posed above. Thank you in advance.
@eshels2288
@eshels2288 3 жыл бұрын
THX but what did you define in global.mystery ?
@ikkiekcuriel4519
@ikkiekcuriel4519 6 жыл бұрын
@Shaun Spalding Is there any way to store a ds_grid inside of a ds_list or ds_map? i've been struggling with this for a while
@ikkiekcuriel4519
@ikkiekcuriel4519 6 жыл бұрын
Don't worry... all ready solved ;)
@kupo150
@kupo150 6 жыл бұрын
Perfect! Was hoping for this! Thank you!!!!!!!!!!!!!!!!!!!!!
@cervicesejvl6412
@cervicesejvl6412 3 жыл бұрын
This video is ONLY ONE THING I NEEEEEEEEED!!!!! :)
@x_ranl_x
@x_ranl_x 6 жыл бұрын
if you make a "HTML5 multiplayer" tutorial (it seems possible, but very untouched by tutorial makers) I'll donate $100. Not sure if networking is your forte, but worth a shot. Keep the GM world alive!
@NeZversSounds
@NeZversSounds 6 жыл бұрын
check Gloomy Toad Studios - Multiplayer Fighting Game Programming
@nathan08085
@nathan08085 6 жыл бұрын
Shawn Spaulding does the thing after you pay. It’s like buying a pc off NZXT, you pay and say what you want and then they give it to you
@x_ranl_x
@x_ranl_x 6 жыл бұрын
NateStar 0 I understand, thanks. If he expressed interest I'm certain it would have panned out that way.
@DitheryStudios
@DitheryStudios 4 жыл бұрын
How do I save and load a ds map? I have a minimap that relies on it, but cant figure it out...
@Gngwro
@Gngwro 6 жыл бұрын
When I try to recreate all of the objects in the With statement, I get an error on the object argument within instance_create_layer. Any advice?
@ichocksyololo445
@ichocksyololo445 6 жыл бұрын
First make sure you are in GMS 2(GMS 1.x doesn't support that function, use instance_create instead). Could you please show how are you setting up the arguments?
@K31774
@K31774 6 жыл бұрын
Hi, Im using GMS 1.4 , so what exactly i need to write there? cuz /with (instance_create(0,0,asset_get_index(_obj)))/ or / (with (instance_create(x,y,asset_get_index(_obj))) I get an error Can You help me please! Upd I already helped myself! But thanx anyway!!
@GlyphicEnigma
@GlyphicEnigma 5 жыл бұрын
@@K31774 I'm using ENIGMA and it doesn't have asset_get_index(). do you know whether this system would still work?
@Hubert99999
@Hubert99999 5 жыл бұрын
So for an online game, would you use one of these files for each account and then store them on your own server? Or please do explain to me how an online saving/accounts roughly work !
@benanderson89
@benanderson89 5 жыл бұрын
I'm brand new to GML (though already a professional software dev) and saving content from my little demo GML projects has been the worst part of any of them. This seems a nice method, and JSON is a dirt simple format to work with. I'll be sure to give this a whirl when I can. :) Though, rather than character/string data and expensive JSON processing, could a method similar to this save raw byte data to disk? It'd effectively be a memory dump stored as a map or tree. Just two points in the video that I think need a bit of clarification: 15:00 Compatibility isn't the reason to use a buffer. Buffers are sequential data held in a temporary portion of memory. A storage device (like an SSD) is slower than RAMs, o you create a buffer for the disk to read at it's own pace, rather than sending chunks of data to the disk and waiting for said chunk to complete it's read or write operation before sending another. Buffers are more complicated to write in a high level language, but more performant since it's actually simpler to implement under the skin; there's less obfuscation with how a computer actually works. 21:08 It's just called the Vertical Bar, but in computing it's more commonly refereed to as the "Pipe" character because of it's association with the UNIX Pipeline. It's not to be confused with the broken bar ( ¦ ) which is AltGr + Grave Accent ( ` ) key on British keyboards. My nitpicking aside, great video! I'll try to use these techniques somewhere down the line. :)
@benanderson89
@benanderson89 5 жыл бұрын
Also, hello from a fellow Northeasterner! :))
@landdweller9684
@landdweller9684 5 жыл бұрын
@@benanderson89 Hello from Cumbria; I was hoping someone could answer a quick question I have on this subject, but can't find an answer. I would consider myself a beginner but have been using GameMaker studio and learning about computers for 2 decades. By using JSON to save game progress / variables and what not; Would this be the best method for my intended target which is HTML5, rendered in JavaScript? which should make this method work more natively? One thing I have noticed with HTML5 is some events appear to be getting read from right to left making the usual windows platform logic go out the window and I have to use alternative measures to achieve similar results.
@Jt9393synyster
@Jt9393synyster 4 жыл бұрын
Thank you so much, Shaun.
@laszloeszik5033
@laszloeszik5033 5 жыл бұрын
Thanks for this video, I was looking for a method to save stuff into files, so I can handle language versions more efficiently. Tho for some reason I thought this json_encode _decode is about to make the data unreadable and hard to modify (so it's encrypted). Is there an easy method to make this possible? And if there is a way, do you plan to make a video about it? :) I will try to put this idea in via patreon. Thanks again! I follow your tutorials for a while and I already made a minigame along the platformer tutorial series. :) Keep up the good work Shaun! :)
@laszloeszik5033
@laszloeszik5033 5 жыл бұрын
Ok, I actually found an easy way to encrypt stuff. :) ( base64_encode _decode(); )
@cchhiipp
@cchhiipp 6 жыл бұрын
How does one deal with saving objects with different attributes. For example a car object has speed, fuel, color. A robot has weapon strength, durability, etc. Do I need different parent SaveMe objects for each type of object, then a new with() statement for each object type? And how do I load the different types of objects in the load event?
@raspberry_picker395
@raspberry_picker395 6 жыл бұрын
Same problem here. I have a game in which you pick your side, the player has levels xp and upgrades, there's 9 worlds and each has 5 levels, it's teritorry based, I wont get into the details of it. Basically there's a lot of very important stuff going on Juju Adams and Shaun both say this code is very flexible and I'm sure it is, but having to write lines for saving and loading for pretty much EVERYTHING just seems like a bad practice. Yes, you could say that I don't need everything saved, but yes, yes I do (atleast it seems like I do). Not sure how to do this properly, I've watched Jujus talk and they don't explain how to properly use it. I understand the code, they both explain it very well but I am not sure how to use it properly.
@Robotik_X
@Robotik_X 6 жыл бұрын
You Would Put It In Front Of The Line Of Code, Let's Say We Are Using Jumps, if No Other Object Had It You would Put: with (Obj_Player) ds_map_add(_map,"jumps",jumps);
@FoxyOfJungle
@FoxyOfJungle 4 жыл бұрын
I save the file and I can load it, but if I close the game and open it again and try to load it, the error appears: Data structure with index does not exist. What can I do?
@yassinesey9295
@yassinesey9295 4 жыл бұрын
you probably destroyed the wrapper while still in loop
@lukehowe4188
@lukehowe4188 5 жыл бұрын
Boys, For me the line of code SaveStringToFile just doesn't exist it comes up as a varibale any ideas?
@Carmine98
@Carmine98 Жыл бұрын
How can edit a game for example; coin gemms etc. thanks
@noahfreedley7694
@noahfreedley7694 3 жыл бұрын
How do you make the script with the new 2.3 update? ;-;
@srujankale7274
@srujankale7274 5 жыл бұрын
is there an alternate code for ds_list_mark_as_map() ?
@m1s3ry97
@m1s3ry97 4 жыл бұрын
Great tutorial! Is there any way to save a buffer inside an specific directory?
@glitched_studios
@glitched_studios 5 жыл бұрын
Does anyone know how I could make it when you load the game, it writes all the saved variables to the objects, instead of deleting them and recreating them with the stored variables? It causes way too many dramas when I delete my control object and recreate it
@MichelleMoonknight
@MichelleMoonknight 5 жыл бұрын
Hello, it's a great tutorial , but I have a little problem, when I save and then load , the player is not where it was while saving , I meant the x and y of player and all the objects that were doing some path are restored. How could I save the way they were before save ?
@MarkDuval
@MarkDuval 5 жыл бұрын
Did you make your player object a child of the parent saving object?
@cckong7803
@cckong7803 3 жыл бұрын
I save the file and I can load it but if I close the game and open it and try to load the game, the error appears: Data structure with index does not exist at this line "for(var i = 0; i < ds_list_size(_list); i++)" can someone help me with that:(( trying to fix it for whole day and checking the code for many times
@ToastGhost26
@ToastGhost26 4 жыл бұрын
Where does the save file get stored?
@Leonardo-jk4wu
@Leonardo-jk4wu 6 жыл бұрын
hey, could you make a tutorial for Google Play cloud integration and using?
@nathan08085
@nathan08085 6 жыл бұрын
Leonardo007, you know that all topics are chosen by Shaun’s patrion by a vote. It isn’t too much; $5 ish dollars a month to vote. Try there. Not here
@rexwesth860
@rexwesth860 3 жыл бұрын
Can you make an tutorial here on KZbin where you show us how to save our game by clicking on an object?
@raptyrn1290
@raptyrn1290 6 жыл бұрын
supposing I created a group of different objects with their own ids, would I need to put this code in each object? Beginner here just trying to get a better understanding of how that works.
@nathan08085
@nathan08085 6 жыл бұрын
Raptyrn you can put this in one parent object and use event inheritance so all child objects save
@nathan08085
@nathan08085 6 жыл бұрын
I would recommend learning .ini files first if you are a beginner
@raptyrn1290
@raptyrn1290 6 жыл бұрын
I will try both of those things, thanks!
@maxdax55
@maxdax55 3 жыл бұрын
Eazy upgrade: Instead of "_string = json..."+"SaveString..."+"ds_map_destroy...". You can simply change "SaveString..." argument1 by the ds_map and in "SaveString..." add the line "_string = json_encode(ds_map)" and at the end of the script "ds_map_destroy(ds_map)". That will save you a bit of time (2 seconds every time haha) But also you will never forget to destroy the map as you need the argument or else syntax error. :) Edit: You should also; not start by a list but by a map. (map - map) instead of doing "map - list - map".
@JordanM56
@JordanM56 5 жыл бұрын
Anybody have any idea how to LOAD different objects with different variables? I have no trouble saving different instances with different variable into a JSON but can't load more than one type of object...
@DanBraithwaite
@DanBraithwaite 6 жыл бұрын
This is a great video, Shaun, well put together and easy to follow. However it has a major flaw, in that you simply cannot guess for all of the variables which may or may not be present in all objects at any point in the game. You see I was able to save all of the variables to the .sav file using the VARIABLE_INSTANCE_GET_NAMES function within the code. This allowed me to store any data, regardless of the object and it's variables. Storing and saving works fine this way, I can see the data is present in the file. However your method doesn't seem to be able to pull the data out. You claim that this is more advanced than a simple text file however I still find myself having to list every possible variable at any given time, which is just not viable if you want to save the state of the game mid-battle, for example.
@zeldwaugh5703
@zeldwaugh5703 5 жыл бұрын
I'm not too sure about this... but I think in your case maybe just creating global variables to check where in they game you are? Then just save those variables as strings like in this vid. Load them upon file selection. Adjust code accordingly to them? My two cents
@crespo313
@crespo313 6 жыл бұрын
Hi I lately made a health bar and i have a problem because i don't know how do I make it so the health bar stays in the corner of the screen? Because I added a view that follows the player.
@nathan08085
@nathan08085 6 жыл бұрын
Crespo if you healthbar is not an object. Draw it in the draw GUI event. If it is an object get it’s position to equal the view width and height plus.. ... say 15. You could do this as x = camera_get_blahblahblah(camera)+15
@FarronAnimations
@FarronAnimations 4 жыл бұрын
I want to make a game that has multiple rooms specifically, how would i make it so it also saves what room is being used?
@Etricks11
@Etricks11 4 жыл бұрын
you can use room_get_name and then when loading it pass it through asset_get_index and load that room
@tas_cie
@tas_cie 4 жыл бұрын
When I load game, the blocks disappear. Can you help me please ?
@Karak-_-
@Karak-_- 4 жыл бұрын
Ok my advice is look on what exactly is happening. Also the "When I load game, the blocks disappear." is really vague, I have no idea what that could mean, like about which blocks are we talking about. My advice is to run in in debug mode, there you can set breakpoints and checks what is happening. Also you might look at Game Maker Discord server, there are chennels for solving these kind of issues.
@adriancifersky791
@adriancifersky791 4 жыл бұрын
Nice tutorial, you really help me with this but still a have one problem, I made platform game and when I tried load game nothing happend well first i screw up few details in code but i fix it immidiatly..
@SuperGamersgames
@SuperGamersgames 6 жыл бұрын
Hey, @Shaun Spalding! So I am working on a Space game called Vector Space (An Open-World ship game using similar controls to Asteroids, as well as graphics), and I want to make enemy ships that you can encounter. The problem is, I can't figure out how to actually make the AI without the Ship looking weird and acting weird (ex. The ship is always facing you and is moving not where the ship is looking). Do you possibly have a script or a video that would be able to help me in this sort of case? Thanks! :) -@SuperGamersGames
@checkbox.entertainment
@checkbox.entertainment 6 жыл бұрын
image_angle = direction
@SuperGamersgames
@SuperGamersgames 6 жыл бұрын
Alex Aulds The problem isn't the enemy's direction. The problem is being able to make an ai that move towards the player and shoots, while stay at a good distance the player and moving the enemy smoothly.
@JohnDoeagtfdyutasgdjak
@JohnDoeagtfdyutasgdjak 6 жыл бұрын
how would I save multiple rooms?
@sylvyonosu9326
@sylvyonosu9326 5 жыл бұрын
i wonder too
@sylvyonosu9326
@sylvyonosu9326 5 жыл бұрын
Okay i figured out how, but it’d be hard to explain over youtube comments If you haven’t figured it out already, do you have discord? I can explain it there
@romualdhenry1633
@romualdhenry1633 5 жыл бұрын
Hi, One of you can explain to me how you did ? it will really help me so much !!
@sylvyonosu9326
@sylvyonosu9326 5 жыл бұрын
Romuald Henry do you have discord? I can explain it there easily
@romualdhenry1633
@romualdhenry1633 5 жыл бұрын
@@sylvyonosu9326 Yes I have discord, but my oral comprehension in english is very bad :/
@short207
@short207 2 жыл бұрын
SaveStringToFile doesn't work for me.
@Mellz900
@Mellz900 4 жыл бұрын
This will bypass the sandboxing?
@GnomeMadeGames
@GnomeMadeGames 6 жыл бұрын
This was great help thanks.
@owenbevt3
@owenbevt3 6 жыл бұрын
One problem I've found with this method is it changes the id of your instances (and as far as I know you are not alowed to change it back again). Guess I'll have to find everwhere I refer fo instance ID and find something elce to use?
@glitched_studios
@glitched_studios 5 жыл бұрын
Got it working well on desktop. But does this work for Android on IOS?
@evensteven4367
@evensteven4367 5 жыл бұрын
Can you be more clear with the parent and child object, like the code in them because I think that's why this system isn't working for me. I'm just using a game object with no parent, and I'm accessing the global variables within, so I don't understand why this isn't working. Nvm I fixed it
@iainbell8366
@iainbell8366 6 жыл бұрын
You mentioned being able to add many sub levels in the JSON. I have objects with DS Lists inside their create event. I try add them to the DS Map but it only saves the reference ID. I tried using the ds_list_mark_as_map but its still only saving the reference. Anyone got a few pointers on how to expand his example to save DS Lists inside an object instead of just simple variables such as x,y, image_scale... etc? Should I simply use ds_list_write() to save the DS List? Not really readable and does not create sub levels in the JSON file. Appreciate some pointers.
@repsej2003
@repsej2003 6 жыл бұрын
If I understand your comment correctly, you're using the wrong "mark as" function! If you want to save DS Lists inside a DS Map, you need to use ds_map_mark_as_list. OR, you can use the special function ds_map_add_list, which will both add the list to the map, and mark it for you.
@larryteslaspacexboringlawr739
@larryteslaspacexboringlawr739 6 жыл бұрын
thank you for gamemaker video
@JaisonJFranklin
@JaisonJFranklin 5 жыл бұрын
Wow! Very complicated for me. If I need save the current values of all the variables created by me in my game is this the best way?
@KornYellow
@KornYellow 4 жыл бұрын
What happened if I have 2 or more room to save how can I do that....
@Etricks11
@Etricks11 4 жыл бұрын
use room_get_name to save the room name string then when your loading pass the string though asset_get_index then load the room
@peal9256
@peal9256 6 жыл бұрын
if we make objects that we want to save child objects of the saveme objects what do we do if the things I want to save already have a parent ?
@nathan08085
@nathan08085 6 жыл бұрын
Pea & L I think you have to copy the events into all the objects and change psaveme to the object
@repsej2003
@repsej2003 6 жыл бұрын
Well, you could make the parent object a child of saveme, if all the children of said parent need to be saved. Otherwise you might have to create a "subparent" to distinguish between the ones you want to save, and the ones you don't. Sadly this is a limitation of GameMaker itself, with objects only being able to have a single parent, but you can definitely make it work!
@crainingaming3082
@crainingaming3082 6 жыл бұрын
hey shaun, Ive been wondering something, in my game, Ive been trying to make an hp system but it just doesn't work. here is my code. my player just dies right away. /// @desc Die if (place_meeting(x,y,oEnemy)) or (place_meeting(x,y,oEnemyBig))hp--; if (hp==0) { with (oGun) instance_destroy(); instance_change(oPDead,true); direction = point_direction(other.x,other.y,x,y); hsp = lengthdir_x(6,direction); vsp = lengthdir_y(4,direction)-2; if (sign(hsp) !=0) image_xscale = sign(hsp); }
@ringtoss8975
@ringtoss8975 5 жыл бұрын
It's because you most likely have that code in the step event which means when the player and enemy are in contact, the player loses 1 hp per frame. So it appears are if the player just dies right away. You should add knockback or inviniciblity frames when hit so that this doesn't happen. PS: I know this comment is from a year ago but maybe someone else might have the same issue in the future and this may help them.
@nathan08085
@nathan08085 6 жыл бұрын
Thanks, this is neat.
@GmodPlusWoW
@GmodPlusWoW 6 жыл бұрын
Will this work with scripts, like if you're trying to make an RPG in GameMaker?
@nathan08085
@nathan08085 6 жыл бұрын
GmodPlusWoW yes
@yuuri_
@yuuri_ 4 жыл бұрын
wtf is the SaveStringToFile function and why can't i access it
@scrongus1959
@scrongus1959 4 жыл бұрын
go a few seconds further in the video and you'll see the script
@REALSOLIDSNAKE
@REALSOLIDSNAKE 3 жыл бұрын
Hello Shaun. This is an awesome tutorial, thanks for it. I do have one question, it works wonders when the room is the same, though when moving between rooms, the objects loaded are passed to other rooms. Any one knows how to solve this? I've been trying to think a way to work around this, like a save for each room. The only problem I can think about this is for save deletion as I am trying to make a game with 3 save game slots, and making a script for code deletion seems a bit difficult for my current level of knowledge. Looking forward to hear from you guys!
@jackhelmich1346
@jackhelmich1346 Жыл бұрын
ds_map_add(_map, “room”, room) Then just do an if statement where you specify a room
@hericki5483
@hericki5483 3 жыл бұрын
"SaveStringToFile()" not exist '-'
@LeftClickShift
@LeftClickShift 6 жыл бұрын
Sorry to bother anyone here, but using this method- is their easy way to save the contents of a rather large 2D array into a JSON file and retrieve it when loading??
@DarkKnightDad
@DarkKnightDad 6 жыл бұрын
you can save it as a list. Use the same code in the video, but instead of storing a map in each list, store a list in each list (so that the outer list is the rows, and the inner lists are the columns) [just remember to use ds_list_mark_as_list]
@seandougherty2925
@seandougherty2925 5 жыл бұрын
I dont understand where he went to when he highlights a bit of text and then hes in SaveStringTo File
@frankiewennerIV
@frankiewennerIV 5 жыл бұрын
I believe he middle clicked his mouse and it took him to a script that he had already created just be sure to create a blank script called SaveStringToFile then you can middle click that same spot you saw him click, yours will be blank however so just type what he has in that script.
@ringtoss8975
@ringtoss8975 5 жыл бұрын
Hey Shaun, just a quick question. I noticed in previous tutorials you used ++i inside for loops but in here you've used i++ instead. Does it make any difference besides including the first entry when using i++ as apposed to ++i? Great tutorial, once again!
@GlyphicEnigma
@GlyphicEnigma 5 жыл бұрын
It shouldnt make any difference. i++ is basically the same as saying i+1 anyway
@mateusleme5846
@mateusleme5846 6 жыл бұрын
Does this works for android projects aswell?
@ryancavalcante6761
@ryancavalcante6761 5 жыл бұрын
Probably.
@athenasowl1857
@athenasowl1857 4 жыл бұрын
Hi Shaun, I'm making a game with an achievement room with lots of global variables that I need to save and I do not have experience when it comes to saving and loading. I've followd along your tutorial and watched the video on Juju Adams, and I was wondering how you would save and load global variables within a persistent object. Currently I have an achievement room and I have a persistent game object called obj_achievements that holds all the achievements / global variables. The way I've set up my code is that instead of an (if key pressed) to save and load, I have used the step event in my object SaveLoad to trigger to save when at the end of the game when in rm_end, and load once it has saved. Would I still destroy my object obj_achievements before loading? How should I then write to create a new object? Do I still use instance_create_layer? Should I be using something else instead of JSON? Thank you for all that you do. I really appreciate your videos.
@GameDevYal
@GameDevYal 6 жыл бұрын
Seeing "better" and "JSON" in the same sentence irks me greatly, but I suppose "better than the default GM save system" isn't the highest of bars to set :P
@richard_orc
@richard_orc 4 жыл бұрын
thank you =D
@mtr3754
@mtr3754 4 жыл бұрын
One thing I'm wondering about is where it's saving to. I set the name as savegame.sav like in the tutorial, but I can't find that save file anywhere in the directory. Mind you, it still works perfectly for me.
@shadowdsfire
@shadowdsfire 4 жыл бұрын
%localappdata% folder
@NotMySocial
@NotMySocial 6 жыл бұрын
Oh wow i havnf seen 5 comments from this channel xD
@gdomjan83
@gdomjan83 6 жыл бұрын
There is a thing I'm not entirely sure about. At the beginning of the save script, first you create the ds_list, then you create the ds_map, and finally you add that map to the list. But at that point the map is empty, isn't it? Because you only populate the map with variables after that. I thought the order you do this would be : create the list, create the map, add variables to map and just after that you add the now populated map into the list. Or is there something I'm missing?
@Azenris
@Azenris 6 жыл бұрын
only a reference is added to the list. so even as populate it after, they reference the same map
@aforgottenmemory4160
@aforgottenmemory4160 6 жыл бұрын
phuck, my brain organ.
@aaronwise1089
@aaronwise1089 4 жыл бұрын
I thought game maker studio 2.3 was meant to be easy to use and have no coding, well that does it I am moving to construct 2 which is making things easier than both game maker studio 2.3 and Clickteam Fusion 2.5
@jakeadam0000
@jakeadam0000 6 жыл бұрын
An IAP tutorial would be great
@nathan08085
@nathan08085 6 жыл бұрын
XenoFusion - MTG all topics are voted on patrion. Please suggest there; it is only $5 ish dollars a month
@jakeadam0000
@jakeadam0000 6 жыл бұрын
Can you add In app purchases to a game made for steam? (my game is an MMO btw)
@CSanykdotCom
@CSanykdotCom 6 жыл бұрын
"|" is called the pipe, at least in the USA.
@purplegamer6223
@purplegamer6223 6 жыл бұрын
Spoiler Alert "I going to Press L"
@ВячеславУкраинцев-т2з
@ВячеславУкраинцев-т2з 6 жыл бұрын
Ох, спасибо тебе большое! Как же я долго думал) it's russian
GameMaker Studio 2 - Wall Jumps with momentum
29:39
Sara Spalding
Рет қаралды 53 М.
GameMaker Studio 2 - Best Saving and Loading Tutorial (2.3.1+)
23:01
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 121 МЛН
Миллионер | 2 - серия
16:04
Million Show
Рет қаралды 1,6 МЛН
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 88 МЛН
GMMeetup #7 - Juju Adams - I Love Data
25:38
Sara Spalding
Рет қаралды 10 М.
GameMaker Studio 2: Rope Swing Tutorial
25:45
Sara Spalding
Рет қаралды 48 М.
The 100 Games That Taught Me Game Design
2:13:14
Game Maker's Toolkit
Рет қаралды 1,4 МЛН
DS Map Based Save System
18:56
PixelatedPope
Рет қаралды 36 М.
JSON SAVING in GameMaker with STRUCTS
8:38
GameMakerStation - Matharoo
Рет қаралды 9 М.
Object States | Game Maker Studio 2
22:21
FriendlyCosmonaut
Рет қаралды 137 М.
Blend Modes & Silhouettes | Game Maker Studio 2
31:52
FriendlyCosmonaut
Рет қаралды 35 М.
Stop using std::vector wrong
23:14
The Cherno
Рет қаралды 118 М.
Optimisation Tips | GameMaker Studio 2
19:10
FriendlyCosmonaut
Рет қаралды 50 М.
GameMaker Studio 2: Isometric Game Tutorial
35:44
Sara Spalding
Рет қаралды 112 М.
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 121 МЛН