Faster, Simpler, Smarter: Meet the SmartFoxServer Integration at Jelastic PaaS

| February 23, 2016

image00Do you like real-time games as we do? More and more people enjoy gaming online together and lots of DevOps are involved into multiplayer games. Even tiny games need much developers` time on creating, testing, running and managing.

Today we`d like to show how fast&easy it can be with SmartFoxServer 2X - a multiplatform software development kit supporting Adobe Flash, HTML5, Android, Unity3D, iOS, Java, C++ and more, that is designed to integrate with the major online web and mobile technologies. Thanks to its high performance, scalable architecture and simplicity of use, it is used to handle dozens of clients` projects all over the world, from simple turn-based games to massive virtual worlds and real-time action tournaments. The SFS2X makes these kinds of games easy to create, as well as simplifies greatly the deployment procedure - from zero to the game running in the browser.image07

So, below is the detailed use case showing how to rapidly set up a Jelastic environment and deploy SmartFoxServer for testing and production, with the example of real-time shooting game deployment - SpaceWar.

Install SmartFoxServer

The first step is to get the appropriate application server, running inside the Cloud.

1. Jelastic offers you a simple way to deploy SmartFoxServer 2X instance at a platform just in one click using the widget at the dedicated page of SmartFox website.image12

Just type in your email, choose the preferred hosting platform within the appeared list and submit your request. As a result, you’ll receive an email with confirmation link at the specified address. By following it, you’ll be instantly redirected to Jelastic dashboard with the installation already initiated.

2. Once the dashboard is opened, you’ll be shown the corresponding confirmation frame, where you can find the detailed server description and reference to the official website for additional information.

Also, here you need to specify the name of your environment (e.g. smartfox) and a region it should be created at.image13

Confirm the creation with the Install button and in a couple of minutes your environment with the SFS2X instance will appear at the dashboard.

3. Right after the installation, you’ll see the Application successfully deployed frame with credentials for your server, which are required to access its administration panel.image05

The same information is duplicated via email notification sent to your account address, so you can close this pop-up and proceed to server configuration.

Server Configuration & Administration

It’s worth to mention, that the solution presented in this SmartFoxServer 2X article is delivered with a special endpoint, which is automatically added to a server upon creation. It allows to easily access application server’s administration panel, by means of mapping the required private port via Jelastic Shared Load Balancer.image19

Tip: Alternatively, you can use external IP address (that can be activated within the environment topology wizard by means of the Public IP switcher) to establish the direct connection to your server. To view it, just click the gear icon next to the needed node for the Additionally list to be expanded - the required address will be shown within the field, marked with the globe pictogram to the left.image03
Though it’s a paid option, it can help to boost up the client’s connection speed and improve server response time due to the incoming requests routing directly to your server, i.e. bypassing the Shared LB.
Herewith, costs for its usage may vary depending on the hosting partner - the exact price can be seen within the Balance > Quotas & Pricing dashboard menu.

1. So, let’s find out how to access SmartFox administration panel and get the ability to track server activity in a real time. This can be done in several ways:

  • using the appropriate Administration Tool 2X link at the SmartFoxServer start page (which can be opened by simply clicking the Open in browser button next to your environment):image18
  • directly, through adding the /admin suffix to either your SmartFox domain address or attached external IP within address barimage02

2. Both of the above described methods will lead you to the admin panel login frame:image15

Here, you need to fill in the following fields:

  • Host either your environment URL without the http:// prefix (e.g. in our case) or external IP (if attached)
  • Port - number of port to connect (use the default 9933 one)
  • Username - name of your admin user (sfsadmin for all new SmartFoXServer instances by default)
  • Password - password for the above specified account (sfsadmin for the default user)

After everything is specified, just hit the Connect button.

3. Once inside, you’ll get to the server dashboard, where a number of useful charts (such as Server uptime, Memory usage, Network traffic and lots of others) can be observed.

Also, you can expand the left-hand Administration modules navigation menu to switch between different management screens, as well as track the real-time logs through the corresponding section at the bottom.image06

Subsequently, once your server is filled with players, the information provided here will help you to monitor the server’s resource usage and detect possible performance problems.

Tip: Since the load on your server grows you may require allocating the additional capacities to it. For that, access the topology wizard with the Change environment topology button next to your environment and state the required amount of resources by means of the corresponding cloudlet sliders in the Vertical scaling section.image17Also, here you can add more instances (i.e. scale the server horizontally) within the same-named section to gain even more performance.
Besides, there is also the possibility to configure a set of scaling triggers, which will automatically change the amount of instances according to the load the server receives.

Deploy and Run Your First Game

Now, let’s observe how to actually leverage SmartFox app server hosting within Jelastic Cloud. Since its high-performance architecture is designed for massive multiplayer gaming, we’ll  deploy a real-time shooting game, called SpaceWar, as an example. Being provided within the official app samples package, it represents a Flash-based demo applet for online spaceship battles with the already coded inertia acceleration and physics collision. Consequently, you can improve the given template to make the game process even more fascinating through adding some extra content like multiple weapons, planets with gravity, scores, etc.

For that, SmartFox has a number of embedded dedicated developer tools, aimed to greatly simplify the game creation process, and specialized API to handle the common operations (like match-making, game searches, etc) much easier. Being complemented with the Jelastic scalability and fair pricing, such a bundle can be considered as one of the best solutions for online games hosting.

So, let’s find out how to deliver and deploy this ready-to-use game template within Jelastic Cloud in a matter of minutes.

1. First, let’s get our game example. Navigate to the corresponding SmartFoxServer web page, Download the source files archive by clicking on the same-named link and extract its content.image14
2. Now, return to the dashboard and access the SmartFoxServer 2X file system with the appropriate Config button next to your app server’s node.image11

Then, move to the smartfox > 2X > SmartFoxServer_2X > SFS2X > extensions folder and create a new directory, named SpaceWar.

3. Now, upload files from the SFS2X_Flash_Examples > Flex > SpaceWar > deploy > extensions > SpaceWar folder (within the locally unpacked archive) to the just created directory by clicking the Upload button next to it.image09

4. Just in the similar way, perform uploading to:

  • smartfox > 2X > SmartFoxServer_2X > SFS2X > zones directory - place here the file from the corresponding SFS2X_Flash_Examples > Flex > SpaceWar > deploy > zones local directoryimage08
  • smartfox > 2X > SmartFoxServer_2X > SFS2X > www > root > examples (or any other preferred location under the root folder) - upload all of the game client files from the SFS2X_Flash_Examples > Flex > SpaceWar > deploy > client folder of the extracted archiveimage16

5. Almost there! To complete the configuration, let’s set the correct connection data within the sfs-config.xml file (it can be found among the above mentioned client files we’ve just uploaded, at the examples directory in our case).

To make you game being launched via the provided by default endpoint, define the proper <ip> and <port> parameters using the appropriate Host and Port values from email you’ve got after server creation.image20

Tip: In case you prefer to work over the previously attached Public IP, just edit the <ip> record with the corresponding external IP address, whilst leaving the <port> parameter unchanged (9933).image04

6. Finally, Restart the SmartFoxServer 2X server for the performed changes’ appliance.image01
7. That’s it! Now, in order to run the game itself, click Open in browser for your environment and add the /examples/SpaceWar.html string (or the appropriate path under the root folder you’ve set in the 4th step) to address bar.image10

Here you go! Game is ready to play - simply enter your Username and hit the Play button.

Choose your spaceship and prepare for the battle with any other player connected. The controls are quite simple: up arrow to accelerate in the ship-pointing direction, right and left arrow keys for rotating and spacebar to fire your weapon.

As you can see, the SmartFoxServer 2X installation, as well as its usage and game deployment, is quite simple with Jelastic. So, don’t hesitate and register for a free account to try this out in 4 plain steps: create a server, upload your game, configure connection and share the link to enjoy gaming with your mates.

That's all for now, see you next time!