Some background before I start with the questions.
The Game
It is the RTS tactics battles between 2 players, probably in the future will be 3 or more.
Each one have maximum 5 vehicles with unique properties (cars, tanks, artillery, etc…).
Movement restricted to XZ. Battle length usually 3-5 minutes. Game runs on Linux, Windows, Mac, Tablets (redesigned and optimized for touch) and Web.
Playable version with AI or in network using proxy is already works and run fast and smooth.
Game very dynamic and mix between logic and action.
Game fully utilize physics engine, i.e.: Collision of vehicles of different weight, push forces from explosions, etc… Therefore as a solution deterministic model is not something possible to implement.
Maybe soon I will publish my multiplayer playable demo.
Network and Stats
The first prototype run fast and reliable using proxy.
RPC and State Sync (15/sec) for
Player A units sync go from Player A —> Proxy ----> Player B
Player B units sync go from Player B —> Proxy ----> Player A
The VPS server located in Chicago,
in multiple test between Canada, Winnipeg with ping 50 and Israel with 170, the game run smooth.
State Sync is 15/second.
Instead of using Interpolation/Extrapolation I simply RPC the commands move, fire, etc… and allow each player physics engine to do the work for all vehicles, but then fix positions, rotations, etc… using state sync. It work very nice this way. I measure exact positions of all units on both ends and compare to find problems, and there is no. each small change of physics floating points fixed by state sync.
Some Statistics of Sync State Data
1 Byte - BOOL - stream.Write(platform.move)
4 Byte - Float - stream.Write(_myTransform.position.x)
4 Byte - Float - stream.Write(_myTransform.position.z)
4 Byte - Float - stream.Write(_myTransform.rotation.eulerAngles.y)
4 Byte - Float - stream.Write(_turretTransform.rotation.eulerAngles.y)
4 Byte - INT - stream.Write(currentHP) some units regenerate all the time, therefore RPC not an option.
21 Bytes per vehicle, total 10 vehicles and 5 per player = 105 Byte.
105 byte sent to other player. and 105 received = 210 in total.
15 times per second =
TOTAL 3,150 Byte / sec 25,200 Bit / sec
IN 1,575 Byte / sec 12,600 Bit / sec
OUT 1,575 Byte / sec 12,600 Bit / sec
If game runs 10 min
600 sec x 3,150 Byte = 1,890,000 Byte (2 Mbyte per game which is Ok)
I am planning to record each game to allow watch and learn for users later.
Measuring UDP data on a Linux VPS server I got 25 for each direction, 50 in total.
The Questions:
1.
50K/s for one game x 200 battles = 10 MBit / sec all the time which will eventually be
more than 15 Tera /month for only 200 battles.
Is it Ok ? or it is a lot and I need to find other solutions ?
2.
I know that proxy model have few big disadvantages:
- Security - to build security on a proxy model is a mouse and cat games, as I need to build some behaviour prediction checks to find hackers(crackers), and it will go and go,
not something I really want to deal with. - Not super efficient in bandwidth.
- Game logic that run on client - works now but no super efficient model.
and as you quest all this bring us to Authoritative Server, which I started to implement.
It solve all this Proxy problems, but create a huge new once.
1. How much more efficient bandwidth will be,
according to my calculations from 50K (25 up, 25 down), I will have just 25 down.
but if I now need to transfer all 10 units and not 5 and 5 it might even be the same.
2. Yes now game logic on a server (super), but the biggest question is how many game server processes the server can handle. I did many checks using all kind of bat file scripts, that run game in all kind of CPU efficient variations (of course in batch mode).
On my MBA 13 (i5) that run Windows 8 Pro - with 100 game server processes - 90% CPU.
But on my desktop i7 - 2600K after 150+ processes I got MONO memory errors.
I tried everything. funny that even with 70 games on 1 CPU core from 8, it runs ok, but when other CPUs got loaded with game process after 150+ all crash.
The question is, how much UT game processes server can handle ?
is 150+ some kind of limit ?
Can Linux solve this problem ? My VPS to slow to check it.
3. Lets say I can run 100-200 game processes in a AS model. it is just 200-300 concurrent online users. For me it sounds that I will just be able to pay for a server $100/m that will run them. And to make a game that will just pay for servers that run it, not a good idea.
From your experience and I know it vary a lot, but for a regular game how much it is 200 CCU. Nothing - $10/m - or thousands a month, of course if monitorization system in the game is build and working.
I know I bring a lot of questions, and I need answers from experienced users, but after a few nights spent in writing and testing, I must finally make this hard decision: Authoritative Server or Proxy that run already in fully playable game prototype.
After 15 years working as Linux Administrator I tend to AS model, but really afraid that eventually I will work to finance the game due to the huge clustering model with Unity Server Processes running in Linux virtual frame buffer.