Page 1 of 1

Serialization in smartfox

Posted: 04 Sep 2013, 05:56
by veeru.srinivas
Hi,

I am new to Smartfox server. I am developing a turn based game using Smartfoxsever. I am able to run application for two players it means single room
I am unable to write extension for dynamic room creation at server side .Please suggest the approach or provide source code...


Thanks & Regards

Veeru

Re: Room creation

Posted: 04 Sep 2013, 08:16
by Lapo
Hi Veeru,
writing an extension is pretty simple. You can follow this video tutorial:
http://www.youtube.com/watch?v=nKGxhwJ0Ccc

And of course there's tons more in our documentation mini-site:
http://docs2x.smartfoxserver.com/Develo ... extensions
http://docs2x.smartfoxserver.com/Develo ... ension-api

Hope it helps

Re: Room creation

Posted: 04 Sep 2013, 12:36
by veeru.srinivas
Hi,

Thanks for reply!!!!

I am having idea of creation of extensions i have created an application which is able handle single room i wanna help regarding Dynamic room creation..

Thanks
veeru.

Re: Room creation

Posted: 10 Sep 2013, 02:43
by rjgtav
Hi,

I'm sorry but you have to provide further details.
When do you want to create those new rooms dinamically?

In the meantime, you can check the SFSApi class of the Java Server API Documentation, as it contains the createRoom() methods which are responsible for creating a room whenever you want.

Cheers

Re: Room creation

Posted: 10 Sep 2013, 07:11
by veeru.srinivas
Hi,

Thanks a lot for reply !!

Now i got the idea of dealing with dynamic room creation

Thanks & Regards
Veeru

Serialization in smartfox

Posted: 20 Nov 2013, 10:44
by veeru.srinivas
Hi,

I am trying to use smartfox server serialization concept which was given in ..http://docs2x.smartfoxserver.com/Advanc ... ialization..
I am able to send data to the client side but while receiving data from client to server side java i am getting "Error deserializing request: com.smartfoxserver.v2..." classNotfound exception . I have followed all the steps given in sfs2x documentation... please provide me solution.

Thanks in Advance,
Regards ,
Veeru.

Re: Room creation

Posted: 20 Nov 2013, 10:47
by Lapo
Please post the full stack trace of the exception and also specify which client API language you are using.
Also post the code of the classes that you are sending, at least the one that is failing to deserialize.

Thanks

Re:serialization problem in smartfox

Posted: 20 Nov 2013, 12:35
by veeru.srinivas
Hi ,

I am using Java for server side and AS3 for client side.

This is i am finding in my logs :
17:27:29,648 WARN [SocketReader] protocol.SFSProtocolCodec - Error deserializing request: com.smartfoxserver.v2.exceptions.SFSRuntimeException: java.lang.ClassNotFoundException: sfs2x.extension.test.serialization.model.WaterFloodSpell

After this nothing is executed..


Java code:
package sfs2x.extension.test.serialization.model;

import com.smartfoxserver.v2.protocol.serialization.SerializableSFSType;

public class WaterFloodSpell implements SerializableSFSType
{
String id;
int hitPoints;
int count = 7;

public WaterFloodSpell()
{

}
public WaterFloodSpell(String id, int hitPoints)
{
this.id = id;
this.hitPoints = hitPoints;
}

public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public int getHitPoints()
{
return hitPoints;
}
public void setHitPoints(int hitPoints)
{
this.hitPoints = hitPoints;
}

public void setCount(int count)
{
this.count = count;
}
public int getCount()
{
return count;
}


}

AS3 Code:

Code: Select all

package sfs2x.extension.test.serialization.model
{
    import com.smartfoxserver.v2.protocol.serialization.SerializableSFSType
 
    public class WaterFloodSpell implements  SerializableSFSType
    {
        private var _id:String
        private var _hitPoints:int
        private var _count:int
     
        public function WaterFloodSpell(id:String=null, hitPoints:int=70)
        {
            this._id = id
            this._hitPoints = hitPoints
        }
     
        public function get id():String
        {
            return _id
        }
         
        public function set id(id:String):void
        {
            this._id = id
        }
         
        public function get hitPoints():int
        {
            return _hitPoints
        }
         
        public function set hitPoints(hitPoints:int):void
        {
            this._hitPoints = hitPoints
        }
         
        public function get count():int
        {
            return _count
        }
         
        public function set count(value:int):void
        {
            _count = value
        }
 
       
    }
}
Thanks & Regards
Veeru.

Re: Serialization in smartfox

Posted: 25 Nov 2013, 06:43
by veeru.srinivas
Hi,

I am waiting for reply i have posted the information.. Am i doing any wrong...?


Thanks,
Veeru.

Re: Serialization in smartfox

Posted: 25 Nov 2013, 08:45
by Lapo
In order for the model classes to be found by the SFS deserializer they need to be deployed in the extension/__lib__/ folder.

All the details are explained in the documentation:
http://docs2x.smartfoxserver.com/Advanc ... ialization
See the "Deploying the Extension" section at the bottom.

Hope it helps

Re: Serialization in smartfox

Posted: 28 Nov 2013, 06:30
by veeru.srinivas
Hi,

Thanks for reply !!!!! Its working fine ...
could you pls provide the tris game java server side source code.
Regards,
Veeru.

Re: Serialization in smartfox

Posted: 28 Nov 2013, 08:03
by Lapo
The server code is already provided with the example.

cheers