Bathory9's Forum Posts

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok. So the game that is running on the host is used to process gamestate and logic and to validate that the clients don't do illegal moves? From what I understand the game on the host is not played by an actual person, it is only a resident app.

    When I get the right to send PMs I will send you one with my solution thus far. I don't use a relay server, but it might give you ideas.

  • Hello,

    Sorry I can't help you for now but I will attempt something similar in a near future, maybe at some point we can trade tips. I just wondered what is the use of the relay server? Can't the host communicate with the clients directly?

    Thanks

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