Jump to content
Sign in to follow this  
Frizikpro

Tales of pirates unity 3d

Recommended Posts

Hello pirates and all fans of our game.  I want to create a theme so that people share in this group with their own time.  Of course I do not know what right now with the game.  So I would like to see a job.  Well, those who made the game on unity or on any other.

Edited by Frizikpro
  • Like 1

Share this post


Link to post
Share on other sites

NETWORK SYSTEM <==

Este é o inicio a base de um servidor em unity, é bem simples e obvio que deve ser melhorado, mas é uma base solida, tora simples a comunicaçao em rede especialmente feita pra suportar um mmorpg, a forma de usar é simples(tem exemplos neste arquivo) mas basicamente voce escreve um methodo no arquivo

 

This is the beginning of a unity server, it is quite simple and of course it should be improved, but it is a solid base, but simple network communication specially made to support a mmorpg, the use is simple (there are examples) in this file) but basically you write a method to the file

 

client -> Commands  

public void sChat(string text)
    {
        string[] msg = { "rChat", text };
        con.SendToServer(msg);
    }

 other in servidor -> serverCommands   (receive message from client)

public void rChat(string[] msg, ServerClient client)
    {
        string message = msg[1];
        string clientName = client.clientName;
        sChat(message, clientName);
    }

and in serv -> servercommands  (send message to clients)  **** use serv.sendToClient(msg, specific cline ServerClient) to spesific client kk

private void sChat(string message, string clientName)
    {
        string[] msg = { "rChat", message, clientName };
        serv.SendToClient(msg);
    }

 

again in clinet -> commands (client recie command and parameters)

public void rChat(string[] msg)
    {
        Debug.Log("rChat");
        string text = msg[2] + " Say: " + msg[1];
        Chat.instance.ReadNewMsg(text);
    }

e pronto todos os clientes vao receber este ultimo metodo, eu uso "chat.instance.ReadNewMsg(text)" para colocar a mensagem no chat

and all customers will receive this last method, I use "chat.instance.ReadNewMsg(text)"  to put the message in the chat.

 

client.rar and serv.rar is a demo

Edited by XXD

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...