450 points by gabriel_engineer 6 months ago flag hide 13 comments
john_doe 6 months ago next
Excited to see this post! I've been curious about building multiplayer games with Rust and WebAssembly.
sean_coder 6 months ago next
Same here! Any specific resources or libraries you'd recommend for a beginner, john_doe?
jane_programmer 6 months ago next
I've heard great things about ggez for 2D games! I'd also recommend looking into the <a href="https://specs.amethyst.rs/">specs</a> ECS library, which works well with ggez. It's made a huge difference in my game dev projects.
newbie_hask 6 months ago next
Yes, I used <a href="https://docs.amethyst.rs/stable/network/">Amethyst's networking</a> stack, which is built on top of those libraries. Worked perfectly for my real-time multiplayer needs!
random_nerd 6 months ago prev next
I used <a href="https://ggez.rs/">ggez</a> for the game engine and <a href="https://github.com/rustwasm/wasm-bindgen">wasm-bindgen</a> for creating the bridge between Rust and WebAssembly. It was a great learning experience!
shahrazad_code 6 months ago next
Interesting, thanks for the feedback! I was worried about the compatibility between WebAssembly and Rust, but I guess that's not much of an issue with the right tools.
rostam_hacks 6 months ago prev next
@john_doe Have you considered using a networking library like <a href="https://valestyne.github.io/unstable/">unstable</a> or <a href="https://www.stew.si/2019/01/10/0-1-networking/">the one from the Rust game dev handbook</a>? They're designed for multiplayer games and can help simplify the process.
eric_bytecode 6 months ago prev next
Big fan of Rust and WebAssembly for game development. Make sure to optimize for low latency and smooth experience, especially for real-time multiplayer.
cool_codewiz 6 months ago next
To reduce latency, use a combination of client-side prediction and server reconciliation. It's a common technique in real-time multiplayer games.
bytecode_bud 6 months ago next
Thanks, @cool_codewiz! Do you have any resources you'd recommend on client-side prediction and server reconciliation? It's a fascinating approach!
cool_codewiz 6 months ago next
Sure! I recommend checking out <a href="https://www.gabrielgambetta.com/fpm/#latencycompensation">this resource</a> from Gabriel Gambetta. They explain the technique in detail and in the context of game development.
___skirl 6 months ago prev next
To minimize the risk of cheating in real-time multiplayer, it's critical to ensure the server is the authoritative source of truth and to verify all client inputs before accepting them. This way, you can prevent players from manipulating game states.
gamerx1029 6 months ago prev next
Using Rust for game development is a great choice, especially because of its low-level control, safety guarantees, and performance benefits. WebAssembly is the icing on the cake! Have fun building!