SmartFoxServer and Jelastic for Mobile Game Development.

| June 20, 2013 | DevOps PaaS | , , , , ,

Mobile gaming is a growing phenomena that has exploded with the rapid propagation of smartphones and tablets, in particular those running Apple iOS and Android.
In 2009 the smartphone game sales on those two platforms amounted to 19% of the market. Two years later it was 58% and it’s now leading the apps market, with expected revenues in excess of $8 million for 2013 and twice as much for 2014.
Every day new developers are joining the community of mobile gaming. We have prepared a simple tutorial that will demonstrate how easy it is to get started with Jelastic and SmartFoxServer 2X.
SmartFoxServer 2X is a comprehensive platform for rapid development of multiplayer game s and applications, supporting Adobe Flash, HTML5, Android, Unity3D, iOS, Java, C++ and more. SmartFoxServer 2X comes for free with a 100 CCU (concurrent users) license, 100% of the features and no time limitations.
Thanks to its simplicity of use, versatility and performance, it currently powers hundreds of projects all over the world, from simple turn-based games to massive virtual worlds and real-time action games.
In this post we will show how to rapidly setup a Jelastic environment and deploy SmartFoxServer for testing and production. The whole operation takes no longer than 5 minutes.

Create environment

1. Log into Jelastic Manager and click on Create environment button.
2. Select the Expert Environment topology, click on the VDS button and specify the cloudlet limit for your node. After that type the name of your environment and click Create.
smartfoxserver-environment

3. After you environment is successfully created establish SSH connection using any SSH client suitable for your OS (MacOS, Linux, BSD or Windows) or Jelastic web-based client.

Install server

1. Download SmartFoxServer community addition for Linux x64.

# wget http://www.smartfoxserver.com/downloads/sfs2x/SFS2X_unix_2_7_0_64.tar.gz

2. Unpackage the archive you've just downloaded.

# tar -xvf SFS2X_unix_2_7_0_64.tar.gz

Configure the server’s public IP address. In the <unpacked-folder>/SFS2X/config directory open the server.xml file and edit the following line by replacing 127.0.0.1 with the real address of your Jelastic VDS.

<socket address="127.0.0.1" port="9933" type="TCP"/>

4. Navigate to /SFS2X/ directory and enter the next command:

# cd SmartFoxServer_2X/SFS2X/
# ./sfs2x-service start

Now you can navigate to your SmartFoxServer in a browser using the public IP address of your VDS. For example: http://10.11.12.13:8080. The default credentials for the administrator are: sfsadmin / sfsadmin.
smartfoxserver 2x documentation

Success! You have completed the process.

Performance test

The engineers at SmartFoxServer helped Jelastic testing the overall performance of the proposed solution. We used a custom built tool that allows to spawn thousands of clients and generate huge traffic towards the server.
For our simple stress test we set up a cluster of 3 client machines (1 master + 2 slaves) to overload a single SmartFoxServer 2X instance with traffic. Every client runs in its own Jelastic VDS, configured with 32 cloudlets and generating 8333 clients each.
The following are the essential statistics:

  • 25000 total concurrent clients
  • Approximately 5000 Rooms are created
  • Login phase = 30 clients/sec joining the server
  • 6250 messages/sec going to the server
  • 31250 messages/sec going out of the server (this is because each messages is broadcast to 5 users in each Room)
  • The generated network traffic is approximately 8Mb/s IN, and 32Mb/s OUT
  • The whole test uses less than 15% of the CPU and approximately 1.2GB of RAM on the SmartFox instance.

The test was run using the SmartFoxServer’s default configuration for three days, setting the JVM maximum memory at 2GB.
With 25K CCU consuming less than 15% of the computing resources it is immediately clear the massive scalability potential of the SmartFox and Jelastic combination. Paired with the natural horizontal scalability of the cloud, this solution can satisfy projects of all sizes and easily grow with its audience.

Finally, with the ability of Jelastic to dynamically allocate resources on the fly, according to the minimum and maximum configured by the user, the solution can satisfy the technical requirements and budgets of every game developer.
If you’re interested in learning more about large SmartFoxServer deployments and relative architectures you can consult these white papers.

Testing a mobile game

SmartFoxServer 2X comes with a large pool of example games for all major supported platforms that can be tested and studied out of the box.
In this white paper we will use the Android version of the Tic-Tac-Toe to get started with SmartFoxServer 2X.
1. Start by downloading the Android example pack.
2. Extract the files from the package you've just downloaded and install the .apk on your Android device (Tris/deploy/client/ in our case). You will need to have Android SDK Tools installed.

# adb install SFS_Example_Tris.apk

3. Copy the tris/ folder from the Tris/deploy/extensions/ folder to your SFS2X installation folder, under SFS2X/extensions/
In order to start the game on the client launch the app and change the connection details of your SmartFoxServer using its public IP address.

phone smartfoxserver documentation

Conclusions

The multiplayer aspect in mobile game plays a central role in improving the longevity and popularity of your products, allowing users to enjoy live interaction with friends and other players.
For more information about SmartFoxServer:

For more information about Jelastic: