o
odinpkg.dev
packages / library / odin-raylib-web-pong

odin-raylib-web-pong

230e988library

Pong made with Odin and Raylib, running in the browser

No license · updated 9 months ago

An implementation of Pong written in Odin using Raylib. Running natively on desktop and compiled to WASM to run in the browser.

Based on the odin-raylib-web project template by Karl Zylinski.

This project was meant to try out the feasability of making a graphical application for the web using WASM with minimal setup. It also tests how usable Odin and Raylib are for a simple game.

Local setup

Requirements

Desktop builds

  • For debug builds run build.bat debug
  • For release builds run build.bat web

Web build

  1. Point EMSCRIPTEN_SDK_DIR in build.bat to where you installed emscripten.
  2. Run build.bat web.
  3. Web game is in the build/web folder.

Note

On Linux and macOS, build.bat must be invoked as bash build.bat.

Warning

You might not be able to run build/web/index.html directly due to "CORS policy" javascript errors. You can work around that by running a small server, i.e.:

  • npx http-server ./build/web -c-1
  • python -m http.server --directory ./build/web