Hey guys!
Ok i’m just a hobby coder and not that experienced! But i decided to go one step further and try a “simple” network card game. Okay … i thought it would be good idea to make a SERVER and a CLIENT script within the same project … to server just manages the game states and sends infos out to all clients! Here i have to say that i thought its a good idea to treat the game hosting player as server AND player, because its not a dedicated server. So the Player which is the server has the SERVER and the CLIENT scripts attached. And here come my problems …
- The HOST player is not in the connected player list so it seems not to work to let the Server send our a RPC call to itself via the networkplayer adress
this is my server code
public void DistributeCardToPlayer(Networkplayer nwp, BaseCardClass ca)
{
//RPC call to the specific networkplayer -> Sending cardID as (int)
networkView.RPC ("GetCard", nwp, ca.cardID);
}
AND the client Code:
[RPC]
public void GetCard(int cardID)
{
BaseCardClass card = BaseDeckClass.GetCardByID(cardID);
GameInformationHandler.localPlayer.player.DealCard (card);
}
with this i’m constantly etting this error message:
Can’t send RPC function because the target is not connected to the server.
which information does networkplayer hold exactly? How does it differentiate the different players? i’m testing this from multiple unity3d instances at the same machine. Is that maybe a problem? When i convert networkplayer to string i just get an ID
Is that thinking right (in theory) to send the information only to the specific player? Or should i send it to ALL players and then find out which one is the right one?
Thank you VERY much, i hope its not a that stupid queistion :S