Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
typosaurus1218737dI don't think this is a big failure, it prevents you to build a whole is_changed functionality per setting
-
D-4got10-0111037d@retoor Depends on how you look at it.
Thing is, certification-wise, there are rules against such practices because this unnecessarily ages the hardware. -
D-4got10-0111037d@jestdotty Losing your storage certainly sucks.
With SSDs, you should be able to check their health using programs such as CrystalDiskInfo or something similar.
SD Cards && flash drives, on the other hand, just die w/o warning.
AFAIR they switch to read-only state just before dying, so you can still recover the data, but still. -
lorentz1512637dOkay but if the optimization is specifically about avoiding writes, I'd just hold onto the serialized data and avoid writing back to the file if the strings are identical.
This type of change tracking either comes for free with your reactive UI framework or isn't worth building on general. I'd only ever consider manually adding it to inputs if there's a single specific kind of input that falsely triggers a change event very often. -
D-4got10-0111037d@lorentz There are many approaches to this.
Yours sounds good, too.
You could even get away w/ a simple solution of committing to file when exiting the Settings Menu regardless of whether or not an actual change has been made.
But not this... not saving to file w/ each update of some value.
Related Rants
I've recently learned how committing of the Save Data to file works in my project.
The file is updated w/ _each change_ made to the settings.
Worse yet - the file is updated even when _no actual change_ is made due to the setting already being at its highest / lowest value possible.
/*
e.g. 5 is maximum sound volume.
- You try increasing the sound volume.
- Setting can't get any higher, so remains unchanged.
- *Update the Save Data*.
*/
What kind of abusive masochist would do that?
// Yes... there's always blame.
rant
gamedev
save data