New in 2.19: Extension Flood Filter

With the release of SmartFoxServer 2.19.0 we have introduced a new Extension Flood Filter that provides fine grained control over the packet rate of Extension requests: it can be used to limit the number of calls per second for specific requests and automatically set rules for warning and banning the offending client(s).

It also includes the ability to catch unknown Extension calls (i.e. requests for which there doesn’t exist a request handler) and apply auto-ban rules as well.

Under normal circumstances, e.g. users playing with the official client app, there shouldn’t be a concern about request spam: limitations can be easily coded in the client itself. However it’s also relatively easy for malicious users to reverse engineer a client made in Javascript, Unity or Java and bypass such limitations.

Overview

In the diagram below we show a bird’s eye view of the filter and its position in the Extension invocation chain. For each request handler defined in our Extension code (via the addRequestHandler methods) we can set a limit expressed in number of calls per second.

Extension Flood Filter

In this example we have defined a playerShoot request handler and we’ve also set a limit of 4 requests/sec. If a client sends 20 calls in one second only the first 4 will be passed to the Extension and processed, while the rest will be discarded. Additionally, based on the auto-ban rules, the sender will either be warned or banned.

Usage

The Extension Flood Filter is inactive by default. To activate it we need to call the initFloodFilter(…) method available from the parent SFSExtension class.

public class AntiFloodTestExtension extends SFSExtension
{
    static final String PLAYER_SHOOT = "pShoot";
    static final String PLAYER_MOVE = "pMove";
 
    @Override
    public void init()
    {
        ExtensionFloodFilterConfig cfg = new ExtensionFloodFilterConfig();
        cfg.banDurationMinutes = 120;
        cfg.maxFloodingAttempts = 3;
        cfg.secondsBeforeBan = 2;
        cfg.banMessage = "You are now banned. Reason: request flooding.";
        cfg.filterRules = Map.of
                        (
                            PLAYER_SHOOT, 4, 
                            PLAYER_MOVE, 15
                        );
     
        initFloodFilter(cfg);
     
        addRequestHandler(PLAYER_SHOOT, (sender, param) -> {
         
            trace("Shooting");
     
        });
     
        addRequestHandler(PLAYER_MOVE, (sender, param) -> {
         
            trace("Moving");
     
        });
    }
}

The initializer method takes a ExtensionFloodFilterConfig object with with a number of properties for warning and banning clients.

For more details on each setting, default values and further details please check our documentation website here.

SmartFoxServer 2.19.0 is available!

We have just released SmartFoxServer 2X 2.19.0, which introduces Extension Flood Filters to limit the number of Extension calls on a per-request basis. The release comes also with updated Tomcat (websocket/BlueBox), updated GeoIP database and a host of bug fixes.

Please note: the new release comes as a standalone installer so it can’t be used to update a previous instance.

» Get the new SmartFoxServer 2.19.0 installer from our download section.
» Read the full release notes here.

SmartFoxServer 2.18.3 is out!

We just released SFS2X patch 2.18.3 which fixes a couple of problems with the Analytics module, adds IP-range support for Admin clients and fixes a minor UI issue with the AdminTool. You can read the release notes and proceed with the download from here.

While you are at it, also check out the latest client API in our dedicated download section.

Please note: the patch requires SFS2X 2.18.0 to be already installed.

SmartFoxServer 2.18.2 is available!

We just released SFS2X patch 2.18.2 which provides a series of features that have been requested and launches updated client-side APIs for all supported platforms. You can read the release notes and proceed with the download from here.

The latest client API can be obtained from our dedicated download section.

Please note: the patch requires SFS2X 2.18.0 to be already installed.

Custom Room Storage with SFS2X 2.18

Since the release of SmartFoxServer 2.18 we have introduced a way to override the default implementations for the Room Persistence API so that they can be customized to your needs.

Prior to this release we provided a file-based and a relational database-based storage mechanisms that could be used in conjunction with the API to save the state of multiple active Rooms.

With the new release you can now create your own storage implementations and plug them into the Persistence API. In this short article we’ll walk you through what has changed and how you can create a custom storage class.

Continue reading

SmartFoxServer 2.18 is out!

We have just released SmartFoxServer 2X 2.18.0, which provides several library updates, new runtime, support for M1 Macs, extra features and bug fixes.

Please note: the new release comes as a standalone installer so it can’t be used to update a previous instance.

» Get the new SmartFoxServer 2.18.0 installer from our download section.
» Read the full release notes here.

Load Balancing SmartFoxServer 2X with HAProxy

In this article we are going to explore several ways to use the open source HAProxy load balancer in conjunction with SFS2X, to increase the scalability and availability of a multiplayer project.

We are going to show different configurations for TCP and Websocket connections and several ways to setup the system for common use cases.

To get the most out of this tutorial we require a basic knowledge of what a Load Balancer is and how it works, and some familiarity with the basics of networking and the OSI Model.

Continue reading