Akhos
Member
Just something that's been on my mind. In my fighting game project, the player has the ability to save a replay of the match they played. I take the necessary information (mostly player inputs I have saved in DS_Lists which I save as strings), put it into a buffer, and save the buffer. Loading replays just reads from the saved files. Simple.
What I'm wondering is if it's possible to have some kind of fail-safe, if the replay files get messed with somehow or corrupted in some way. Right now, if that happens and you try and read from it, you get an error message because it tried to read outside the buffer. On the PC platform you can just have the user delete the affected files, but if this were on console the user would be completely stuck if they ever tried to access the replays. Wondering if there was a way to detect if the buffer can't be read from properly and just delete the file.
I thought about using buffer_peek for that and triggering the fail-safe if buffer_peek returns 0, before going through all the normal buffer_reads to populate the necessary variables, but buffer_peek does not seem to work properly with the buffer_string type. So kinda stuck.
(From what I've read about 2.3's new error catching functions, I could have a fail-safe that way if I tried to read from a buffer and it fails, but I'm wondering if there's another way)
What I'm wondering is if it's possible to have some kind of fail-safe, if the replay files get messed with somehow or corrupted in some way. Right now, if that happens and you try and read from it, you get an error message because it tried to read outside the buffer. On the PC platform you can just have the user delete the affected files, but if this were on console the user would be completely stuck if they ever tried to access the replays. Wondering if there was a way to detect if the buffer can't be read from properly and just delete the file.
I thought about using buffer_peek for that and triggering the fail-safe if buffer_peek returns 0, before going through all the normal buffer_reads to populate the necessary variables, but buffer_peek does not seem to work properly with the buffer_string type. So kinda stuck.
(From what I've read about 2.3's new error catching functions, I could have a fail-safe that way if I tried to read from a buffer and it fails, but I'm wondering if there's another way)