0

I have downloaded and started the community version of SFSx2. I read everything on their documentation page:

http://docs2x.smartfoxserver.com/DevelopmentBasics/introduction

Which unfortunately only talks about flash client side code. Nothing about the corresponding server side code, nor about html5 client side which I need.

I downloaded the HTML5 examples, which took me a long time to find (they are here: http://www.smartfoxserver.com/download/get/140 )

None of the examples work, as they can't connect to the server. Presumably, this is because the examples only supply client side code. There are no instructions supplied on how to install or run the examples.

I can find no mention on the smartfox documenation on the following: 1) what language is used on the server side. One assumes its java. 2) how does one deploy java code to the smartfox server? I cant find any mention of this in the docs. 3) how does one find and install the server part of the client side examples (which are Tris, GameLobby, BuddyMessenger, AdvancedChat).

I applied to be allowed to post on the smartfoxserver forums, but no reply yet.

Donal Lafferty
  • 5,807
  • 7
  • 43
  • 60
John Little
  • 10,707
  • 19
  • 86
  • 158

2 Answers2

0

I also found it hard so I share what I've found out.

The server extensions are written in Java. I used Eclipse JUNO to write my code. You can download Eclipse here. http://www.eclipse.org/downloads/ You export the extension in jar format from eclipse into you extension path. The name of your file has to end in 'extension' eg MyFirstExtension.jar otherwise sfs2x wont recognize it. Your extension path will be something like this: C:\Program Files\SmartFoxServer2X\SFS2X\extensions\MyFirstExtension\MyFirstExtension.jar if your working in windows.

You will find docs on JAVA API here. http://docs2x.smartfoxserver.com/api-docs/javadoc/server/

This is a link to the basic example code: http://www.smartfoxserver.com/download/get/120
Unzip the content into the [SFS2X_install_folder]/SFS2X/www/root/examples folder, overwriting the existing file. Run the index.html file, then navigate to another index.html to open the example. Run the sfs2x-standalone.exe first of course(see below). If you followed the 'server configuration tutorial' on smartfox website and changed the server ports, the examples wont work. Leave the ports alone until you start to understand the server.
This is a link to the flash example code: http://www.smartfoxserver.com/download/get/108 You will find the example code for apps mentioned above. They are written in Adobe Flash Builder and Java extensions. I don't know if there is any code for HTML5 but the Java server code and AS3 is there.

I also found that using the standalone server was the way to go rather than using SFS2x as a service. c:\program files\smartfoxserver2x\sfs2x\sfs2x-standalone.exe. Using the exe gives you the command prompt window. You can use the window for debugging and see the state of the server when it starts.

Most of the examples should work without creating extensions but to create an extension out of source examples: Create and setup a new project in your Java IDE. You will have already set up a workspace. Copy the content of the /source/server/src folder to your project's source folder. Add SFS2X Libraries. Go to properties of the project -> Select Java Build Path -> Click Library Tab -> Add external jar. Add 'sfs2x.jar' and 'sfs2x-core.jar' from C:\Program Files\SmartFoxServer2X\SFS2X\lib folder. To create the extension, export jar file to extension path. Restart server.
Another problem I had was the Java Version I was using. I had to use Java1.6 with my version of sfs2x when writing extensions. This was trial and error as there was no documentation. There may be a newer version out now.

I had to copy all the server source into eclipse to try and understand how things were done. It was a way of having all the code in one place. There was a lot of trial and error as getting help is hard. I eventually accomplished what I set out to achieve. Good Luck.

0

SmartFox Server is easy to use even with extension. documentation Give try to Nuggeta solution for game development too. No extension needed at first. This is optionnal. We have full HTML5 open source game walkthrough on github