{"id":13567163,"url":"https://github.com/lukewilliamboswell/roc-wasm4","last_synced_at":"2025-04-04T01:31:07.289Z","repository":{"id":208399373,"uuid":"721531735","full_name":"lukewilliamboswell/roc-wasm4","owner":"lukewilliamboswell","description":"Build wasm4 games using Roc","archived":false,"fork":false,"pushed_at":"2024-10-23T02:29:39.000Z","size":957,"stargazers_count":49,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T12:18:23.743Z","etag":null,"topics":["roc-lang","wasm4"],"latest_commit_sha":null,"homepage":"https://lukewilliamboswell.github.io/roc-wasm4/","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"upl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukewilliamboswell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-21T08:59:20.000Z","updated_at":"2025-02-25T02:56:46.000Z","dependencies_parsed_at":"2023-11-21T10:26:40.458Z","dependency_job_id":"99feb02a-603f-4bfe-b698-6ed8576b7a91","html_url":"https://github.com/lukewilliamboswell/roc-wasm4","commit_stats":null,"previous_names":["lukewilliamboswell/roc-wasm4-games","lukewilliamboswell/roc-wasm4"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewilliamboswell%2Froc-wasm4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewilliamboswell%2Froc-wasm4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewilliamboswell%2Froc-wasm4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewilliamboswell%2Froc-wasm4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukewilliamboswell","download_url":"https://codeload.github.com/lukewilliamboswell/roc-wasm4/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107816,"owners_count":20884793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["roc-lang","wasm4"],"created_at":"2024-08-01T13:02:25.099Z","updated_at":"2025-04-04T01:31:04.997Z","avatar_url":"https://github.com/lukewilliamboswell.png","language":"Zig","funding_links":[],"categories":["Roc Platforms","Roc Platforms 🏢","Zig","Projects"],"sub_categories":[],"readme":"# roc-wasm4\n\nRoc platform for the [wasm4](https://wasm4.org) game engine 🎮🕹️👾\n\nThe intent for this platform is to have some fun, learn more about Roc and platform development, and contribute something for others to enjoy.\n\n### Setup\n\n1. Clone this repository.\n\n2. Make sure you have the following in your `PATH` environment variable\n- [roc](https://www.roc-lang.org/install),\n- [zig](https://ziglang.org/download/) version **0.11.0**\n- [w4](https://wasm4.org)\n\n### Run\n\nFor the *web runtime* use `zig build run`\n\nFor the *native runtime* use `zig build run-native` (Note: native can often be much slower than web especially for non-optimized builds)\n\nThe `build.zig` script reports any warnings or errors for the app using `roc check`, it then builds an object file using `roc build --target=wasm32 --no-link` and links this with the host to produce the final `.wasm` game cartridge.\n\n### Snake Demo\n\n- Unix/Macos `zig build -Dapp=examples/snake.roc run`\n- Windows `zig build -Dapp=\".\\examples\\snake.roc\" run`\n\n![snake demo](/examples/snake.gif)\n\n### Rocci-Bird Demo\n\nThank you Brendan Hansknecht and Luke DeVault (art) for this demo.\n\n[Link to play online](https://bren077s.itch.io/rocci-bird)\n\n- Unix/Macos `zig build -Dapp=examples/rocci-bird.roc run`\n- Windows `zig build -Dapp=\".\\examples\\rocci-bird.roc\" run`\n\n![rocci-bird demo](/examples/rocci-bird.gif)\n\n### Sound Demo\n\n- Unix/Macos `zig build -Dapp=examples/sound.roc run`\n- Windows `zig build -Dapp=\".\\examples\\sound.roc\" run`\n\n![sound demo](/examples/sound.gif)\n\n### Drum Roll\n\nThank you Isaac Van Doren for this demo.\n\n[Link to source code](https://github.com/isaacvando/roc-drum-machine), and [play online](https://isaacvando.github.io/roc-drum-machine/)\n\n![drum roll](/examples/drum-roll.gif)\n\n### Documentation\n\n📖 Platform docs hosted at [lukewilliamboswell.github.io/roc-wasm4/](https://lukewilliamboswell.github.io/roc-wasm4/)\n\nTo generate locally use `roc docs platform/main.roc`, and then use a file server `simple-http-server generated-docs/`.\n\n### Hot Reloading\n\nWell it isn't perfect, hot reloading can be quite nice when developing a game. For this, I suggest using the [entr](https://github.com/eradman/entr) command line tool.\n\nIn one terminal run the build command: `find . -name \"*.roc\" -o -name \"*.zig\" | entr -ccr zig build -Dapp=\u003capp\u003e`.\n\nIn another terminal run wasm4: `w4 run zig-out/lib/cart.wasm --hot`.\n\nIf the hot reloading breaks (which it often does when changing the data layout or state), simply press `R` to reload the cart.\n\n### Distribution\n\nTo release a game, first build it with optimizations by adding `-Doptimize=ReleaseSmall`.\nThen bundle it [like any other wasm4 game](https://wasm4.org/docs/guides/distribution/) using the generated cartidge located in `zig-out/lib/cart.wasm`.\nIf your cartidge is too large, you can try lowering the dynamic memory space with `-Dmem-size=\u003csize\u003e`. The default is `40960` bytes.\n\nFor example, a web release can be built with:\n```shell\nw4 bundle zig-out/lib/cart.wasm --title \"My Game\" --html my-game.html\n```\n\nFor windows/mac/linux, a bundling command could look like:\n```shell\nw4 bundle zig-out/lib/cart.wasm --title \"My Game\" \\\n    --windows my-game-windows.exe \\\n    --mac my-game-mac \\\n    --linux my-game-linux\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewilliamboswell%2Froc-wasm4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukewilliamboswell%2Froc-wasm4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewilliamboswell%2Froc-wasm4/lists"}