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
=> More informations about this toot | More toots from drwhut@fosstodon.org
@drwhut You're right about how satisfying those green OKs are 😌
=> More informations about this toot | More toots from jenson42@mastodon.social
@drwhut It does feel great. Daily dopamine
=> More informations about this toot | More toots from everdrone@functional.cafe
@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
@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
@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
@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
@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
@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
@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 This content has been proxied by September (ba2dc).Proxy Information
text/gemini