Tag Archives: extension

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.

Object serialization between static and dynamic languages

Among the advanced features provided in the SmartFoxServer SDK is the ability to exchange any class instance between client and server with minimal coding intervention. This is particularly useful for statically typed languages such as Java, C# and Actionscript, while dynamic languages such as Javascript are not directly supported.

In this article we’re going to discuss an alternative way to implement custom serialization for classes that are needed from both client and server side to implement our game logic.

If you’re not entirely familiar with the topic of class serialization in SFS2X we recommend reading this article from our documentation Continue reading

SFS2X multi-threading demystified

Often times articles in this blog are inspired by questions and issues raised by our users and this new entry is no exception. One aspect of SmartFoxServer that seems to intimidate developers is the multi-threaded environment behind custom Extensions, and the relative implications in terms of concurrency, scalability and performance.

In this new entry we’re going to demystify the subject and demonstrate how simple and painless is writing server side code, even when many other things are running concurrently. Continue reading

Best of both worlds: SFS2X + server side Unity for realtime games (p2)

In part one of this article series we took a bird’s eye look at various client-server strategies for action multiplayer games. We then highlighted the advantages of running an hybrid solution with SmartFoxServer 2X and Unity on the server side to combine the best of both worlds.

In this second part we’ll be looking at the details of implementing such a solution, the potential difficulties and how to overcome them.

If you have skipped the first article we highly recommend to go back and read it, before you proceed. Continue reading

JavaScript is back!

With the release of SFS2X 2.13 last week we’re happy to reintroduce JavaScript as a server side language. For those familiar with the history of SmartFoxServer, JavaScript has been available since the early days of SFS PRO for writing server side code, and it’s now coming back thanks to the latest improvements in JDK 7 and 8.

Continue reading