Announcement

Collapse
No announcement yet.

Global Save System

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

    Global Save System

    So I want to make a save system with the same functionality as the fallout games (the fps ones).
    When you press F5 it saves the transform, velocity and the state(what it is doing) of many actors.

    I have tried giving every actor I need to save a BP interface and a generic struct with its actor class, transform, velocity and various other generic variables, so that when I needed to save I could get all actors with interface then loop through them all to get their save struct, add that to an array then save that array.
    And when I load the game get all actors with the save interface and tell them to destroy them selves then rebuild the actors from the saved structs.

    But then I found out that when it destroys all of the actors it also destroys newly placed ones from the editor. So that if I ever updated the game the users save would automatically destroy all the actors then it wont rebuild them because they never got saved in the last save.
    So that's a no go.

    I would like some guidance on how to replicate what the fallout guys did please



    I was thinking that if I could get the name of every actor that needed to be saved I could have the name too and when I loaded the game I would only destroy the actors that have the same name as the ones in the save, that would leave anything newly placed alone.
    I'm not sure if the name of actors is the same across play sessions though (I'm getting the name from the "get display name" node)

    #2
    'Display names' are used only in Editor mode. You are not supposed to use on in-game code unless you are using the internal actor IDs. Actor names on shipped game aren't the same you see in Editor.

    Serializing an entire scene, taking a snapshot, is not recording and then replacing on load time some properties.
    When you save something the way you want to do, you are actually saving the entire object to the file and recreating it when loading the level..
    I personally can't see why you'd want to save megabytes of data just to save an entire level state.
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      Well I don't know about you but hundreds of megabytes is easy to come by nowadays for me.
      And I don't see why you wouldn't want to save the entire level.
      btw I am making an open world rpg (YES YES I KNOW THAT'S TOO HARD FOR SCRUBS but I'm not looking to sell it or anything, I'm just getting experience) so saving the level state is an important thing

      What then should I use for names?
      I refuse to input a different name for every instance of an actor that needs to be saved.

      If I "Get all actors with interface" will their locations in the array be the same across play sessions?

      Comment


        #4
        I'd like to bump this now plz

        Comment


          #5
          How about I have an event that I manually fire inside the editor that gets all actors that save then asks if their "SaveId" == 0 and if true then set "SaveId" = ("CurrentMaxId" + 0.00001)
          I can see that I might forget to fire the event between PIE sessions and that I might accidentally drag-copy an actor that has in Id. But both of those are manageable.
          Can anyone else see any more problems with this?

          Comment


            #6
            Simple way would be to save the locations of the actors (vectors) in an array and on load get the vectors and spawn new actors in their place

            in blueprint would be something like -> get all actors of class -> foreachloop -> get the world/relative location -> save into vector array as the array will be filled with vectors of a given class

            on load you would do something like
            saved vector array -> Foreachloop -> spawn actor from class

            That's the general idea (or how i would do it)
            Do Not Argue Toxic Game
            Balloony PoP get it on Google Play
            Fishy Blub Blub
            get it on Google Play

            Comment


              #7
              I was thinking something like that but then if I update the game with changed locations of anything then the save will be wrong
              Last edited by AlphaSierra216; 09-03-2015, 06:33 AM.

              Comment


                #8
                hm, maybe you could use the fancy serialization stuff? i haven't used it and i believe you have to use C++ for that, but i'll just leave these links here:

                https://answers.unrealengine.com/que...game-flag.html
                https://wiki.unrealengine.com/Save_S...d_Binary_Files

                Comment


                  #9
                  Originally posted by AlphaSierra216 View Post
                  I was thinking something like that but then if I update the game with changed locations of anything then the save will be wrong
                  When you spawn them in, why don't you do a trace at that location first to see if that's still a good place to put them and if not move the trace outward until you find a suitable spot?
                  iTween For UE4
                  Procedural pathed animation for actors, components & UMG - $0
                  Runtime DataTable
                  DataTables dynamically loaded from text or Google Sheets while your game is running!
                  easyCSV
                  Fast, cheap, and accurate CSV parsing at runtime!

                  Comment


                    #10
                    Originally posted by Jared Therriault View Post
                    When you spawn them in, why don't you do a trace at that location first to see if that's still a good place to put them and if not move the trace outward until you find a suitable spot?
                    This is a default option now to spawn always or find a near suitable spot. It's incorporated in the 4.9 release.
                    Do Not Argue Toxic Game
                    Balloony PoP get it on Google Play
                    Fishy Blub Blub
                    get it on Google Play

                    Comment


                      #11
                      The way that fallout does it, is using a unique identifier (The FormID). That way, you would pull all of the actors states saved from the save game file, compare to the current ones in the scene and only destroy/re-serialize the actors where the FormID matches. So if you ever update the game that creates new actors that are not in the users savegame, nothing will happen to them since the savegame does not have the FormID recorded.
                      NVIDIA GameWorks merged branch (v4.9.2) (v4.12.5) (v4.13 p2)
                      Feel free to Donate if you wish to support me

                      Comment

                      Working...
                      X