How do I get started on WASM Rust with this game engine?

How do I get started on WASM Rust with this game engine?

First, I recommend following this tutorial:

This will teach you the basics of using wasm. The same principles you learn there can be applied with Babylonjs. You basically use wasm for your calculations (updating positions of objects, etc), and Babylonjs for the rendering.

Also, the section called “Rendering to Canvas Directly from Memory” is very important if you have lots of data you need to pass across the wasm/javascript boundary. For example, if you have an array with 20,000 structs with a lot of properties, you don’t want to be passing that data back and forth across the boundary otherwise your fps will tank. Put it in memory, and let javascript read from the shared wasm memory.

4 Likes

I see this is a old post but I am adding a comment too it incase someone else runs into this.

I created a very simple quick starter template in git that I use for my Rust WASM projects.
https://github.com/caperaven/crs-rust-wasm-starter

It’s not babylonjs specific but it gets the rust boiler plate out of the way.