Tag Archives: sfs2x

How to send an email from an Extension

Emails can be sent directly from your server side code in order to provide registration confirmations, updates or even debugging and stats reports.

In order to enable email sending you will need to setup the Emailer Service from the AdminTool: from theServerConfigurator choose the Emailer tab, turn on the service and set your SMTP parameters. Continue reading

How to schedule timed tasks in an Extension

Often times in the server-side game logic it is necessary to use timers for recurring events that are sent to the clients (e.g. the end of a turn time, npc actions, etc).

A quick solution to this problem is using the ScheduledThreadPoolExecutor class, provided in the JDK, which offers a convenient task executor backed by a pool of threads. SFS2X already runs its own instance of this Executor (wrapped in a class called TaskScheduler). Continue reading

How to create an Extension based custom login

Implementing a custom login on the server-side is a simple process. SFS2X fires the following two login events.

  • USER_LOGIN: fired when a client requests to join a Zone. Here we can validate the client credentials and decide if the User can continue the login process. At this stage the client is represented by a Sessionobject, not by an SFSUser object yet.
  • USER_JOIN_ZONE: notified when a client has successfully joined a Zone (and is turned into an SFSUser).

Continue reading

How to setup a connection to an external Database

SFS2X allows connecting to databases in a way that is very similar to its predecessor. All you need to do is downloading the JDBC connector from your Database vendor (e.g. MySQL or MSSQL) and drop the .jar in the {SFS2XRoot}/lib/ folder.

Of course if you use ODBC instead of JDBC you can even skip the driver deployment step. In fact the ODBC driver is already provided by the Java Runtime.

The following is a list of pages where you can find the JDBC drivers for the most common RDBMS:

The next step is running the SFS2X AdminTool, launch the Zone Configurator module, select your Zone and finally click on the Database manager tab to edit the configuration.

db setup dialog

At the end of the process click Submit and restart the server.

Celebrating 10 years!

Ten years ago, in late November 2004, we launched our first commercial version of SmartFoxServer, the Basic edition, which was soon followed by the PRO version in early 2005.
To celebrate the 10 years of activity, and in conjunction with the holiday season, we’re happy to announce an amazing 20% discount campaign on all licenses and license upgrades available in our online store.
The promotion will last until the end of 2014 and it will cover all our server products, including:

  • SmartFoxServer Basic
  • SmartFoxServer PRO (including BlueBox add-on)
  • SmartFoxServer 2X (including Analytics add-on)

Visit our online shop to see all the discounted prices, and make sure to take advantage of this unique offer!