-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Minesweeper cartridge to site #128
Conversation
✔️ Deploy Preview for wasm4 ready! 🔨 Explore the source changes: 3b8973a 🔍 Inspect the deploy log: https://app.netlify.com/sites/wasm4/deploys/6173f5ae084e560007a4e762 😎 Browse the preview: https://deploy-preview-128--wasm4.netlify.app |
Wow, amazing game! 💥 Nice use of mouse/touch controls! The code is really well organized and instructive, definitely one of the larger Rust projects to date. Automatically generating images from the build is interesting. How was your experience building this game? Anything we can improve for Rust or WASM-4 in general? |
Thanks! The hardest part was to figure out how to detect a simultaneous left and right click.
It is way over engineered :D
I started working on a different game before this (which turned out to be too complex, so I decided to work on something simpler for starters), and I kept forgetting updating my sprites, so I wrote that small library.
One thing I find lacking was the support for randomness. I also wonder if there are any ways to check the cartridge size. |
Another approach (used by real-world games on classic consoles) do things like counting the number of frames before the first button press to seed their RNG.
You should just be able to check the file size. Note that we don't currently enforce the 64 KB file size limit but it might be enforced in the future (likely with a mode to disable it during cart development). It looks like the minesweeper cart is pretty large, do you know where most of the space is coming from? |
This is not really my area of expertise, but would not that approach have quite low entropy?
There is no need to sugar coat it, that cartridge is straight gigantic :D I tried to experiment a bit, and it seems that even when building for release there are still large debug-related sections in the final executable.
Apparently, modern Rust versions should remove those sections automatically when So I used wasm-gc to remove those sections, and the size got down to 73 KiB.
I could remove that
It also looks like string formatting functions take quite a bit of space, there is probably room for improvement there. |
I figured out why the cartridge was so large. Using raw memory addresses seems to solve the problem, I opened a pull request with more details #138. |
This is a classic Minesweeper game.
Playable by mouse: left click to uncover a tile, right click to flag a tile, left+right click to uncover additional tiles.
Source at https://gitlab.com/claudiomattera/minesweeper