Skip to content

intgr/uqm-wasm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Star Control 2: The Ur-Quan Masters port to WebAssembly

Build status

This is a fork of Star Control 2: The Ur-Quan Masters to WebAssembly for running in web browsers, using the Emscripten toolchain.

Save games and preferences are persisted on client-side using browser IndexedDB API (Emscripten IDBFS). Persistent storage will be requested when you save a game or change preferences. If persistent storage is unavailable, storage is on a best-effort basis; a warning message will be shown in this case. On Chrome and Safari, the website needs to be bookmarked enable persistent storage. Read more about persistence

Building in Docker

The easiest way to build and run UQM with Emscripten is via Docker. In the sc2 directory, Simply run:

docker build --tag=uqm-wasm -f wasm/Dockerfile .
docker run -it --rm -p9999:9999 uqm-wasm

Then open in your web browser: http://localhost:9999/uqm-debug.html

Building locally

Run the configuration menu:

cd sc2
emconfigure ./build.sh uqm config

The first time you run this, it takes a few minutes as Emscripten downloads and builds ports of required libraries.

Nothing special needs to be done there, everything should be auto-detected. Just for reference, here is a tested working configuration:

 1. Type of build                        Debugging build
 2. Graphics Engine                      SDL2 with modern graphics support
 3. Sound backend                        Include OpenAL support (experimental)
 4. Tracker music support                Included libmikmod
 5. Ogg Vorbis codec                     Xiph libogg + libvorbis
 6. Network Supermelee support           disabled
 7. Joystick support                     enabled
 8. Supported file i/o methods           Direct & .zip file i/o
 9. Graphics/Sound optimizations         Platform acceleration (asm, etc.)
10. Thread library                       Pthread thread library

Press to finish configuration and build it:

./build.sh uqm -j16

You should have an uqm.html file as output.

Run it

You can use the included nginx configuration to serve up files for the web browser:

nginx -p $PWD -c wasm/nginx.conf

Then open in your web browser: http://localhost:9999/uqm-debug.html

Known issues

  • Audio: Firefox doesn't play some samples (e.g. menu ping), but works in Chrome
  • Audio: MixSDL does not work (OpenAL works)
  • Threading: SDL threading does not work (pthreads work)

Troubleshooting

You can clean and force a re-build of emscripten-ports with:

emcc --clear-cache
emcc -c -E - -s USE_ZLIB=1 -s USE_LIBPNG=1 -s USE_VORBIS=1 -s USE_SDL=2 -s ASYNCIFY -pthread </dev/null

Credits

  • Thanks to Fred Ford, Paul Reiche III and Toys for Bob for releasing the game as open source.
  • Thanks to The Ur-Quan Masters port team for their work on the open source project.
  • Thanks to Michael Martin for continuing to maintain the game for the last several years.
  • WebAssembly port was done by Marti Raudsepp.
  • Detailed credits

About

WebAssembly port of Star Control 2: Ur-Quan Masters for web browsers using Emscripten (forked from https://sourceforge.net/p/sc2/uqm/ci/main/tree/)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •