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.



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.





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. :slight_smile:

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.

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.

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

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.

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.

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…

According to search this is the most relevant discussion on this topic so here I am, bumping after 2 years.
The Victory Plugin has a GetFiles node that lets you get files in a folder with ext filter if needed and also has nodes to get paths of certain folders like the game itself, the saved folder (eg.VictoryPathsSavedDir) etc.

Currently I’m experiencing an issue where the ApexDestruction plugin (built-in) being used by my project murders the Build/Launch features but it is required by Victory so…

But yea, if I could, I would probably saintify Victory’s dev (Rama) at this point. Most of the problems I run into are solved by this plugin.

…, this sounds like one of those fake comments promoting some scheme or product. Ah well, I hope this helps others too.

1 Like