Rust for realtime game servers

Hello everyone,

I'm new fairly new to Rust that I'm not even half way through the rust book. Anyway, I have a mmorpg server running and written completely in Golang. I'm kinda bored right now so I thought maybe learning a new language would be good.

And yes, I am considering Rust. But before I dive into it. I must ask: is rust a fit for this kind of application?

Would I find obvious benefits to using Rust over Golang for my mmorpg server?

Thank you.

Maybe. I don't know much about game development, but I know some people find the lack of inheritance challenging when writing games.

1 Like

You'll probably find the resources on https://arewegameyet.com/ useful.

TL;DR: Are we game yet? Almost. We have the blocks, bring your own glue.

Rust is probably more ready for the server part of a game application, though Rust's async story is still quite young, especially in comparison to Go's. But it's getting there.

We have all the building blocks, you just might need to provide some glue.

I'm not sure what your server architecture is like,
but I think rust has a few things, which those alone make it an attractive target for these kinds of application.

In particular:

  • no gc...
  • generic serialization

Where the generic serialization is useful in 2 places, cross-server communication, and storage which should help in getting things to scale well...

3 Likes

As said before, Rust has some useful features for game development, but that depends on how you are implementing your architecture. I would say traits and generics are the most important features here. But, since we are talking about server-side, the standard multithreading support is also a strong point.

2 Likes

If you already have a server in Golang, and it works fine for you, then you probably don't need to rewrite it in Rust.

In terms of benefits, you could expect mostly difference in memory and performance related to GC:

  • Lower memory usage, since memory can be freed more eagerly than with GC, and Rust is good at minimizing allocations.
  • Go tunes its GC for low latency at cost of throughput. But without a GC, Rust can give more predictable latency and no penalty from sweeps, memory barriers, etc.

On the language level you get:

  • Stricter and less verbose error handling,
  • More generics, less interface{}.

However, for games Rust's borrow checking model almost insist on using the ECS pattern. Arbitrarily mutable objects with a deep inheritance hierarchy will be a headache in Rust.

6 Likes

hi,i am working in game
so maybe i can give u some advice?
rust more suitable for game server than game client i think.why?
rust has not much more mature and stable graphics processing library or tools,your choice wiil be very less.
but in game server,i think it's better than gc language。why?
the reason @kornel has tell u.
From my personal experience,rust can reduce much more bugs, and use less cpu and memory.it's very important for game server!
and there are manys good library for build game server,some like actix,mio,tokio,async-std.
but if your game need distributed system for carrying millions and millions of units,maybe rust not suitable much for now,because rust has no mature and stable library.
if u build distributed system by your team,it's ok,but cost too much?
in a word,rust is worth to learn,and it will help u in the work in the future on some scenario

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.