Launching SmartFoxServer in the cloud

In early November 2020 we have launched a new cloud service called Overcast which joins the family of SmartFoxServer products.

In this short series of articles we will be taking a look at how Overcast works, how to get started and and how it can help new or existing projects based on SmartFoxServer.

SmartFoxServer in the cloud

Essentially Overcast provides SmartFoxServer in the cloud, meaning that you can get all of the SFS2X features you’ve learned and used, directly in the cloud, from a convenient web interface, and without having to manually set up the hosting and server yourself.

This includes also the database side of things, as Overcast allows you to deploy one or more MySQL servers for your storage needs that can be accessed from you SmartFox instances.

» Launching servers

To give you an idea of how Overcast works in practice here’s a quick example of how a new SmartFoxServer instance is created from the Overcast HQ.

Once you have created an account you will start by creating an Application which will contain your SmartFox and database servers.

Click on Create new and enter the details.

The Application is now created and we can proceed by creating a new server via the “+” icon on the right side.

Step 1: choose the Region of the world and type of server you want to launch.

Step 2: assign a server name and choose the size of the hardware that will run the server.

Step 3: choose the SFS2X version you want to install and assign an Admin password.

Finally double check the summary and choose a billing plan.

» Managing your servers

After launching one or more servers you will find all of your instances listed in the Application page.

From here you can access the details page, which contains runtime statistics and data about the server. Also you can click the tool box icon to launch the AdminTool or the gear icon to access more options, such as restarting the server, creating a snapshot and terminating the instance.

» Setup and connection

Via the toolbox icon we can launch the server’s AdminTool and login with username “sfsadmin” and the password we specified at the time of creation.

By default a SmartFoxServer instance launched in Overcast starts with no Zones defined, so we recommend to start setting up the server by creating one.

Select the Zone Configurator tab and in the left hand panel click on the +Z button to add a new Zone.

When you’re done with the Zone settings hit the Submit button. This will store the configuration on the server side. Now you can select the Zone name from the left hand menu and click the “Play” button (right arrow) to start up the Zone.

You can now test the server from the client side, by opening a connection and logging in the Zone.

Here’s an example client code in Unity / C# to connect to your server:

public class ConnectionExample : MonoBehaviour
{
    private SmartFox sfs;
     
    void Start()
    {
        // Create the SmartFox client instance
        sfs = new SmartFox();
         
        // Add event listeners
        sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection);
        sfs.AddEventListener(SFSEvent.LOGIN, OnLogin);
         
        ConfigData config = new ConfigData();
        config.host = "10.11.12.13";    // replace with your server IP
        config.port = 9933;
        config.zone = "MyGameZone";     // replace with the correct Zone name
         
        // Connect
        sfs.Connect(config);
    }
     
    // Handle connection event
    private void OnConnection(BaseEvent evt)
    {
        if ((bool)evt.Params["success"])
        {
            sfs.Send(new LoginRequest("TestClient"));
        }
        else
        {
            Debug.Log("Failed connecting to server!");
        }
    }

    // Handle login event
    private void OnLogin(BaseEvent evt)
    {
        Debug.Log("Login success!");
    }
}

» Next steps

In the next installment we will walk you through the deployment of a game example in Overcast, including server side code and client, so that players can access it from the web.