Hi all,
I’m trying to figure out how networking works. I’ve got some of the basics working but have some questions. What I have working is:
- Hosting a game (creating a server, accepting clients)
- Joining a game (getting a list from the master server, connecting to a game)
- Chat (a very simple chat works, basically a c# version of what is in the networking demo)
- Loading a map (a server RPC, allbuffered, at the start takes care of this)
- Creating a local player (from the hosting computer works.)
My big question is this:
How can I call a RPC on a single client from the server? It looks like my only options are “to the server only”, “to everyone but me” and “to everyone”
What I’m looking to do is have the server do something like this:
void OnPlayerConnected (NetworkPlayer p)
{
_playerCount++;
_chat.SendChat("Server", "Player joined the game");
p.RPC("CreateLocallyControlledObject");
everyoneExceptP.RPC("CreateNetworkControlledObject");
}
Maybe I’m missing something? I think I can get around this situation above by having the connection client send a RPC to everyone expect itself to create the NetworkControlledObject… but that takes the server out of the loop and out of control (should I care? Coming from other client/server programming environments the server has always been in control - never trust the client type of thing).
Another situation where a RPC to a single client would be very nice is in private chat messages, or any type of event that only effects a single client.
Any help would be great!
421556–14650–$NetworkServer.cs (1.5 KB)
421556–14651–$NetworkTerrain.cs (1.43 KB)