Hello, i been working on a Singleplayer Puzzle game for quite some time now, and the issue thats been bothering me for the entire time was, How would i handle saving players progress?
Can someone explain the Theory behind it for me? I dont want ready Scripts i just want the Theory and maybe some Pseudo code examples.
For example how do those tycoon games like Lumber Tycoon handle saving players bases and all the different items? Are there any limitations to what types and sizes of data we can save?
Datastores do have limits on them, so realistically you want to save as minimal data as you can.
If your game is something like Portal, heres what you’d want to save:
The current level the player is in (Either with an Int or a String)
The CFrame of the player
The CFrame (Or just Position) of any movable objects, or objects the player can create (example: Portals) only within the players current level
(So for example, don’t save the position of objects that are 3 levels back)
From there, you can just load in the level and position everything as needed.
I’d imagine each items name (or an assigned number tag) is saved along with its rotation offset and position offset from the center of the players plot.
By saving the offsets and not the raw position value, its just easier to write code to load in the data, especially when you’re factoring in different plot locations and orientations.
Its as simple as this:
Get the position and rotation of the center of the plot
Apply the 2 offset values to the object and put it wherever in workspace.
However, if you aren’t managing several plots and different locations, you could just as easily save the exact position of objects and not have to do the extra math to position them.