Using Construct with smartfox server

0 favourites
  • 7 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • 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!!

  • There is currently a multiplayer plugin being developed.

    Follow the thread here: scirra.com/forum/multiplayer-demo-in-c2_topic47724.html

    And yes im sure you can. But i would require some server side scripting.

  • 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.

  • 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:

    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]
    [/code:rgjmirpb]
    
    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?
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You use both. The WebSocket object in C2 is the client side, and the SmartFox object is the server side.

  • 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?

  • Probably. I am not sure how though, as I have never worked with the SmartFox stuff.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)