I know this is a common question among game developers, but could someone give me some advice on saving player progress?
I really have two problems with the information I’ve found so far. One, everything seems to recommend using JSON. I don’t understand JSON. I don’t understand how it differs from the file:write command. I don’t understand how it relates to lua files. I don’t understand any of it at the moment.
But never mind that for now. Let’s assume, just for laughs, I do someday understand how to use it. What I really don’t get is when I should use it. If you have a game that is a first-person adventure/puzzler, with lots of variables, mostly booleans, and a table for inventory, when exactly are you saving this data? Do I need to save any variable change or table addition the instant it updates? Won’t constant file writing slow down performance? And isn’t it a little redundant? You code smashedWindow = true, then you have to save smashedWindow = true again to a file? Can’t the system just assume that I want all variables saved?
I realize there is a lot I don’t understand here. And in that spirit, I’ll close on a really stupid question. Any app or game is saving its state constantly, yes? You exit, come back in and you’re back where you left off. Obviously, if you restart or clear the app from memory, it resets. Why can’t you just save that cached state to a file?
I feel like I’m missing some significant part of the concept here. Thanks for your help.