Rust wasm game approach

Hi, I'm considering writing a hearts/spades clone and compile to wasm to learn more about the wasm/web side of things.

Googling around I'm confused about what is currently the best approach? using a Rust front-end framework, using web-sys, some game framework, or something entirely different?

Thanks! :blush:

How do you want to draw the game?

  • Html?
  • 2dCanvas?
  • WebGL?

I do know that some game engines/frameworks have working wasm support via WebGL.

If you want to learn about Wasm itself, I would not recommend to use them, as they aim at providing a "just works" solution. Either it works and you don't learn anything, or it will be difficult to debug without knowing the basics.

web-sys is a common building block. Everything uses it.

1 Like

I don't know enough about these to have any preference, whats normally used?

I saw this, https://github.com/mkeeter/pont , is this a good approach?

The approach depends on what you want to learn. Your first task would be to read into the possible approaches and pick one.
There is no "normally used" as all work great for different goals.

To learn about the wasm side of things I'd probably pick a rusty front end. Yew or seed spring to mind :slight_smile:

If you are familiar with js and the web side of things it might be fairly easy to rig up a html canvas to draw to.

This should be useful: https://rustwasm.github.io/book/

There's a game of life tutorial but you could make a hearts clone with a similar approach, I assume!

I had a go making pong run in the browser using a rust game engine called macroquad but it didn't teach me anything about wasm... It just worked! :smiley:

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.