Snowbox is an advanced example project. Examine this code to understand a fully integrated example with advanced features like client side prediction, extrapolation, interpolation, autoritative server, lobby server, handovers between two game servers and more.
The code is part of the uLink installation. Download uLink and open the Snowbox project after installing.
In the game, players run and jump around with their avatars, throw snowballs and chat with each other. The actual limit to the number of players on the same server is the client-side rendering of each player. Otherwise the server's bandwidth and CPU usage is barely noticeable in batchmode, because of uLink's lightning-speed and optimizations. The server has been tested with 100 simultaneously interacting players, each doing 10 actions per second, without any problems for the server. More performance test results is listed in manual chapter 17 - server operations. The client rendering however, becomes heavy with many players, but can of course be optimized in a number of ways.
A portal to another world
Notice the portal in the corner of the world, it is one of the unique features in uLink. When an avatar walks into the portal, it is teleported from one server to the other. Under the hood the avatar is transferred internally between the servers and the client is then redirected to the new server. The two servers are running independently as two different processes on a Windows or Mac computer. Server1 is running with the map called world1 and Server2 is running with the map called world2. They maintain a internal uLink network connection between each other, used only when players are transferred between them. This feature makes it quick and easy to build zoned MMO worlds. When the avatar is transferred, its complete internal state is serialized by uLink and sent from one server to the other. In this demo game the only internal state is the color of the avatar.
The game server is authoritative. This means players can't cheat by moving too fast or trying to break the game rules in any other way. The server does a physics simulation of all events and the result of this simulation is sent to all clients in real time with 15 updates per second.
The game uses advanced uLink features for client side prediction. When the client moves forward there is no delay at all, the client makes the move instantly in that player's screen. If the client makes a bad prediction, the server will notice this and send corrections. Corrections are handled as smoothly as possible on the client.
The game client also tries to make the movement of opponents' avatars as smooth as possible. The classic techniques to do this, interpolation and extrapolation, are both used in this game.
Client snowballs are eye-candy
Because snowballs are fully deterministic they don't need to be synchronized as other network-aware objects. When you throw a snowball, it is independently instantiated on the server and the clients (for visual purposes). However, only the server judges if a snowball hits an opponent or not.
In the beginning of the game you can choose between "Play on UnityPark" or "Advanced". The "Advanced" option demonstrates some of the lobby features in uLink and is very useful when testing your own local game, try it out.
Testing the code
There is a file called README.TXT included in the project in the Assets folder. It explains how to get started with building and running the code on your own machine.