Live data from Hacker News

High-Throughput Game Message Server with Python WebSockets

mortoray.com

21–30 of 61 posts

Re: High-Throughput Game Message Server with Python WebSockets

#21

Quesrions for people familiar with the industry: my understanding is that UDP is optimal for fast-pased games, you don't have to wait for re-sends of old packets, etc. However, it seems you can't just flick a switch and get encrypted connection like you can with TLS. So what do people normally use? Does everyone do a custom AES-packet or something?

One option is DTLS[0], which is roughly TLS for UDP.

[0]: https://en.wikipedia.org/wiki/Datagram_Transport_Layer_Secur...

Re: High-Throughput Game Message Server with Python WebSockets

#22

Quesrions for people familiar with the industry: my understanding is that UDP is optimal for fast-pased games, you don't have to wait for re-sends of old packets, etc. However, it seems you can't just flick a switch and get encrypted connection like you can with TLS. So what do people normally use? Does everyone do a custom AES-packet or something?

Some games encrypt them, but while I would normally never say this - there's nothing really to protect over the udp packets if it's just game state. And you want to keep the latency as low as possible for those packets. You want to do everything else over tcp and encrypted.

I remember quite a few aimbots back in the day would MITM packets so there are some reasons you might want to do it from a defense in depth perspective.

Re: High-Throughput Game Message Server with Python WebSockets

#23

Earlier quoted context omitted.

As with any tool, if you don't use it properly it can hurt you.

That's quite a ridiculous statement in this context. Even highly-trained, extremely smart developers are proven to not be able to use C without introducing gaping security holes. That's not "it can hurt you". That's "it hurts you and everyone that is exposed to your RCE machine".

C is not C++. There is a reason core services for DHCP, DNS, etc are built in C and not Rust. If you're a careless developer you can have security vulnerabilities in any language.

Re: High-Throughput Game Message Server with Python WebSockets

#24
post #8

Author contemplating an eventual C++ rewrite, but this is a perfect use case for Rust. When you want performance and where memory mistakes can be a serious security problem.

Or F#/C#. Rust will have memory fragmentation over time.

C# suffers from that too. I've personally seen a prod instance experience OOM with something like 40% free virtual memory. There's a reason why ArrayPool is part of mscorlib.

All of that said, x64 greatly reduces the effects of memory fragmentation: there's always more virtual memory.

Re: High-Throughput Game Message Server with Python WebSockets

#25
post #8

Earlier quoted context omitted.

Or F#/C#. Rust will have memory fragmentation over time.

Memory fragmentation is generally a problem for pets, not cattle. In 90% of use cases it’s nothing that frequently reaping processes won’t fix. This works regardless of language, as it pushes the job of garbage collection onto the os. Another nice feature of treating your processes like dirt is that you tend to get high fault tolerance and scalability as emergent properties.

Right. Just like the story of a memory leak in a missile.[1]

[1]: https://devblogs.microsoft.com/oldnewthing/20180228-00/?p=98...

Re: High-Throughput Game Message Server with Python WebSockets

#26
post #17

Might as well plug the game server I wrote over the summer. It's a python UDP server that I was able to scale to over 100 concurrent users based on various sources, but mostly the Gaffer On Games blog. I chose python because I wanted game development to be fun. Ultimately, I couldn't find an existing python framework for multiplayer games that scaled well to my needs. [1] https://pypi.org/project/mpgameserver/

did you consider using AWS eventing in API Gateway https://aws.amazon.com/blogs/compute/announcing-websocket-ap... ?

Re: High-Throughput Game Message Server with Python WebSockets

#27

Looks like a perfect case for erlang. And while we are at it, one of existing xmpp servers written in erlang. One puny $2/month server will serve thousands of users without sweating.

I feel like I have to ask: where are you getting a server that'll run arbitrary erlang code for 2 bucks a month? The absolute cheapest I've seen seems to be 5, from digitalocean/linode

Re: High-Throughput Game Message Server with Python WebSockets

#28
post #23

Earlier quoted context omitted.

That's quite a ridiculous statement in this context. Even highly-trained, extremely smart developers are proven to not be able to use C without introducing gaping security holes. That's not "it can hurt you". That's "it hurts you and everyone that is exposed to your RCE machine".

C is not C++. There is a reason core services for DHCP, DNS, etc are built in C and not Rust. If you're a careless developer you can have security vulnerabilities in any language.

The reason they're built in C is legacy and the fact that Rust hasn't been around all that long.

Re: High-Throughput Game Message Server with Python WebSockets

#29

Looks like a perfect case for erlang. And while we are at it, one of existing xmpp servers written in erlang. One puny $2/month server will serve thousands of users without sweating.

I feel like I have to ask: where are you getting a server that'll run arbitrary erlang code for 2 bucks a month? The absolute cheapest I've seen seems to be 5, from digitalocean/linode

[deleted]

Re: High-Throughput Game Message Server with Python WebSockets

#30

Looks like a perfect case for erlang. And while we are at it, one of existing xmpp servers written in erlang. One puny $2/month server will serve thousands of users without sweating.

I feel like I have to ask: where are you getting a server that'll run arbitrary erlang code for 2 bucks a month? The absolute cheapest I've seen seems to be 5, from digitalocean/linode

Vultr has $2.50/mo USD VPS if you're okay with ipv6-only... that's the lowest I've ever come across.
Post reply on HN