Slaying Ghosts: How we boosted zone load by 5x
(German translation / deutsche Übersetzung)
In a game like Villagers and Heroes, the game world is refereed by a central server (actually, many). The central server makes sure all the players see the same thing on their computer. Its job is to keep all the objects in the world synchronized across everyone’s computer.
Take a look at this sample screen from the game:
There are many objects in this scene: player avatars, monsters, trees, a lamp post, a road, a river, and so on. All of those objects must be tracked. Here’s a schematic drawing of what the server sees:
I labelled these objects:
1. Player Avatar
2. Monster
3. Lamp Post
4. River
5.Tree(s)
6. Bridge
The server has to make sure that all of these objects are in the exact same place on everyone’s computer. So, to accomplish this, it transmits over the internet, each object’s type (tree, players, monster, etc.), and its location.
Here’s a new picture that shows this communication taking place between the server and one of the player’s computers. A player’s computer is often called a client.
Every arrow in this diagram represents a transmission that the server must make to ALL the clients in the game (at least to players who are near this location in the world). (Side Note: There is only one arrow going from the Client back to the Server. That’s because the only object that the Client has control over is the player’s avatar.) Each of these arrows is expensive. Hundreds of bytes must be transmitted per object per client. This puts Load on the server-- it eats up CPU cycles and chews up Server bandwidth. The consequence of this is that it can make the game appear “laggy” or sluggish. And, possibly worse, it can take time for all the information to be transmitted from the server to the client.
The process of transmitting information about objects is called “ghosting”. Each object in the scene exists in two places-- one on the server, and one on the client. The copy on the server is considered the real object, and the copy that the server transmitted--or “ghosted”--is considered its ghost.
Finally, I should mention that this picture is simplified. In a real situation, there are HUNDREDS of objects being ghosted from the server to the client.
What does the game Tribes have to do with Villagers and Heroes?
Now I want to take a brief detour. The engine that Villagers and Heroes uses is Torque3D. This a third-generation engine based on the game engine that Dynamix developed for the game “Tribes”. Tribes is one of the most influential games in game history. It was the first First Person Shooter game to feature powered battlesuits, team-based matches, and jump jets. It’s the forerunner of games like HALO and TitanFall. One area where it excelled was in its networking. One of the design goals of Tribes was that every mission should be completely moddable. Along with ability of any player to run their own server, it allowed the community to build their own custom missions.
However, one of the costs of having completely moddable missions, is that the server has to tell every client where everything is (and what everything is).
Look back at the picture that shows ghosting from server to client. Most of the objects in that picture never move. Of all of those objects, the only objects that DO move are the player, and the monsters. So, it is a waste that we are transmitting the types and positions of EVERY object in the scene. A better solution is to have the Client load the types and positions of all the non-moving objects from the hard drive. It is WAY faster to load from hard drive than receiving the information over the internet. Additionally, when the player’s computer can handle all this work completely on its own, this saves the server a tremendous amount of work, cutting down on CPU and bandwidth usage. Here is a schematic of what the new system looks like:
This is the system that Clark Fagot implemented for the game recently. Red arrows increase load times and put load on the server, whereas green arrows load quickly and put no load on the server.
The Results
On average, it reduced the zone loading times for our players from 40 seconds to 8 seconds. This is the difference between getting bored and keeping the gameplay rolling. In addition, it saves bandwidth for the game servers, and all the players.
---------------------------------------------------------------------------------------------------
Eine deutsche Übersetzung dieses Artikels findet Ihr in unserem Forum:
Geister töten, oder wie wir es geschafft haben, die Zonenladezeiten um das Fünffache zu verkürzen.