There can be cases in which one application requires to connect to multiple databases. By default each Zone in SFS2X exposes a single DBManager object but we can create more of these via code, to manage multiple data sources. Continue reading
Author Archives: SmartFoxServer Team
Querying the database and sending resultsets
This recipe shows how to read data from a database and send it to the client in a convenient format. Continue reading
Custom login with database
This recipe discusses the common scenario in which you need to validate the client credentials against the user profiles stored in a database. We will also show how to execute more custom logic right after the login, for example setting User Variables and joining a Room from server-side. 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).
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.
At the end of the process click Submit and restart the server.
How to add new Java libraries or Extension dependencies
Adding new libraries in SmartFoxServer 2X is a breeze. No messing around with the classpath is required: all we need to do is deploy the .jar file(s) in the proper directory and restart the server.
There are two folders that we recommend to use:
{SFS2XRoot}/extensions/{the-extension-name}.
This is where we will typically deploy our main Extension .jar file. The jar file should contain only our Java code without the external dependencies, if any. The reason why the dependencies should be deployed separately is that if they are shared, they will be loaded once for all Extensions that use them.
{SFS2XRoot}/extensions/__lib__/
This folder is recommended for libraries that will be shared by multiple Extensions in your system. For example the “Google Collections” jar, or the Hibernate jar, etc. Do not add your Extension jar to this folder, because the AdminTool won’t ba able to detect it when you setup the Zone/Room configuration.
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!
SmartFoxServer 2X 2.9.0
A new SFS2X update is available with new powerful features and fixes discussed in the support forums recently:
- Improved scalability and thread management via Auto-scaling Thread Pools. No more need to fine tune threads by hand
- BlueBox v3.0: revamped and improved edition running on the latest Jetty 9
- Integrated file uploads
- Added support for websockets over SSL (WSS)
- AdminTool: Extension Manager module, allows to manage, upload and deploy Extensions directly from the Admin GUI
- AdminTool: administrators can now be given access to a selection of modules and server halt/restart permissions
… lots more …
You can read the full release notes and download the installer from here.
Also check the latest HTML5 client API supporting the WSS protocol and the porting of the SpaceWar game to Unity (available in the Unity examples package).
More MMO API goodies!
We have added new articles and tutorials for our latest MMO API, released in SFS2X 2.8.0:
- SpaceWar game tutorial provides a detailed walkthrough to building a realtime action game integrating physics, authoritative server, lag hiding techniques and Area Of Interest to provide a seamless gaming experience for hundreds of players.
- MMO Demo Unity tutorial introduces the MMO API for Unity developers showing the basic concepts and features included in SmartFoxServer 2.8.0.
- Advanced uses of the MMORoom and MMO API provides various advanced tips and tricks for developing with the MMO API on the server side.
SmartFoxServer 2X 2.8.0
A new SFS2X update is available with new powerful features and fixes discussed in the support forums recently:
- New MMO API: provides tools for building vast, large-scale explorable worlds with thousands of players interacting in the same “Room”, non player entities and much much more;
- New Room Persistence API: provides convenient tools for storing game state, personal Rooms, etc, to local files or an external database;
- New updated client API for Flash, Unity, Java/Android, Windows 8 and Windows Phone 8 supporting MMORooms, MMOItems and MMOItemVariables;
- New Flash and Unity examples to demonstrate the latest API.
For an introduction on the new MMO API see this documentation page.
Please follow these links to get the updates:
- SmartFoxServer 2X v2.8 patch update (requires v2.7.0!)
- ActionScript/Java/C# client API updates
- Flash/Unity MMO API examples
If you are an iOS developer make sure to check the latest Objective-C API release, which is now 100% ARC and provides several fixes as requested in the support board.
