Repository navigation
Added WebAssembly fixes, the game can run now in any internet browser - #80
Open
BloodSharp-HvH wants to merge 5 commits into
Open
BloodSharp-HvH wants to merge 5 commits into
BloodSharp-HvH wants to merge 5 commits into
Conversation
…toolchain is emscripten
- Add support for ogg and mod to SDL2 mixer library format - Add 'ASYNCIFY' flag to enable 'emscripten_sleep' function support - Add 'webassembly-minimal-page-template.html' shell html file
sergiou87
reviewed
Oct 13, 2026
sergiou87
left a comment
Owner
There was a problem hiding this comment.
Muchas gracias! A priori los cambios tienen buena pinta, pero tengo una duda sobre los waitTime que has introducido y si se pueden reemplazar por waitTime(0)
| do | ||
| { | ||
| int9handler(1); | ||
| waitTime(1); |
Owner
There was a problem hiding this comment.
Por curiosidad: funciona igual si haces waitTime(0)?
There was a problem hiding this comment.
🟡 Changes recommended
Browser-yield gaps and per-object sleeps leave input responsiveness and gameplay timing regressions unresolved.
6 open issues
Yield during normal gameplay before quit countdown checks · New Yield before input polling loop continues · New Remove per-tile waits from moving object updates · New Remove waits while probing level-set filenames · New Remove per-entry waits from rankings sorting · New Allow browser pinch zoom for accessibility · New
What changed in this PR
Updates the SDL-based game’s WebAssembly support to improve browser execution, rendering, and input responsiveness.
Changes:
- Uses Emscripten-compatible waits and adds yielding calls throughout gameplay and menu loops.
- Selects software rendering for WebAssembly builds.
- Adds a full-page HTML canvas shell and enables Asyncify and SDL_mixer formats.
| File | Description |
|---|---|
| wasm/webassembly-minimal-page-template.html | Adds the browser canvas host and runtime logging. |
| wasm/Makefile | Enables Asyncify, mixer formats, and the custom HTML shell. |
| src/supaplex.c | Adds waits to gameplay, input, and menu code paths. |
| src/sdl2/video.c | Selects software rendering under Emscripten. |
| src/sdl_common/system.c | Uses emscripten_sleep for WebAssembly waits while retaining native delays. |
Review effort: Max
| { | ||
| break; | ||
| } | ||
| waitTime(1); |
| newPlayerName[gNewPlayerNameLength] = character; // mov [bx+si], al | ||
| gNewPlayerNameLength++; | ||
| drawTextWithChars6FontWithOpaqueBackgroundIfPossible(232, 127, 6, newPlayerName); | ||
| waitTime(1); |
| } | ||
| } | ||
|
|
||
| waitTime(1); |
Comment on lines
+7553
to
7554
| waitTime(1); | ||
| } while (file == NULL); |
Comment on lines
+7951
to
7952
| waitTime(1); | ||
| } while (numberOfChanges > 0); |
| <html lang="en-us"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


¡Hola buen día Sergio!
Este pull request corrige problemas para compilar y ejecutar el juego con webassembly.
SDL_Delaycon la funciónemscripten_sleepsi la toolchain es emscripten, la cual es equivalente a un delay común y corriente pero además permite al navegador recuperar el control en los casos de los bucles que congelan el videojuego en un loop infinitowaitTimeen prácticamente casi todos loswhileydo-whilela cual permite al navegador recuperar el control temporalmente en los casos que se necesiten verificar cosas como estado de los controles de entrada. Probablemente algunos estén de más, pero por las dudas también pueden servir...emscripten_sleep) y el flag del archivo shell minimalista html.Si se quiere probar el juego en WebAssembly lo subí a mi página de github pages para una pequeña demostración:
https://bloodsharp-hvh.github.io/games/supaplex/
Nota: El enlace de arriba también tiene un parche adicional para desbloquear todos los niveles al registrar un usuario porque quería probar todos los niveles en Wasm, este Pull Request no incluye dicho parche específico para emscripten, salvo que quieras que se lo agregue.
Saludos cordiales.
Agustín.
B#