Live data from Hacker News

High-Throughput Game Message Server with Python WebSockets

mortoray.com

41–50 of 61 posts

Re: High-Throughput Game Message Server with Python WebSockets

#41
post #10

If you want Python to go faster, use PyPy.

It'll probably help in this case since I suspect it's computational overhead introducing the bottleneck, nothing architectural.

Alas, I might have to wait, as I tend to use Python 3.8 and it's not supported yet -- though mainly I use it for types, it might actually run in 3.7

Re: High-Throughput Game Message Server with Python WebSockets

#42
I'm working on a game server handling websockets with mainly broadcast messages. I'm using nchan[1], a Nginx addon to handle websocket with a pub/sub pattern. It works really well, is customizable and is highly optimized. Perfect for some games which needs to send a global state to every players.

[1] https://nchan.io/

Re: High-Throughput Game Message Server with Python WebSockets

#43
Have you considered trying Twisted? I recently watched this talk about how to use async to handle 1000s of concurrent players on a mobile MMO, it wasn't exactly enlightening but it was definitely worth watching: https://www.youtube.com/watch?v=KW3mzaM3UcU

I am currently planning a client server architecture for a game that requires Bullet Physics with UDP on the backend, and I'm weighing different options, I initially wanted to use Go but it would require interfacing Bullet's C++ API with C so it's not a feasible option. I'm currently considering Twisted + Bullet's Python API.

Re: High-Throughput Game Message Server with Python WebSockets

#44

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?

HTTP/3 with QUIC as transport will be using UDP and is encrypted.

I assume it will change quite a few things for these kind of needs.

Re: High-Throughput Game Message Server with Python WebSockets

#45

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

Scalewsy Stardust instances are 1.9Eur/m.

https://www.scaleway.com/en/stardust-instances/

Re: High-Throughput Game Message Server with Python WebSockets

#46

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.

> but this is a perfect use case for Rust Idk it seems like for someone prototyping things alone, Python is the perfect langauge

I don't think the parent is disagreeing with that, but the article mentions graduating from Python to something else, which is where the recommendation fits. Parent isn't saying the article's original version should be in Rust.

Re: High-Throughput Game Message Server with Python WebSockets

#47
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.

Yes, and that good reason was that Rust did not exist.

Re: High-Throughput Game Message Server with Python WebSockets

#49
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/

[deleted]

Re: High-Throughput Game Message Server with Python WebSockets

#50

Earlier quoted context omitted.

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

Scalewsy Stardust instances are 1.9Eur/m. https://www.scaleway.com/en/stardust-instances/

IPv6 only is even cheaper at 0.3 euro per month.
Post reply on HN