Ancestors

Written by Ben on 2024-08-20 at 10:07

Writing unit tests can be extremely dull at times, but man... seeing all those green OKs is incredibly satisfying :blobcathappy:

It's actual evidence that I'm at least a somewhat competent programmer... until someone comes along and tries something that I haven't thought of yet :blobcatdunno:

[#]RustLang #GameDev #Server

=> View attached media

=> More informations about this toot | More toots from drwhut@fosstodon.org

Toot

Written by Jan Ekholm on 2024-08-20 at 11:29

@drwhut I see you're doing a game server with Rust. I'd like to do that myself too, but I'm still learning the basics of Rust. Can you share a bit about the tech stack you use?

=> More informations about this toot | More toots from chakie@toot.community

Descendants

Written by Ben on 2024-08-20 at 18:03

@chakie The main library I'm using is https://tokio.rs, which is an out-of-the-box async framework, so the server can use as many threads as there are cores without making a thread for each request.

On top of that is tokio_tungstenite, which is used for WebSocket connections (which my game uses to talk to the lobby server).

If you haven't done async programming in the past, it can be a bit mind-bending, but once you get used to how data is sent between tasks, it's great!

=> More informations about this toot | More toots from drwhut@fosstodon.org

Written by Jan Ekholm on 2024-08-20 at 18:13

@drwhut Seems Tokio is the de facto standard in Rust? I’ve done various server stuff in the past, so it’s mostly familiar tech in a new language.

Have you been happy with Rust for this use case? What kind of game are you doing? Twitchy or slow?

=> More informations about this toot | More toots from chakie@toot.community

Written by Ben on 2024-08-20 at 18:20

@chakie Seems like it, yeah. It and a couple of other libraries are built on top of the futures crate, but from what I can tell Tokio is the most well-known.

My use case isn't very demanding, it's a WebRTC signalling server for setting up peer-to-peer connections. But for the safety alone, Rust has been amazing for my use case, since by design Rust forces you to account for every error that could happen.

It's definitely slower to write in for sure, but worth it in the long run.

=> More informations about this toot | More toots from drwhut@fosstodon.org

Written by Jan Ekholm on 2024-08-23 at 10:11

@drwhut I expect to be pretty frustrated with Rust when I start working on something similar. :) At least initially.

=> More informations about this toot | More toots from chakie@toot.community

Written by Ben on 2024-08-23 at 13:18

@chakie Yeah, that's the trade-off when it comes to using Rust at the start, it will always be slower than using e.g. Javascript or Python due to how strict it is.

But it's in its strictness is what I've come to love about Rust. Not just with forcing me to check errors, but also with the borrow checker stopping me getting lazy with how I pass data around the program.

In a production setting, that initial cost is worth it for me, as I'm more confident in my program in the long run.

=> More informations about this toot | More toots from drwhut@fosstodon.org

Written by Jan Ekholm on 2024-08-24 at 12:06

@drwhut I don’t doubt at all the benefits of Rust. I just wish I could get a free lift up that steep learning mountain.

=> More informations about this toot | More toots from chakie@toot.community

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/112994113461233921
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
357.879993 milliseconds
Gemini-to-HTML Time
3.139369 milliseconds

This content has been proxied by September (ba2dc).