Announcement

Collapse
No announcement yet.

How Do I Find Save Game Files That Have Been Copied To The Save Folder (Blueprint Coding)?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How Do I Find Save Game Files That Have Been Copied To The Save Folder (Blueprint Coding)?

    I have a bit of a conundrum here. When the player creates a game in my create game widget, it adds the save name to a list of save game names held by a save game database file. I need to be able to allow the player to add saves from their computer, that way if the save game list somehow gets deleted or lost (and they had a backup), they don't need to start over.

    Click image for larger version

Name:	savegame.JPG
Views:	1
Size:	14.4 KB
ID:	1217163

    Click image for larger version

Name:	LoadGame.JPG
Views:	1
Size:	20.7 KB
ID:	1217164

    In this picture, the file named DeletedSave was saved elsewhere, then deleted in the savegame folder, and added back, and doesn't show up on the load game HUD (obviously, because the code doesn't know to look for it)
    LevelToLevelInfo is the database file, and if it is deleted, there's no way to load any previous saves, because they are no longer saved to an array.

    Click image for larger version

Name:	deletedsavefile.JPG
Views:	1
Size:	19.9 KB
ID:	1217170

    Click image for larger version

Name:	SaveArrayBP1.JPG
Views:	1
Size:	105.9 KB
ID:	1217165

    Click image for larger version

Name:	SaveArrayBP2.JPG
Views:	1
Size:	102.4 KB
ID:	1217166

    Click image for larger version

Name:	SaveArrayBP3.JPG
Views:	1
Size:	82.2 KB
ID:	1217167

    TLDR: How do I find save game files on the computer and add them to my save game array, so that I can add them to my load game widget?

    Edit: I just thought up an idea. I could have the user re-enter the save file name, to be re-added to the save game array. If anyone thinks of a better solution, let me know.
    Last edited by Mewbits; 04-26-2017, 01:56 PM.

    #2
    The way I do it is 70% of how you described in your Edit.

    When the user enters their save game name, have another save file called 'SaveGameList' or something, with a variable called 'SaveGameName'. Then once your user enters their save game name, it saves this to the save file you already have, but then also saves the game name to the SaveGameList (your user doesnt need to enter this twice, you can jsut send the same name twice).

    To Load the list, load your SaveGameList and pull the SaveGameName array from the file, each of the entries in this List will relate to one of your saves.

    Hope this helps
    My Game Frontier Devblog HERE

    Comment


      #3
      Originally posted by Orkney View Post
      The way I do it is 70% of how you described in your Edit.

      When the user enters their save game name, have another save file called 'SaveGameList' or something, with a variable called 'SaveGameName'. Then once your user enters their save game name, it saves this to the save file you already have, but then also saves the game name to the SaveGameList (your user doesnt need to enter this twice, you can jsut send the same name twice).

      To Load the list, load your SaveGameList and pull the SaveGameName array from the file, each of the entries in this List will relate to one of your saves.

      Hope this helps
      Yes. that's what I already did. I named this extra file, leveltolevelinfo. However, what happens when that extra file gets accidentally deleted, or they move a save from one computer to the other, etc? This is why I made it so they can input the name again, if it somehow was deleted from the list and the game doesn't know it is there.

      Comment


        #4
        for accident seletion:
        Create a TextInput, where Users can enter a Savename. When hit enter/commit, the funcrion asks if the Savefile is existing (SaveGameExist). If yes, its name will be added to a newely generated list.

        that way users can reenter their savegame names.
        That makes it even possible to download existing savegames and enter them to the list.

        Comment


          #5
          Hello Mewbits,

          Did you figure out your problem ? And if it`s possible can you show me your load game widget event graph please, i badlly need it now ?

          Thank you and Best Regards

          Comment


            #6
            Personally, I would not even setup my save system in the fashion you have done so. For Maze Qore, I've used a profile system that already saves slots. Instead of pre-saving a list of save names, i have the widget search for the directory path for which it was saved. Just my two-cents.
            Lord Iheanacho
            - The Founder

            Néotl Empire
            Maze Qore
            2D Top Down Shooter

            Comment


              #7
              Originally posted by Lord Iheanacho View Post
              i have the widget search for the directory path for which it was saved.
              How exactly do you search for the directory path within blueprints though? I have since been learning c++ but haven't learned about making save games in c++ yet. Though, I understand it's better to do so to use save file versioning (so players don't have a chance of losing their progress every time there's an update). I can't seem to find any tutorials on that just yet though.

              Comment


                #8
                Im probably just butting in here, but the "how do i read a directory content" is a pretty standard C# or cpp ask.
                Im 100% certain thath either the engine has specific nodes to get the handle and read it to allow you to loop it in BP, or that could very easily create your own custom BP node to do this.

                You can actually find thousands of variations of CPP code to just read a file or a directory content.
                the gist of it is
                get a path, check if file or folder and create a handle for the specific item,
                if the handle is a folder you loop over the contents recursively (a recursive function is usually built to do just that) or just the top level files.
                With the results that are not . (Same directory) or .. (parent directory) you create file handles and usually do what you need to do.

                Also, keep in mind the exe's running in non administrator mode can only read so much - you may want to limit the folder selection to the common locations (documents/saved games/ for windows). The same options for reading do work in cpp for android and IOS but the fail paths become case sensitive.

                All of that is obviously very basic File i/o implementation to say the least, I would seriously think UE4 has it's own similar node to handle all of this...

                Comment

                Working...
                X