Post AUHq9sJLLWixMnVCJU by clarfonthey@toot.cat
 (DIR) More posts by clarfonthey@toot.cat
 (DIR) Post #AUHq9sJLLWixMnVCJU by clarfonthey@toot.cat
       2023-04-03T07:07:20Z
       
       0 likes, 1 repeats
       
       one thing that factorio does that seems obvious that more games should do is offer an "async save" mode that doesn't block the game during savingin some games this can be accomplished by implementing a complicated system where you can buffer the changes made between the start of the save and the end of the save, so that you don't save an inconsistent state of the gamebut really, the way factorio does this is by forking the process and stopping the game on the forked version, but not the actual running instanceand as factorio explicitly states, this functionality only works on MacOS and Linux, since Windows does not have a fork system call. this is likely why most games don't even bother implementing this kind of system, since game devs still have Windows Brain despite the larger push to create Linux-native gamesthe ability to fork-save is not only easy to implement (save a few minor synchronisation details between the main process and the saving one, to let the game know the progress of the save)but also, this is very efficient, too! in the OS itself, the memory pages with the original process data are labelled copy-on-write, so effectively the OS is keeping track of what's changing and what isn't for you, at the memory page level. instead of a bunch of complicated logic to buffer those changes, you can just let the native mechanisms that were there to begin with, do that for younow, I am probably still overselling this implementation since Factorio's async save feature was long listed as experimental during early access, since I believe they had to work out a lot of issues to ensure that save files weren't corrupted, but my guess is that this is because the game wasn't architected this way to start out, and because there was some code that was already trying to save to the file outside of the usual save routineanyway… this is just another indication that maybe we're actually missing out on a lot by choosing to continue making games Windows-exclusive, and/or "Proton is good so let's not make native games because I don't wanna deal with it"#GameDev #Factorio #Linux