- Home /
Authoritative Server help
How do you do simple commands to clients from a server?
I have a simple chat room set up and I'd like for my player to send his name to the server and the server sends the name to the chat room. I have logging in and the server setup already but I feel it's very unorganized. What's an easy way to implement this?
RPC's are probably what you want, if your using the normal inbuilt networking
Well yeah, but I need to know how to structure it..would I spawn a playerobject into the lobby scene and have that object send rpcs to a seperate Network object in the lobby? It's so confusing.
Okay let's say I have a Chatroom gameobject, a Player gameobject and a server gameobject. Now depending on what you choose, you enter the chat as either the server or client. How would I tell the server my clients name and add it to a list in the chatroom?
Just send a couple RPC
's to the clients.
It's quite simple:
Client connects
Client sends server informaion
Server sends all other clients information and adds that client to a list
Server sends that client all other information
I understand that I need to use RPC's, i'm asking for an example of one class calling an rpc to another class.
Answer by Ashkan_gc · May 31, 2013 at 09:24 AM
Basiclly if the chat room is public only then you can have a chat room manger script attached to a networkview. Then have RPCs like SendChatMessage OnMessageReceived(string msg,string userName) Login(string userName,string passwordHash)
On client and similar stuff on server to get Messages from a user and send it to all others.
Just use standard code organization techniques.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Most efficient way to structure a huge online "virtual world" 0 Answers
Player falls through plane/floor (Multiplayer) 1 Answer
Network.player giving me 0 0 Answers