A Virtual World Distributed Server developed in Erlang as a Tool for analysing Needs of Massively Multiplayer Online Game Servers Erlang/OTP User Conference Stockholm on November 10, 2005 Michał Ślaski michal@erlang-consulting.com
Contents Massively Multiplayer Online Games Problems to solve Prototyping Using Erlang/OTP for the prototype Client and server applications Determining the maximum number of players Architectures with single and double-function nodes Synchronisation of the game s state Conclusions Page 2
Massively Multiplayer Online Games Significant increasing in number of active subscribers Fast growing online games market 9 000 000 Total active subscribers 8 000 000 7 000 000 6 000 000 5 000 000 4 000 000 3 000 000 2 000 000 1 000 000 0 1997 1998 1999 2000 2001 2002 2003 2004 2005 Source: MMOGCHART.COM Source: IGDA, "2004 Persistent Worlds White Paper" Page 3
Problems to solve Big amount of data to process Frequent synchronisation acceptable delay 150-500 ms Adaptation to the connection quality Limited opportunity for full testing t with thousands of players during early phase of development Page 4
Prototyping Experimenting with the functional and technical aspects Determining the scalability of the architecture Testing new solutions Page 5
Using Erlang/OTP for the prototype Open source Compatible with various platforms Concurrent oriented programming one process for every connected player Efficient internal communication Supporting distributed applications Distributed database Mnesia Distributed load testing tool IDX-Tsunami Page 6
Client application Java + Java3D Actions: moving collecting objects magic chat Player s state kept on the server Page 7
Server application The game terrain divided into zones Players placed within the same zone are processed on the same node Server distributed on a cluster of machines Page 8
Determining the maximum number of users 1 200 1 050 Legend Collecting object transaction transaction time [msec] network traffic [kbits / sec] 900 750 600 450 300 150 0 0 20 40 60 80 100 120 140 160 time of the test [s] 800 700 600 500 400 300 200 overload overload 100 Legend Outgoing network traffic 0 0 20 40 60 80 100 120 140 160 time of the test [s] The server was overloaded in the 60th second of the test number of players 180 160 140 120 100 80 60 40 20 122 players 0 0 20 40 60 80 100 120 140 160 time of the test [s] Page 9
Architectures with double-function nodes 900 800 700 number of players 600 500 400 300 200 Legend maximum number of players that can be handled by the architecture 100 0 1 2 3 4 5 6 7 8 9 10 number of nodes processing network traffic and player's actions Page 10
Architectures with single-function nodes 700 120 600 100 number of players 500 80 400 60 300 40 CPU utilisation [%] 200 Legend 20 maximum number of players ac tion proc essing nodes' CPU utilisation network proc essing nodes' CPU utilisation 100 0 0 1 2 3 4 5 6 number of nodes processing player's actions (2 network nodes) Page 11
Synchronising issue Client A Server Client B Try to pick up a mushroom Try to pick up a mushroom Action status - OK mushroom collected by client A Action status - FAIL Page 12
Desynchronisation of the game s state 0,1 Server is not overloaded More successful actions number of transactions / number of players 0,09 0,08 0,07 0,06 0,05 0,04 0,03 0,02 0,01 Legend successful actions not successful actions y=0.04855 (successful) y=0.0009119 (not succ essful) 0 0 100 200 300 400 500 600 700 800 900 1 000 time of the test [s] Page 13
Desynchronisation of the game s state 0,05 Server is overloaded More actions fail number of transactions / number of players 0,045 0,04 0,035 0,03 0,025 0,02 0,015 0,01 0,005 Legend successful actions not successful actions y=0.04855 (suc c essful) y=0.0009119 (not succ essful) 0 0 100 200 300 400 500 600 700 800 900 1 000 time of the test [s] Page 14
Conclusions Erlang/OTP is appropriate for developing prototypes of the distributed MMOG systems Rapid development of the prototype allows examining different algorithms in a relatively short period of time Future work Future work algorithms not dependent on the player s position Page 15
Contents Massively Multiplayer Online Games Problems to solve Prototyping Using Erlang/OTP for the prototype Client and server applications Determining the maximum number of players Architectures with single and double-function nodes Synchronisation of the game s state Conclusions Page 16