Well yes, my explanation has been rather reductionist.
When I say “detect when a crash will happen”, I’m more accurately saying to trigger the code when a certain server load is reached. However, this cannot occur too late into a possible crash, since the server, well, crashes. This could be manually timed, but would rather be better yet adjusted by machine learning after it watches the server crash naturally numerous times, to calculate when last code could be effectively run during high loads before reading data from the server becomes impossible to do. But all of this is moot because something you said in your last reply changed everything.
I am a junior developer at the moment, and I also do not claim to know a fraction of the game’s inner workings beyond what is publicly leaked, version of the game years old. So imagine my immense face palm when you mentioned continuous saving… this changes everything! Instead of having to write a timing mechanism for the snapshot, catalog, whatever vocabulary I’ve used in the past, we can just run continuous data entry upon high server loads. And I mean high, during rubber banding kind of latency issues. And then you simply compare 80, 40, etc. ms before the crash and after the crash. If the server recovers, dump the memory. If a crash occurs, write the data to each user’s entry in the database, and discard that after they reconnect.
I do however see an issue with the proposed change. Make the requirement to start the code (and end it), at a too high of a thresh hold of server lag, and it wouldn’t help a damn thing since the intervals between continuous snapshots would be too high to account for human reaction time. Make the requirement too low, and you’re wasting server resources, granted a continuous system would tear through kilobytes like fire.
Actually, no, I’m wrong again, and I’m happily wrong! From what I can tell, the server checks are about every 1 second. I can’t give an average just based on a small sample size, but I know the client checks are nearly every 100 ms. Wait… I wish I had an environment to test this on, but in theory, in a server crash scenario, player data is stored by the server, say when the server tick rates jumps up to 1 tick per x seconds, lets say 3. From the moment the server is unable to run checks on inventory to the crash, within a maximum y, that information is ignored.
In a practical situation, x would be somewhere within 3 - 5, where as code can still be executed, but the tick rate doesn’t normally reach. When y hits 10+ (as a theoretical example), the server ignores all vital client information about inventory until a. the servers crash, and then the last snapshot taken is compared, or b. the servers return to a healthy tick rate below the value of y, and any inventory data the client is rolled back to before the value of y was reached.
In practice, y would be set to a number where realm becomes unplayable, so that players cannot claim that they lost white bags, etc. Mind you, when server lag is occuring, such as a tick every ten seconds, the game is effectively running ten times slower. I can’t give you the y value when enemies and players start moving off screen, perhaps y, or x for that matter should be increased or decreased, as were used for examples purely, but at a certain point no player can do much of anything during server lag. Items won’t drop, SB is ignored, requests to use abilities, nexus, death, etc., are all ignored, until the server either crashes or “snaps” back.
Sorry if I’m repeating myself, but:
- If it crashes, the last inventory check is cross referenced to the next reconnection.
- If it lags but then “snaps back”, all client data during the miscommunication is ignored and reset back to the moment the lag begun. Thanks to code implemented by Deca in a previous QoL update, players who experience such latency issues (server side only) are invulnerable until they come to. In such a case as last year’s infamous ice cave deaths, this would give a grace period of perhaps a second or so to nexus after the snap.