Thank you Bob_Gneu! Indeed I don’t intend to save everything, just the current state of player and enemy AI at any given moment. Imagine a 2D version of Asteriods for the sake of an example, I have player ship location, rotation and just to make it more interesting a health bar. There can be anywhere from 5 to 20 asteriods onscreen, each with a velocity and a size (small, medium, large). So one way to handle this would be to simply save at the beginning of each level cleared and figure that if the player is interrupted during a session, they simply need to start over.
But what if we want to save the exact state of the game at any moment. So, if I’m reading you right, a possibility here would be to create a separate cache class, maybe that keeps all this information in either real time or say every few seconds. Maybe include a multi-dimensional array for active AI on screen with size and velocity. Player data, etc. Then when a save event is triggered this data in the class gets dumped to a save slot. So, the question here would become one of testing the performance of the target platform to see where a breakpoint would be in performance? As in, 20 asteriods on screen works just fine like this, but 2,000 pushes the hardware over the edge, so if we really wanted a 2,000 asteroids style game we need to rethink real time saving. Sound about right?
@, man you’ve got some excellent stuff. You know, on a side note, I was also looking at GameInstance and getting all sorts of confused, then BAM you post something on the forum about it. Course I’m looking at it and realizing, “Wow, it’s that easy? Seriously?” That was like, perfect timing for my awkward dive back into UE4.
But anyway, I am looking at your binary save system, which is most excellent for sure. So thinking about the importance of reading and writing in the proper order. Does this method handle dynamic arrays? For a basic loadgame system, I figure that I will keep an array of AI, similar to the example above, call the array from the class and cycle through each AI enemy in the list, spawning each into the game world on each loop. Would the binary save system have difficulty here?