Pages

Monday, February 10, 2014

SSNetwork Demo

Press [ StartServer ] to wait client connection
and then press [ Spawn Wander NPC ] to see what happened

Press [ Client Connect ] to connect server
and then press [ Spawn Wander NPC ] to see what happened

Wednesday, January 8, 2014

SSNetwork



SSNetwork is a super simple network framework based on the UNITY Network. Just use SSNetwork to complete network programming quickly.

The network communication by SSNetwork is:


When you develop a network game, you don't need to use NetworkView and RPC directly. All these processes are managed by SSNetwork.
You just use SSNetwork to register network message and handle it. This way is more clear to help you to complete network programming quickly.

Please see the sample snip code below:

Server side: handle message from client.
UnityNetwork.Instance.RegisterMessageHandler(SSConvert.ConvertCustomEnum<NetworkEvent>(CustomNetworkEvent.TEST_MSG), OnTestMsgResponse);
...
protected void OnTestMsgResponse(MessageObject mo)
{
    TestMsg msg = mo as TestMsg;
    if (msg != null)
    {
        Debug.Log("TestNetwork OnTestMsgResponse: msg=" + msg.msg + "idx=" + msg.id);
    }
}
Client side: send the message to server.
TestMsg msg = new TestMsg();
msg.msg = "Hello World";
msg.idx = 5;

UnityNetwork.Instance.SendServerMessage(msg);

The communication is simply done!! It’s so simple, right:)
For more details, please see the documentation.

It's coming soon on Unity Asset Store!!!