diasurgical / devilutionX

Diablo build for modern operating systems
Other
8.03k stars 790 forks source link

Black Screen Freeze When Joining a Game While a Player Changes Levels #729

Open NiteKat opened 4 years ago

NiteKat commented 4 years ago

Describe Client joining an existing game while the host of existing game transitions from one level to another, the joining client gets frozen with a black screen (town music will still play), while the host client will remain unaffected.

To Reproduce Steps to reproduce the behavior:

  1. Open one client, host a multiplayer game.
  2. Move the player close to a trigger, such as the Down to Dungeon one in town.
  3. Open a second client. Get it to the point where you put the password in to join the first client's game.
  4. Enter the password, but do not hit enter yet.
  5. On the host client, click the trigger to initiate the transition.
  6. Immediately after clicking in the host client, switch to the joining client, and hit enter to initiate the joining process.
  7. If timed right, the host should load the next level, and the joining client should get stuck with a black screen while playing the town music. This may take a few tries to get the timing right.

Expected behavior The host should load the new level, and the joining client should load town and successfully join the game.

Screenshots bug This screenshot shows how it should look when the joining client gets stuck.

Additional context It seems to be stuck looping in in msg_pre_packet(). The joining client is trying to process a CMD_NEWLVL command from pnum 0, but ParseCmd is stuck returning 0 on line 182 because on line 985 sgwPackPlrOffsetTbl[pnum] != 0 for pnum 0 (it was value 976 in my test). This forces ParseCmd to return 0, so spaceLeft is never modified, therefore it never breaks out of while (spaceLeft != pkt->dwSpaceLeft), meaning it never moves onto the next packet (or does anything with the CMD_NEWLVL).

AJenbo commented 4 years ago

Sounds like this bug would also be in the original game, has that been tested?

NiteKat commented 4 years ago

I just tried to reproduce in the GOG version, and was unable to do so. That doesn't completely rule out it being in the original game.

I also tried to reproduce in DevilutionX again, and wasn't able to do so. This makes me think this is a frame perfect bug, if not nearly so.

AJenbo commented 4 years ago

Thanks for testing it