Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How do you create save profiles?

Discussion in 'Scripting' started by Lethn, Mar 21, 2022.

  1. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    I'm aware of how saving works generally and will probably delve into finding out about modern methods at some point for my game. One thing I'm fixated on at the moment though is the idea of save profiles, this is a feature of quite a few modern games that I like, see games like Pathfinder Wrath Of The Righteous, Fallout 4, Total War Warhammer 2 for what I'm talking about.

    When you create a new character or game a profile is automatically created with your name and they just dump even the autosave and quicksave in there separate from everything else, this means you can do multiple playthroughs and even if you quicksave tons on that profile it won't interfere with the other playthroughs. My main question is how do you keep track of all of this in code? Obviously individual save files are being created but I'm not sure about the profile itself.
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,882
    Not sure what you're asking really. Different profiles are just a wrapper around save files from a code perspective. Look at the save directory for any game that uses profiles, and you'll see files - sometimes entire folders - for each profile.

    As for keeping track of it in code, you really only need to care about one profile at a time. Same with the save files. You're only ever loading or saving one file. What's more important is all the data that's being written to or read from. The file management should honestly be the easiest part.
     
    Bunny83 likes this.
  3. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    Thanks for the info so far, what I'm talking about is this type of menu and managing multiple profiles.

     
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    5,882
    I was going to say that Fallout 4 is probably just using multiple folders for each 'profile', but looking at my Skyrim:SE save directory... that's not the case. Just one folder filled with bucket loads of saves. So it must walk through the folder of saves and work out all your different characters to build that menu. Nice one Bethesda.

    No idea if Fallout 4 does things the same way, but in Skyrim:SE's case... there's not actually any profiles.

    I say look at the save directory stucture of the games you mentioned. That should give you an indication of how they do it. At the end of the day, it's just a data/file structure.
     
  5. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    Thanks, yeah I'm trying to figure it out, but I thought I'd post that up to give a visual example, folders make sense and then you just have it as a named folder somehow listed in the UI which you can click through. I think for a game where you might want to do multiple playthroughs for example it's a much neater way of dealing with saves rather than just generically dumping things into the documents folder, displaying it on a list and calling it a day. Probably going to have to just look generally at folder and file generation in Unity as well and displaying that in the UI.
     
  6. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    For reference again this is what the documents folder looks like since we're talking Fallout 4.

    1.png

    I guess my main thing is what kind of code would I need to look up to organise this? The generation of the files as it turns out is somewhat the easier part because there's plenty of documentation about that it's organising them that I want to do so it's more pleasant to use the UI.

    Just double checking your post and I'll have a look at what file wrappers are as I don't normally mess with file generation much but I'll need to eventually.
     
  7. Lethn

    Lethn

    Joined:
    May 18, 2015
    Posts:
    1,583
    Ended up finding out the answer through looking at the JSON examples out and it looks like it is indeed them just making some folders in order to organise everything. Some devs seem to prefer to just dump them in a barely organised list, in Fallout 4's case they seem to have made use of a GUI only method but a folder is clearly being created and tracked within the game once you create a character.