In multiplayer games, inefficient code costs money. But how can you figure out how much compute power you’re going to need? Read more.
The more memory and resources your game takes up, the more it’ll cost you in the long run. So it’s important to make sure that you know exactly how much strain you’re putting on your servers.
That’s where a resource profile comes in. It’s a description of how much compute power and memory your game uses to run on the server. But how do you figure it out?
On average, we find that modern games need at least one virtual CPU and 1GB of memory.
But every game is different. A battle-royale game with hundreds of players is going to need to track a lot more information. There’s everyone’s health, location, ammo, whether they’re shooting, whether they’re hitting, special abilities. While other games, like a turn-based strategy, might only need to handle a tiny packet of data every few minutes.
There are a couple of aspects of your game that you need to consider:
A first-person shooter might even use far less resources than a MOBA. Sure, there are fewer players, but it’s still a competitive game. One that has loads of spells and mobs that every player needs to see.
Thinking about this upfront can help you think of ways to optimize your code and keep costs down in the future. Chivalry 2, for example, has 64 players in every match. Despite that, they got down to using only 2GB of memory. A pretty impressive feat, considering the size of the matches.
Most engines have a way to track how many resources you’re using. Unreal has the Stat Viewer, Unity has the Memory Profiler, and Godot has a Resource Profiler.
But often, these will only show you the stats for the client-side image, not the server-side. So bear that in mind. They can help you get an estimate, but won’t help you get an exact figure.
There’s nothing better than real data. Gather together a full match and play a real game. While the match is running, keep an eye on how much compute power and memory the server is using.
The earlier you think about how to optimize your game, the easier it is to only keep critical processes on the server side. Trying to restructure your code later is never easy. Think about what data you need to send and whether the player or server can do those calculations.
That doesn’t mean you should be afraid to use the server-side image. In some cases, you don’t want players to be able to intercept and interfere with the code. And if you need a hand, reach out and we can help.