wasm-snake
wasm2lua
wasm-snake | wasm2lua | |
---|---|---|
2 | 1 | |
7 | 177 | |
- | - | |
7.7 | 3.8 | |
2 months ago | over 2 years ago | |
WebAssembly | WebAssembly | |
- | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
wasm-snake
-
Classic Snake in Direct WebAssembly Text
All of the game graphics, state and logic are written in WebAssembly Text. The host environment (Javascript) is responsible for:
Game tick loop
User input
Providing characters "0123456789GAMEOVER" byte data on game startup
Blitting the pixel buffer to the display with WebGL2
The game uses 3 virtual pages of memory (64kb each) for a total of 192kb. Within those exist the pixel buffer contents, the characters data and snake positions. For more detailed breakdown you can check src/snake.wat.
The memory is shared between WASM and JS. On each game tick, the pixel buffer region of the memory is transferred to a WebGL2 texture, uploaded to the GPU and blitted to the screen.
For more info you can refer to the repo - https://github.com/gnikoloff/wasm-snake
wasm2lua
-
[ComputerCraft] Is it possible to run Doom on CC?
You could try converting WASM to Lua using something like wasm2lua but a lot of work would still be required to get the display/sound/input working inside CC.
What are some alternatives?
assemblyscript - A TypeScript-like language for WebAssembly.
raw-wasm - Raw WebAssembly demos
wazero - wazero: the zero dependency WebAssembly runtime for Go developers
Wasynth - WebAssembly to Lua translation library and tool
VectorVisor - VectorVisor is a vectorizing binary translator for GPUs, designed to make it easy to run many copies of a single-threaded WebAssembly program in parallel using GPUs
wasker - Wasm compiler for running Wasm on your favorite kernel