How to SAVE & LOAD Game Data Easily in Godot 4

Поделиться
HTML-код
  • Опубликовано: 10 фев 2025

Комментарии • 202

  • @Speed-TV
    @Speed-TV Год назад +19

    Notice 1: You should say file.close() after ur done using file
    Notice 2: It's better to save it to user:// instead of res://
    Notice 3: It's better to save the data as a dictionary instead of a plain integer variable, so you can group it together as one because calling get_var() will move the pointer up
    Notice 4: Someone mentioned that it's even better to save using custom resources but idk how to do that and dictionary seemed to work fine

    • @parvjain21
      @parvjain21 11 месяцев назад +1

      can you elaborate on the second point?, where does user:// save the file in? and why is it better that way?

    • @reuwdev
      @reuwdev 6 месяцев назад

      @@parvjain21 project -> open user data folder

    • @Its_Kioh
      @Its_Kioh 5 месяцев назад +1

      @@parvjain21 I would also like to know

    • @lu34z
      @lu34z 5 месяцев назад +1

      @@Its_Kioh i would also like to know

    • @jonas8588
      @jonas8588 5 месяцев назад +1

      @@lu34z I would also like to know

  • @jorgedavidcoronadoalonso
    @jorgedavidcoronadoalonso Год назад +66

    get_var() does not get the variable like parameter. You don't need to put the variable like parameter. It just returns the first variable founded, the the second...
    You returned the variables that you stored beacuse you called it in order as you declared.

    • @mikicerise6250
      @mikicerise6250 9 месяцев назад +4

      Thanks. I was scratching my head at that one. xD

    • @dominicballinger6536
      @dominicballinger6536 8 месяцев назад

      So you only need to call get_var() without specifying the variable in the parenthesis specifically?

    • @jorgedavidcoronadoalonso
      @jorgedavidcoronadoalonso 8 месяцев назад

      @@dominicballinger6536 Yes, because the parameter of get_var() does other thing.

    • @sorsx
      @sorsx 6 месяцев назад

      @@jorgedavidcoronadoalonso I didnt understand can you please explain it simply?

    • @jorgedavidcoronadoalonso
      @jorgedavidcoronadoalonso 6 месяцев назад +6

      @@sorsx Sure, if you use get_var() many times you will get the next variable in row. If you have 3 variables stored, you will get the third variable if you call the function three times, not by putting the number three as parameter. The situation of the video is coincidence because he called the variable the same number of times as variables stored.

  • @FilenameNULL415
    @FilenameNULL415 Год назад +11

    That's what I wanted for a long time. Thanks!

    • @dev-worm
      @dev-worm  Год назад +4

      glad i could help!

    • @MdTahsinMazhar-qr7uw
      @MdTahsinMazhar-qr7uw 7 месяцев назад +1

      Bro can we save whole sene

    • @sorsx
      @sorsx 6 месяцев назад +1

      @@dev-worm can we save the whole scene just what like @MdTahsinMazhar-qr7uw said?

  • @gamer_man1450
    @gamer_man1450 День назад

    love the step by step process and how clear you were

  • @thechicken6430
    @thechicken6430 8 месяцев назад +12

    Short, simple, and actually works! 10/10, 5 stars, would code again

    • @dev-worm
      @dev-worm  8 месяцев назад +2

      awesome I am so happy to hear that! thank you!!

  • @mattdanerd
    @mattdanerd Год назад +4

    Thank you so much for this tutorial, it is way more helpful then the other ones which just blast me with code, and expects me to understand. I really appreciate it.

    • @dev-worm
      @dev-worm  Год назад

      so happy to hear!

    • @RackteamSuper
      @RackteamSuper 7 месяцев назад

      @@dev-worm hey can you make a video fixing any errors people have

  • @artdirectorgiraffe1003
    @artdirectorgiraffe1003 Год назад +2

    Always excited to see your next video!

    • @dev-worm
      @dev-worm  Год назад +2

      means the world to me!

  • @Sonic_Lane
    @Sonic_Lane Месяц назад

    Exactly when you feel lost hes here to save you thank you man

    • @dev-worm
      @dev-worm  Месяц назад

      aw I am so glad it was helpful!! thank you so much, if you ever need anything feel free to let me know!

  • @shawnLittle-sq4nr
    @shawnLittle-sq4nr 7 месяцев назад +2

    thx man i need that i been look for some one to show how to save vars and load them you was the best one i found i love all your video's your videos help a lot over my first year of using godot 4 so thx all your vids are amazing thx for all your work

    • @dev-worm
      @dev-worm  7 месяцев назад

      so glad to hear that!! thank you!! and if you ever need anything just let me know!

  • @klause2s
    @klause2s 5 месяцев назад

    i've been struggling with this issue for a week on end. it's stumped me more than any other coding issue i can recall. i felt demotivated to work on my game, more than i have in a long time, all because of the stupid saving and loading.
    this video completely fixed it in 4 minutes.

    • @dev-worm
      @dev-worm  5 месяцев назад +2

      i am so sorry to hear youve been have issues with that so long, im just glad to hear the video was able to help! If you ever need anything then feel free to let me know!

  • @palilionismarat6033
    @palilionismarat6033 11 месяцев назад +1

    Hi bro, I'm from Russia. thanks for a very good and fast guide, although it seemed to me a little dirty in the code, but THANKS for everything else!!!

  • @DrW1ne
    @DrW1ne Год назад +1

    Thanks man, For me who is making only arcade games, Its important to know something new.

    • @dev-worm
      @dev-worm  Год назад +2

      glad i could help!

  • @CyberAngel573
    @CyberAngel573 Год назад +1

    Thank you so much. This was WAY easier than the one on Godot's website.

  • @peadamo
    @peadamo Год назад +8

    Beautiful tutorial, simple, clear and concrete. Thank you so much!

    • @dev-worm
      @dev-worm  Год назад

      so glad to hear that!

  • @jeremiahaemile2008
    @jeremiahaemile2008 Год назад

    Finally you uploaded it. Iwas waited it from along along time❤❤❤

    • @dev-worm
      @dev-worm  Год назад +2

      glad i could help ❤️

  • @JaafarGhassoun
    @JaafarGhassoun Год назад +1

    Thank you so much broo ,i appreciate your efforts,i was waiting for this. it's very helpful ❤❤❤

  • @iceman9355
    @iceman9355 6 месяцев назад

    i'm already starting to see how this could help me out, thanks for the guide.

    • @dev-worm
      @dev-worm  6 месяцев назад

      hope it can help!! thank you!!

  • @VodefloS
    @VodefloS 7 месяцев назад +1

    Thanks you! I am made the cliker game, and you are very help me!

    • @dev-worm
      @dev-worm  7 месяцев назад +1

      I am so happy to hear that!!

  • @kurama3458
    @kurama3458 5 месяцев назад

    Thank you so much! I really need a save & load system for my game because it's going to have a lot of levels

    • @dev-worm
      @dev-worm  5 месяцев назад

      i am glad to hear!! I hope it was able to help! Update me on how the project goes!

  • @sorsx
    @sorsx 6 месяцев назад

    Thank you so much, This is the only way that actually worked for me thank you ❤❤❤

    • @dev-worm
      @dev-worm  6 месяцев назад +1

      I am so happy to hear that!!

    • @sorsx
      @sorsx 5 месяцев назад +1

      @@dev-worm Have you made a video about the topic "How to make Ai enemies?" ++ How to save the options like savibg buttons activation or slider percent?

    • @sorsx
      @sorsx 5 месяцев назад

      @@dev-worm+ I subbed

  • @lennertplayz
    @lennertplayz 2 месяца назад +1

    the user:// thing is really cool

  • @lu34z
    @lu34z 5 месяцев назад +1

    thanks! great vid 🎉🎉

    • @dev-worm
      @dev-worm  5 месяцев назад +1

      glad to hear it helped!

  • @Drowned_Peppa
    @Drowned_Peppa 5 месяцев назад

    Exactly what i needed! indeed useful

  • @AJMarraffa
    @AJMarraffa 6 месяцев назад

    Thank you, I wasn't even aware of store_var and get_var for files. Very helpful!

    • @dev-worm
      @dev-worm  6 месяцев назад

      glad I could help!!

  • @miguelferreiradasilva116
    @miguelferreiradasilva116 10 месяцев назад

    bro you are such a life saver,i wish all the good for you

    • @dev-worm
      @dev-worm  10 месяцев назад +1

      glad to hear that!! thanks!! wishing the best for you too brother!

  • @shanefoster5305
    @shanefoster5305 9 месяцев назад

    Thanks for this! Came just in time for my game! I'm using it to save position of generated tiles so the level loads the same when it can load random levels!

    • @dev-worm
      @dev-worm  9 месяцев назад +1

      so amazing to hear!! hope everything comes together correctly!

  • @cihanbey7728
    @cihanbey7728 6 месяцев назад

    thank you so much for this video u saved my life

    • @dev-worm
      @dev-worm  6 месяцев назад

      i am so happy to hear that!! thank you!

  • @HerobrineTVv
    @HerobrineTVv 9 месяцев назад

    Thanks for this W tutorial, easy and fast implemention!

    • @dev-worm
      @dev-worm  9 месяцев назад

      glad to hear! thanks!

  • @AnimatorZeeVIDEO
    @AnimatorZeeVIDEO Год назад +5

    Thank you so much for this! I started learning Godot a few days ago and this is a huge help.
    Quick question; would it be possible to save and load two different types of data separately? Many survival games save characters and maps separately, for instance. It seems like it would be possible, but I'm not entirely sure and don't want to dig myself into a hole.

    • @dev-worm
      @dev-worm  Год назад +3

      thanks! Yes of course its possible but I'm not exactly sure how ill beable to explain it over text.. so maybe I can look into creating a more advanced save and loading tutorial

    • @kindavacant7843
      @kindavacant7843 Год назад +1

      @@dev-worm That would be great. Almost all tutorials on Godot are simple which has its place but how about an advanced concept to save for example in the game I'm making: Using Godots tilemap saving only the tiles changed from the original map.
      There's 39 towns on the map each a class with tons of variables including a population in an array in the town class from another class which has all the per person stats which in itself has more arrays for their memory.
      Simply put: Array of 39 towns: each town has an array of up to 100 individual people and each of those people have some arrays for their memory. It's all held in a singleton(global) with duct tape. Kinda tired of stumbling around figuring all this stuff out myself and making a video about it.
      Please pity us and help? I have cookies. That I baked. And accidently swapped the sugar for baking soda. Nobody wants them so they're all yours for an advanced video on the concepts of saving a mess like this.

    • @kindavacant7843
      @kindavacant7843 Год назад +1

      Okay I've sort of figured this out. The important thing to note is one has to extrapolate the data they want saved, then reconstruct it on load.
      In the above case I created a dictionary called thisTown and another dictionary called thisPerson (no memory arrays tried yet). Then with a for loop for # of towns and another for loop for # of people in said town filled in the variables in the dictionaries from the town arrays. The save_var writes 1 variable at a time appending the next save_var under that. In notepad the file was the dictionaries with keys but gibbrish variables. The get_var() is boolean in 4.1.1 so file.get_var() not file.get_var(Variable1) . The first get_var() got the town dictionary back with all variables and the second get_var() the first person of said town ready to repopulate the town arrays. One can check for EOF, cursor position and other junk (use the docs)
      As an abide: Doing a file.close() closes the file and re-opening, adding another save_var appends that variable to the end of the file. There is no option in FileAccess to delete the file; however, Using FileAccess.READ_WRITE from docs: 'Opens the file for read and write operations. Does not truncate the file. The cursor is positioned at the beginning of the file.' IE writes over the file. Just tried all this out for the heck of it so probably simpler ways but like the tiny file-size and it can use encryption.

  • @johannfowl8653
    @johannfowl8653 5 месяцев назад

    simple and easy, thanks a lot

  • @jeffy1221
    @jeffy1221 4 месяца назад

    This was simple and great

  • @PandaBoyMakeStuff
    @PandaBoyMakeStuff 6 месяцев назад

    Damn this is easy to understand and simple

    • @dev-worm
      @dev-worm  6 месяцев назад

      so happy to hear that! I hope it is able to help!

  • @SporeAU
    @SporeAU 7 месяцев назад

    you are just so good, you've saved my ass a ton of times

  • @Kusnierr
    @Kusnierr Год назад +6

    Thanks for the video, I'm just getting into saving/loading and will try this approach tomorrow.
    Side question, at 1:37 you show the _process function and at least as far as I can tell, this function is quite inefficient, no?
    Wouldn't it be better to access and update the text label only in the pressed functions when the buttons are clicked? That's how I've been doing it in my project but perhaps your way is better for some reason I'm not seeing. Thanks.

    • @dr.sleaseball441
      @dr.sleaseball441 8 месяцев назад +1

      in my game there are situations where the value changes from other functions too so it makes sense for the value to be updated by process and not by button press and since process is fast enough it seems efficient to me but your way is still good if your values can only change by button press. why would it be inefficient though? (i'm still learning too)

    • @Kusnierr
      @Kusnierr 8 месяцев назад +1

      @@dr.sleaseball441 process is called every single frame, i.e. it is called *often*. For a single thing like this it probably won't have too much impact, but if you keep adding things to _process that could/should be called more rarely/elsewhere, you will eventually run into a problem where too much stuff is trying to execute via _process and run into a performance issue.

    • @dr.sleaseball441
      @dr.sleaseball441 8 месяцев назад

      @@Kusnierr I see, you are right.

    • @Marius2Rocker
      @Marius2Rocker 2 месяца назад

      @@dr.sleaseball441 Time to learn signals and singletons! Keep the number you want displayed in a singleton (basically, its somehow set up in the 'Autoloader' tab in the project settings), then give everything that interacts with the number a signal to increase the value, which then also tells the label to get notified.

    • @dr.sleaseball441
      @dr.sleaseball441 2 месяца назад +1

      @@Marius2Rocker i heard of singletons before but never actually tried to learn what it does, so guess it's time to learn that.

  • @skele6804
    @skele6804 Год назад

    Thanks you so much you help me a lot.

  • @spacemonkey2377
    @spacemonkey2377 Год назад

    I feel like a spoiled kid for even asking this, but I would have loved to be able to copy/paste from your code directly to my project. It's probably not very important for this tutorial, but maybe consider it for future tutorials? Anyway great work! Thank you so much

    • @dev-worm
      @dev-worm  Год назад +1

      thats a good idea, Ill most likely start posting a GitHub link in the description so you'd beable to copy and paste it!!

  • @cris_r99
    @cris_r99 27 дней назад

    Have this error to me Invalid type in function 'get_var' in base 'FileAccess'. Cannot convert argument 1 from Nil to bool.

  • @arcturusakerfeels1438
    @arcturusakerfeels1438 Год назад +3

    thanks man this video comes right on time for my project !! how could I apply that for a player's position upon changing scenes tho ?

    • @GrimIkatsui
      @GrimIkatsui 7 месяцев назад +1

      I just started working on that problem myself and found a solution. In my setup the save and load functions are in a global script, and in that script I set a player_position variable. In the Player scene I set that Global.player_position variable I made to position (yeah, just Global.player_position = position) in my _physics_update function in my Player scene's script. This makes save work with player_position in your save function. Finally I put position = Global.player_position in the _ready function. This sets your position from the loaded data.

  • @ThePoptartPrince
    @ThePoptartPrince 5 месяцев назад +1

    I have been having this problem where my variable values get confused with other variables. Is there a fix to this other than deleting the original save file?

  • @NexusBaum
    @NexusBaum Год назад

    very helpful! thx

  • @Devlife525
    @Devlife525 8 месяцев назад

    Best Channel

    • @dev-worm
      @dev-worm  8 месяцев назад

      aw thanks!! means the world! glad it helped!

  • @WavyHarmony-fw8lf
    @WavyHarmony-fw8lf 7 месяцев назад

    Thank you so much, that helped me a lot. Does it still work if I upload the game and run it on a mobile phone?

    • @dev-worm
      @dev-worm  7 месяцев назад +1

      yes!! it should still work!! if you are having any errors just let me know!

  • @Assem_DEV
    @Assem_DEV Год назад

    I love explaining

  • @HeathTheCoder
    @HeathTheCoder Год назад

    I will definitely use this in the furture!

    • @dev-worm
      @dev-worm  Год назад +1

      so happy to hear that!

  • @pierrenagonio
    @pierrenagonio Год назад

    Thank You Friend! Have a nice coding :)

  • @luanlemes5579
    @luanlemes5579 8 месяцев назад

    subscribed, thank you

    • @dev-worm
      @dev-worm  8 месяцев назад

      thank you so much!! it means the world!! I am glad it was able to help!

  • @WakaWolfOfWind
    @WakaWolfOfWind 5 месяцев назад

    Thank you very much this video is really easy to follow but i have a little problem
    i wanna save and load array variable but when i do a load func it's say can't convert array to bool
    i wanna make scoreboard for event and i need array to collect player name and score

  • @lordpalandus11
    @lordpalandus11 4 месяца назад

    With this method can you save entire objects of a class, such as with color and texture data loaded for that class?

  • @zoade5178
    @zoade5178 5 месяцев назад

    Hello! Question, does this need to have each variables in order or we can load them at whatever order without it bugging?

    • @dev-worm
      @dev-worm  5 месяцев назад

      it should allow you to do it in whatever order you want!!

  • @HGamesStudio-cs9dh
    @HGamesStudio-cs9dh 11 месяцев назад +1

    Thanks.

    • @dev-worm
      @dev-worm  11 месяцев назад +1

      of course! thank you!

  • @jshmaxer8413
    @jshmaxer8413 8 месяцев назад +2

    Thanks, but where can I find the file?

  • @LunaticFirework
    @LunaticFirework 10 дней назад

    the first time im leaving a comment for a game dev tutorial, because it really helped me with storing variables for my game, thank you so much for this tutorial!

  • @mrun-gamer9008
    @mrun-gamer9008 Месяц назад

    does this work with global variables (variables stored on a global script) but does that mean the save and load must be in the same global script or can it save and load from other scripts from other nodes?

  • @RaposaCadela
    @RaposaCadela 10 месяцев назад

    I thank fuckin' GOD for you, man

  • @instantlydrop5364
    @instantlydrop5364 11 месяцев назад

    thank you!

    • @dev-worm
      @dev-worm  11 месяцев назад

      of course anytime! thank you!

  • @ParryMime
    @ParryMime Месяц назад

    Still works in Godot 4.3!

  • @lkadath
    @lkadath Год назад

    great, really simple to apply. Is it possible to implement it for a browser game?

    • @AkaObbies
      @AkaObbies Год назад

      the user:// path should work for html5 exports as it will be stored on a virtual filesystem via indexeddb

  • @AD_EL_
    @AD_EL_ Год назад +3

    when i do that exact code i get the error :
    Invalid type in function get_var in base 'FileAccess' cannot convert argument 1 from nil to bool
    can someone assist me here

    • @gamedevomni
      @gamedevomni Год назад

      same :(

    • @AD_EL_
      @AD_EL_ Год назад +1

      ​@@gamedevomnitry replacing store_var with store_line that fixed it for me

  • @pierrot457
    @pierrot457 Год назад

    Very nice tutorial. Concerning the save path, it must always start by "user://..." ? Does this path will be correct for all players if my game is in production ?

    • @YELLOWFUCKINGSYRUP
      @YELLOWFUCKINGSYRUP Год назад +1

      yes, user:// works for anyone.

    • @red3tango
      @red3tango Год назад +2

      user:// is a special path that is different based on OS that is writeable by the user account running the program. say in windows its nested in the appdata folder.

  • @DrW1ne
    @DrW1ne Год назад

    Please make a tutorial/tips for World Environment

  • @Bk15729
    @Bk15729 Год назад

    THANK YOU

  • @Ablity_learner
    @Ablity_learner Год назад

    Thank you

  • @jeremiahaemile2008
    @jeremiahaemile2008 Год назад

    Can you make tutorial about local multiplayer in one computer like game fireboy and watergirl

  • @eduardomota3068
    @eduardomota3068 9 месяцев назад

    How do i create the file? I did exactly like the video but just says that there is no file, witch type of file should be in the filepath?

  • @TodoBakuDeku122
    @TodoBakuDeku122 2 месяца назад

    Does it work for GODOT 3.5.2? Sorry for asking (I know the title clearly says "4")

  • @Taimisverycool
    @Taimisverycool 7 месяцев назад

    But how do I save his position the numbers work but I haven't figured out how to save things like the world or player position

  • @BellaStar682
    @BellaStar682 Месяц назад

    how would i load the data from different scene like a title screen rather than in the options menu?

    • @dev-worm
      @dev-worm  Месяц назад

      you would have to have it stored within a global script, and pull that data from in each scene from that global script. I hope that helps a little

  • @connorjade5460
    @connorjade5460 11 месяцев назад

    How can I save inventory data and load the same on startup??

  • @maxmorris7844
    @maxmorris7844 Год назад +5

    i tried this, you don't need to type the variable name in get_var() ,it doesn't do anything
    when you call get_var() it offloads the variable in the order that they were saved
    // I have save 2 variable to the file
    data1 = 123
    data2 = 456
    func load_data():
    if FileAccess.file_exists(filepath):
    print("file exists")
    var file = FileAccess.open(filepath, FileAccess.READ)
    print(file.get_var()) //will print out the first variable saved // data1(123)
    print(file.get_var()) //will print out the second variable saved // data2(456)

  • @christopherhernandezsalina3491

    I have a question, how do I do if I want to save the player's position?

  • @Tsumikiro
    @Tsumikiro Год назад +5

    does this avoid the problem that using the Resources node/type had that allowed people to run arbitrary code?

    • @null6482
      @null6482 Год назад +1

      Maybe u can try to check the resource hash and type and if it doesn't match u just free the malicious resource

  • @spiele_maus
    @spiele_maus 9 месяцев назад

    How do you do it with arrays?
    This seems to only work with normal variables. For instance I have a array var level_flags = [1,5,3,4] How do I save that cuz It always gives an error.

  • @EthernalOynuyor
    @EthernalOynuyor Год назад

    Question: If i add a new variable later on, this code doesn't make it write the new variable to the existing file and the old file has to be deleted to fix the issue, how do i fix this?
    EDIT: I fixed it by using this on my singleton;
    var UserSettings = "user://UserData.save"
    var default_game_data = {
    "xp": 69,
    "somethingsomething": true,
    }
    var game_data = {}
    func _ready():
    load_data()
    var file = FileAccess.open(UserSettings, FileAccess.READ,)
    if FileAccess.file_exists(UserSettings):
    game_data = file.get_var()
    print("FILE EXISTS")
    file.close()
    for key in default_game_data.keys():
    print(key)
    if not game_data.has(key):
    game_data[key] = default_game_data[key]
    print(key, " added")
    file = FileAccess.open(UserSettings, FileAccess.WRITE)
    file.store_var(game_data)
    file.close()

  • @semmel911
    @semmel911 11 месяцев назад

    How do I save booleans and other things? It always throws an error like this: Cannot convert argument 1 from String to bool

  • @boanediggadukabberst5380
    @boanediggadukabberst5380 8 месяцев назад

    Everytime i get an Error can't use store_var on a null instance Something Like that

  • @Stark_Ibrahim
    @Stark_Ibrahim 7 месяцев назад

    I want to save player position x , y and all of player visibility and it dose not work can you help me plz??

  • @ramonavisconti674
    @ramonavisconti674 Год назад

    I have this setup to save the highscore of the player, it works fine when I run the game inside Godot, but when I export the game, it crashes when it tries to save, do you have any idea why that might happen? Your videos have been very helpful, thanks!

    • @dev-worm
      @dev-worm  Год назад

      you have to make sure in your script that your creating a new script and not just trying to add/change variables in a script that doesn't exist

  • @NotAnAiYet
    @NotAnAiYet 10 месяцев назад

    It works on windows when I export it but not on macOS. Any ideas?

  • @icastmoustache9387
    @icastmoustache9387 2 месяца назад +1

    why complicate with inventory? inventory already has to live as a data structure somewhere while youre playing the game, just save that, structure and all, like, wut

  • @cris_r99
    @cris_r99 27 дней назад

    My variables get confused whit other

  • @RubixKid123
    @RubixKid123 6 месяцев назад

    For me I’m trying to save a score which is a text as a variable and it won’t work saying can not convert text to bool

    • @dev-worm
      @dev-worm  6 месяцев назад

      did you statically create the variable as only being a bool value??

  • @Russy
    @Russy Год назад

    Great tutorial but quick question. When I add new variables to be saved on an old save file I get an error and I have to delete my data to fix the error. Is there a way to not have to delete my data every update I make to my game? I don’t want people having to delete their data just to play a new version. I am using global variables if that’s an issue

    • @SEDWOfficial
      @SEDWOfficial Год назад

      Personally, after loading saves, I immediately add a check for a null value, and if so, the variable gets its original value (though I’m not sure if this is an effective way, but still)

  • @Kyuboyo
    @Kyuboyo Год назад

    Does godot create a file in the directory when saving data? or it the file created internally which technically won't be human readable? (need to know for a project)

    • @reuwdev
      @reuwdev 6 месяцев назад +1

      it will be readable, you can encrypt it, instead of FileAccess.open(path, FileAccess.WRITE/READ), you do FileAccess.open_encrypted_with_pass(path, FileAccess.WRITE/READ, "password")

  • @NorthGTPS
    @NorthGTPS 7 месяцев назад

    What if it's a string, or True/false value, Does it still work?

    • @dev-worm
      @dev-worm  7 месяцев назад

      yes it should work. let me know if you have any errors with it!

    • @Oliviermewo
      @Oliviermewo 7 месяцев назад

      @@dev-worm it says for get_var() it can only be a boolean not a string

    • @Oliviermewo
      @Oliviermewo 7 месяцев назад

      @@dev-worm fixed last issue but now when ran it says "Invalid type in function 'get_var' in base 'FileAccess'. Cannot convert argument 1 from String to bool."

  • @nofoolstreams8343
    @nofoolstreams8343 Год назад

    hey THANKS HEAPS, im currently playing around with the FileAcess stuff , I am able to check weather a save file exists and use store_var and get_var to save and load, however when I altar the script and add new variables to save and load it causes an error on load cause those variables dont exist. im trying to find a way to check if the variable im trying to fetch with get_var() currently has data to retreive is this possible does anyone know?

  • @sanketsbrush
    @sanketsbrush Год назад

    what about strings ? how to save those ?

    • @dev-worm
      @dev-worm  Год назад +1

      the same way!

    • @sanketsbrush
      @sanketsbrush Год назад

      your method works fine and actually helped me learn save load faster. So thank you for that. But I'll prefer directories like this , var data={some_string:"phrase", some_int:2}. This is much easier to understand.@@dev-worm

  • @TechBoi1115
    @TechBoi1115 Год назад

    Can this work for mobile games

  • @jeremiahaemile2008
    @jeremiahaemile2008 Год назад

    Finally

  • @prismajane
    @prismajane Год назад

    Apparently this method doesn't work with variables that are strings.

    • @Sammo_Wammo_Real
      @Sammo_Wammo_Real 4 месяца назад

      Yes, it doesn't work with strings as far as I've tried

  • @trifon4o
    @trifon4o 7 месяцев назад

    How to encrypt the data to be save

  • @haidoan1267
    @haidoan1267 9 месяцев назад

    is it working for android ?

  • @tareqlimit4049
    @tareqlimit4049 11 месяцев назад

    when i save 2 variables its work but when i save 3 there are a problem

    • @dev-worm
      @dev-worm  11 месяцев назад

      really? hm.. it shouldnt do that.. is there any error

    • @tareqlimit4049
      @tareqlimit4049 11 месяцев назад

      @@dev-worm i found the solution i delete the save file and its work

    • @dev-worm
      @dev-worm  11 месяцев назад

      happy to hear that!!

    • @tareqlimit4049
      @tareqlimit4049 11 месяцев назад

      thanks@@dev-worm

  • @pyrovoice
    @pyrovoice 9 месяцев назад +16

    Dude saving manually 3 vars in a system that probably will contain thousands of them. What is even that tutorial

    • @dev-worm
      @dev-worm  9 месяцев назад +13

      It is old, I have an updated tutorial that involved saving with resources so that'll be way better. sorry about that

    • @dominicballinger6536
      @dominicballinger6536 8 месяцев назад +9

      Hey, at least it's good for noobs like me who would probably only use it for high scores

    • @arcticblitz9630
      @arcticblitz9630 8 месяцев назад

      @@dominicballinger6536literally what I’m here for 😂

    • @Reymax164
      @Reymax164 6 месяцев назад +3

      You can't go to the more complex ones without knowing the very basic.
      Although yeah, it's quite obvious that you'll save/load it from a file.
      It's just… about how you do it on GDScript 🤔
      Then he provided/said examples on how you can use it.
      Which are udeas that'll likely not thinked of by new devs.

  • @Assem_DEV
    @Assem_DEV Год назад

    i have problem in function save

    • @dev-worm
      @dev-worm  Год назад

      whats the issue?

    • @Assem_DEV
      @Assem_DEV Год назад

      @@dev-worm I was saying . I tried to do the same code you did. But I have a problem entering the variable and extracting it. The file does not allow me to enter the variable. Note: I am using Godot 4.2. Does the method work on this version?

  • @Trendsthismonth
    @Trendsthismonth 10 месяцев назад

    Go dot 🎉

  • @CosmicFever
    @CosmicFever 7 месяцев назад

    why ".save"?

  • @FriskDreemurr66669
    @FriskDreemurr66669 6 месяцев назад

    doesnt seem to work

  • @RackteamSuper
    @RackteamSuper 7 месяцев назад

    it says null instance how to fix

    • @dev-worm
      @dev-worm  7 месяцев назад

      at which area are you getting that error? that most likely means a variable isn't being set to a value somewhere before trying to be saved!

    • @RackteamSuper
      @RackteamSuper 7 месяцев назад

      @@dev-worm mvm

  • @JakubSK
    @JakubSK 11 месяцев назад

    Does this work in mobile?

  • @sinbala698
    @sinbala698 5 месяцев назад

    NO Dictionary