Game freezes during window move. #165

Open
opened 2025-04-30 22:18:35 +02:00 by utkumaden · 0 comments
utkumaden commented 2025-04-30 22:18:35 +02:00 (Migrated from github.com)

The game window freezes during window move due to a quirk of the windows windowing system. Although not an issue for single player games, this can cause a disconnect from a netgame through a desync or server time out.

From my experience implementing these sorts of applications: When a window is being resized or moved, the window only receives the events WM_MOVE and WM_RESIZE. Even though the client uses SDL2, the call SDL2_PollEvents infinitely loops because the function is internally a thin wrapper over the Win32 calls GetMessage() TranslateMessage() and DispatchMessage. This in turn causes the event loop to never break.

The simplest way to fix this is to dispatch a game update and draw when the event SDL_WINDOWEVENT_MOVED, SDL_WINDOWEVENT_RESIZED or SDL_WINDOWEVENT_SIZE_CHANGED. Either that, or break when one of these events are fired after processing event handlers. I believe the current version of Saturn lacks this workaround.

The game window freezes during window move due to a quirk of the windows windowing system. Although not an issue for single player games, this can cause a disconnect from a netgame through a desync or server time out. From my experience implementing these sorts of applications: When a window is being resized or moved, the window only receives the events `WM_MOVE` and `WM_RESIZE`. Even though the client uses SDL2, the call SDL2_PollEvents infinitely loops because the function is internally a thin wrapper over the Win32 calls `GetMessage()` `TranslateMessage()` and `DispatchMessage`. This in turn causes the event loop to never break. The simplest way to fix this is to dispatch a game update and draw when the event `SDL_WINDOWEVENT_MOVED`, `SDL_WINDOWEVENT_RESIZED` or `SDL_WINDOWEVENT_SIZE_CHANGED`. Either that, or break when one of these events are fired after processing event handlers. I believe the current version of Saturn lacks this workaround.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: saturn/SRB2Kart-Saturn#165