Using Construct with smartfox server

Get help using Construct 2

Post » Sat Jan 14, 2012 10:32 pm

Might be a stupid question but was just wondering can i use smartfox
server with construct 2. Was just wanting to use chat with the game im developing, but multiplayer would be nice. thanks for all answers!!
B
15
S
4
G
4
Posts: 28
Reputation: 3,732

Post » Sat Jan 14, 2012 10:42 pm

There is currently a multiplayer plugin being developed.
Follow the thread here: http://www.scirra.com/forum/multiplayer-demo-in-c2_topic47724.html

And yes im sure you can. But i would require some server side scripting.
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Sat Jan 14, 2012 10:45 pm

You can use websockets to communicate with any server supporting them.

For now you must go through custom plugins to add them, but if you are comfortable with those, you can use pretty much any server you like.

There is also this plugin to build chat applications.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Tue Jun 28, 2016 12:28 am

Hello,
This is an old thread but I'm curious if the OP was ever successful at making Smartfox "talk" with Construct 2.

I've been using Smartfox server for years with Flash only as client. Now I would like to publish to every platform without making too many changes to the server side code. Construct 2 seems like the right tool. From what I understand I need to create a Smartfox object that I will put in the <install path>\exporters\html5\plugins directory.

The Smartfox team provides a client API under the form of a .js file, the first lines look like this:

Code: Select all
SFS2X=
{
    SmartFox:
    function(a)
     {
        this._majVersion=1;       
        this._minVersion=2;       
        this._subVersion=0;       
        this._socketEngine=new SFS2X.SocketEngine;       
    [i]    .........[/i]
        this._controllers=
        {
           
        }
        ;
       
        this._initialize();
       
        this._log.info("SmartFox instance ready!")
    }
}
;

SmartFox=SFS2X.SmartFox;

SFS2X.SmartFox.prototype.addEventListener=function(a,b,c)
{
   
    this._eventDispatcher.addEventListener(a,b,c)
}
;

SFS2X.SmartFox.prototype.removeEventListener=function(a,b)
{
    this._eventDispatcher.removeEventListener(a,b)
}
;

SFS2X.SmartFox.prototype.setClientDetails=function(a,b)
{
    this.isConnected()?this._log.warn("SetClientDetails must be called before the connection is started"):(this._clientDetails=null!=a?a.replace(":"," "):"",this._clientDetails+=":",this._clientDetails+=null!=b?b.replace(":"," "):"")
}
;

SFS2X.SmartFox.prototype.connect=function(a,b,c)
{
  [i] ......      [/i] 
}
[u].....[/u]


etc, it defines many other functions for communicating with the server. I believe I have to convert their file so it becomes a runtime.js file (based on the plugin template), but I'm not sure. If I do that, then I will not be using the WebSocket object but only the Smartfox object, right?
B
4
S
1
Posts: 4
Reputation: 308

Post » Thu Jun 30, 2016 6:12 pm

You use both. The WebSocket object in C2 is the client side, and the SmartFox object is the server side.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
18
S
5
G
1
Posts: 1,144
Reputation: 4,066

Post » Sat Jul 02, 2016 1:24 pm

Thank you. Usually, when using a Smartfox object on the client side you can listen to events such as room variables update or extension responses, so I understand it's possible to define those events within a C2 WebSocket?
B
4
S
1
Posts: 4
Reputation: 308

Post » Mon Jul 04, 2016 4:11 pm

Probably. I am not sure how though, as I have never worked with the SmartFox stuff.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
18
S
5
G
1
Posts: 1,144
Reputation: 4,066


Return to How do I....?

Who is online

Users browsing this forum: Gunter and 29 guests