Why using Mobile Devices as Game Servers is a bad idea

As a developer of the Mirror Networking stack, sometimes I look in the help channels and see people wanting to use Android or iOS for game servers, where people would connect to each other’s phones and have a game session.

Before I dive into the nitty gritty, I’m going to say it now: Using Mobile Devices as servers is a VERY bad idea, and if you expect this to work in the long term, your expectations will fail you.

Too long didn’t read? Use a dedicated server game instance on a cheap VPS from Linode, Vultr or whatever provider tickles your fancy and connect your clients to that. Problem solved!

Don’t believe me, or you think I’ll be completely wrong? Then go ahead and use a mobile device as a server and ignore my advice. Want to know the pain and suffering of using mobile devices as servers? Then keep reading, my dear reader…

Mobile Hardware Performance

Let’s be honest here.

You have a flagship device that boasts an Octa-core CPU with 6GB of Memory. That’s pretty cool and I’ll even say that’s impressive. However, ARM mobile devices have one drawback: when you compare them to a x86-based machine, be it a Intel Pentium/Core-series/Xeon or AMD Ryzen/Threadripper/EPYC, you clearly have a winner in favor of the x86 platform. A mobile ARM chip simply cannot compete with the performance of a desktop or server platform.

I am aware that there is 32/48/64 Core ARM64 powered workstations and servers out there that are very impressive pieces of hardware which goes to show the power of ARM-based architecture. But these super-high core count processors are for workstation and specialized server use and not mobile.

Operating System Performance

Even if you have the best hardware, your operating system is the one that has to tell it what to do. And if your OS is dragging its feet, then your device can only run as fast as the OS can run.

For Android, it can be very slow with certain operations. Yes, while I cannot deny that with every incarnation of the Android OS performance gets better and better, overall it’s still an operating system that doesn’t take advantage of all the performance the hardware can provide and that’s due to how it has its roots in a Java Virtual Machine-like environment.

Apple iOS devices are somewhat better (shock!) in performance from my own analysis as I own a few Apple devices and use them regularly. I’ve had some slowdown on my 5th Generation iPad and my game development iPhone 5S, but never to the point where it was unbearably slow that I wanted to throw it in the trash (unlike my Galaxy A5).

Overall I find Apple devices much more consistent in performance than my Android devices.

Connectivity Woes

On a mobile device, you usually only have two major connection options – WiFi and Cellular (3G/4G/5G). Both are bad for hosting servers, not only because they are lossy environments (packet loss, extreme latency, etc), but since devices can turn off the WiFi to save power and as soon as the connectivity goes down, the game is over.

In regards to Cellular services, you’re often are not connected to the internet directly with a real public IP. Instead, most of the time you will get a IP address (for example, my provider uses IP addresses inside the 10.x.x.x range). This is known as a private IP address.

In addition to getting a private IP, you’re also behind a NAT firewall, and that will prevent you from receiving incoming connections unless you are using a relay service, which is technical and outside the scope of this topic.

You may also face your server instance dying randomly or running in reduced performance if you get a phone call or your waifu is wanting attention while the server is running.

Some devices “freeze” applications during phone calls so the OS can focus on the call, rather than the game. There’s also the risk that your game might be reaped by the memory manager in cases of low device memory. Also, Android and iOS don’t like running server instances in the background or while the application is minimized for various reasons.

In short, it can be hell.

Mobile Servers: okay for LAN Parties, Shit for Online Play

Here’s the take away message:

You can get away with hosting a game server on-device for local (LAN) parties. Say you are making a Mario Party clone and you want to have up to three other friends to join your game on the LAN. Using your device to locally host a game is fine. For example, you can use Mirror’s Host Server mode for that.

For online game servers, unless you really know what you are doing and by that I mean you have extensive networking knowledge, I would strongly recommend avoiding giving people the ability to host a game server on-device for others to connect to.

Instead, I encourage you to look into a master server based system where you connect to (GameLift or PlayFab, for example) and then request the platform to spin up a server and go from there.

You will get much better performance since you’ll be running your game on real hardware designed for server use, and reduced stress from not having to deal with mobile operating system limitations.

Questions? Comments? Let me know down below. I’ll do my best to address them, but I hope you found this insightful.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments Protected by WP-SpamShield for WordPress