gudan garam
Advanced OT User
Hello guys, so I started looking into Anti Rollback systems but they all seem really heavy approaches, meaning, for example, that they save every player every 30 seconds, or they call a save to a player everytime he does some action that is worthy of being saved, i.e. moving an item, trading, etc...
So, I was wondering if there is a way to save the gamestate when something goes wrong (crash happens)?
I've read something about doing it in destructors, because apparently (some ppl said this is not true, and I couldn't do it) the destructor is called when a segmentation fault or something like that happens. I've tested it and ofc, no good result.
Also some people talked about SIGNALS but I couldn't find a good enough read to succeed on this. I can't make a function be called when a signal is sent because it expects the function to receive an x parameter that I don't know of.
This didn't work because handler must have a specific parameter as I said above.
So if you found a good way to approach this issue, how did you do it? Not restraining it to saving the gamestate if the engine crashes, I'd also like to know if you could optmize the save in certain areas that it is not an issue to use it all the time anymore.
So, I was wondering if there is a way to save the gamestate when something goes wrong (crash happens)?
I've read something about doing it in destructors, because apparently (some ppl said this is not true, and I couldn't do it) the destructor is called when a segmentation fault or something like that happens. I've tested it and ofc, no good result.
Also some people talked about SIGNALS but I couldn't find a good enough read to succeed on this. I can't make a function be called when a signal is sent because it expects the function to receive an x parameter that I don't know of.
C++:
signal(SIGSEGV, handler)
So if you found a good way to approach this issue, how did you do it? Not restraining it to saving the gamestate if the engine crashes, I'd also like to know if you could optmize the save in certain areas that it is not an issue to use it all the time anymore.
Last edited: