FirenX / emu-coop

Lua scripts for turning 1-player games into 2-player games using inventory sharing.
9 stars 3 forks source link

Odd resync issue #3

Closed lenophis closed 6 years ago

lenophis commented 6 years ago

I don't know if this should be classified as internet, IRC, or the script as the issue. Last night (Feb 25) at around 11:45 pm the script lost connection to Mistress Saeko. She kept getting an error that the connection died, similar to this: Error: Connection died: PRIVMSG lenoguy :#{value=48,addr=8319853}

We followed standard procedure to get restarted, and when we reconnected it would attempt to resync (restart after crash). This is the series of messages she would receive: Playing Link to the Past Randomizer Connecting to server... Logging in to server... script returned but is still running registered functions Searching for partner... Connecting to partner... Connected to partner Syncing... Error: Connection died: PRIVMSG lenoguy :#{value=128,addr=8318997} Error: Connection died: PRIVMSG lenoguy :#{value=31,addr=8318996} Error: Connection died: PRIVMSG lenoguy :#{value=15,addr=8318980} Error: Connection died: PRIVMSG lenoguy :#{value=3,addr=8319945} Error: Connection died: PRIVMSG lenoguy :#{value=25,addr=8319863} Error: Connection died: PRIVMSG lenoguy :#{value=4,addr=8319860} Error: Connection died: PRIVMSG lenoguy :#{value=20,addr=8319857} Error: Connection died: PRIVMSG lenoguy :#{value=25,addr=8319856} Error: Connection died: PRIVMSG lenoguy :#{value=104,addr=8319852} Error: Connection died: PRIVMSG lenoguy :#{value=242,addr=8319849} Error: Connection died: PRIVMSG lenoguy :#{value=144,addr=8319848} ... Syncing...done!

We tried both the default server you have put in, and SRL's IRC server. Both gave the same result. Both of our internet connections never had any kind of interruptions, and I didn't lose a single frame when I was streaming my end. She never lost connection to anything during the game, as well.

I guess the real issue here is why the game would not let us resync. I don't know if it's because of the new stuff added from the original script, or if the resyncing is just faulty in general.

As a side note, there was an issue with death syncing prior to the connection dropping. Saeko had died, and I forgot what to. I had 1/2 a heart left and it did not kill me. A couple of minutes later, I would die twice in succession so it seemed like it got synced back up. However, sometime after that it lost sync when she picked up the Master Sword, while I still had Fighter's Sword.

FirenX commented 6 years ago

Thanks for the bug report.

Some things I'd like to know are: Did both of you use the first save slot all the time? Did you use entirely new names for IRC when reconnecting? Were damage share and death share both toggled? Did the resync work out eventually? Did you wait for it to resync after choosing your starting locations (e.g. Link's House)?

lenophis commented 6 years ago

"Did both of you use the first save slot all the time?" Yes, we never diverted from slot 1.

"Did you use entirely new names for IRC when reconnecting?" No, we used the same names for all connection attempts, successful for otherwise.

"Were damage share and death share both toggled?" Yes, they were both toggled on for both of us.

FirenX commented 6 years ago

Ok, based on that I have an idea what might have happened.

When Death Share and Damage Share are both activated, the dying player sends "set HP to 0" as well as "I died". That by itself causes weird behaviour. I will fix that by ignoring the Death Share option when Damage Share is toggled.

I assume the IRC servers' flood protection got triggered. After that, everything was sent delayed, that causes the "Connection Died" statements because server answers aren't sent. The flood protection definitely got triggered during resync. We share more RAM addresses than ever anticipated by the original dev; that's why resync is not working properly atm. I won't add a general flood protection prevention -that might cause more issues than it solves- but I will try to slow down resync enough to exclude IRC flood protection from being the cause of failing resyncs.