Hi there,
I just want to confirm something with in the Photon RPC() call.
Firing this function will contact any photonview object ands it following script, and function inside. Yes?
The reason I ask is because my tests do far are only showing remote objects are called. Not local. Meaning, I fire myLocalPlayer.photonview.RPC(“doThis”, PhotonTaegets.All); & the result only seems to be passed to remote objects, not another local across the network. Am I dreaming???
My evidence is this, I have a two player multi player game. At player x wins, fire RPC(). The receiving function needs to ask if a manager is assigned, this is to prevent an error since a remote object will have no player manager (player controller). So I ask, if (mng) doThis().
The only objects returning are those with no mng. Do only remote.
If you select all as target every photon view will execute the remote procedure call, scene views won’t be called until you send with scene view. Why would you call some thing that is extra marked with “Local”?. I don’t see any sense there.
The error must be somewhere in your setup or code and it’s near impossible to list all options that might go wrong (beginning by “are both in the same room” to “did you load a scene on the second client, while in the room” and on and on).
Please work take a step back and work through the Marco Polo Tutorial, which explains using RPCs. If you do things that way, it will work and you can apply it to your case.
I will, but am I correct in assuming RPC calls all objects with a photon view across the network?
ps. The error is logical. If I instantiate player class at start (over photon network), I am creating (in my case), a local player class and his “reflection” on other devices.
The purpose of the reflection is only that, a reflection to the transform. He serves zero functionality. Therefore while he has a player script, he has no player manager (manager == null). On the other hand, the local player class does have a player manager, as it needs functionality (player input etc).
At win round, RPC is fired across the network. In player script I determined that if player manager is null, do nothing as this is a reflection object. If manager is not null, this is the local player, therefore, fire local procedures.
That’s it! But at the moment, if manager is not null (local player), is never reached.
in my player script (MonoBehavior, not using Photon), “GameEventCode” is an error.
so, I decided to place this call into the Multi Manager, which does use Photon and is a Photon.MonoBehavior. However, the same error “GameEventCode”, is not recognized.
-Upon subscribing to an event in Awake or isMasterClient, I am confused as to the arguments I need to pass, and how to pass the arguments I need.
As I understand you want to sync the “RoundWin()” with all players in room. Usually that’s rare event and should be a custom propierty hashtable.
How ever,
In your room inspector is an GameObject that has game manager script component attached and photonView added which will be automatically marked as scene view. Now I don’t know which type your game is but here’s an example:
There are 2 teams “TDM” each player killed will give a team point to the hitter team. So now let’s set the max points to 10.
Now in your room manager script with scene view you check for example:
[PunRPC]
private void GameOver(byte winner)
{
switch(winner)
{
case 0:
// do something team one won
break;
case 1:
// do something team two won
break;
}
}
Thanks,
So I have to run, and I am getting an error I can slove, but am curious as to if my method is correct, so let me explain what I have done differently…
At roundWin(), instead of instructing the winning player’s PhotonView to RPC(“RoundWon”);, I have told player to tell the GameObject with Multi_GameLogic script, to use its PhotonView to RPC(“RoundWoN”);
The only major difference that I can see here is that by passing the RPC call to an object that exists in Awake(), that is not Instantiated across the Network, so has a PhotonView, but is only local.
That’s Scene View, it has nothing to do with players. Master will call game over and all other scene views will get that update. Here you can add your logic to make him leave and close room,set points to database what ever.
Simple in all: Master does check/call/change game state–> other will get the update and leave room or what ever you wanna add there.
Where is the problem? It’s hard to understand you…
Only one client is master in room: the room creator or when he leaves another one will become master. Here we are using it to make sure only one player calls GameOver simple because we need it only one time. If there won’t be any master check, then every player in room will call gameOver and that’s… bad.
I have two players in room. Therefore, On each device I have a local and remote player.
When one player reaches the goal, it sends a message to the local GameLogic. This gameLogic, uses it’s PhotonView to RPC(“RoundWon”, PhotonTargets.All, winningPlayerID);
THATS IT!!!
WHY IS IT NOT WORKING!!!
AHAHAHHHHAHHHHHHHHHHHHHhhhhhhhhhhhhhh
Because it seems like your whole logic is wrong. It’s so damn simple to implement that but you already have problems there. I really suggest you to read first all how it works & general networking architecture. I guess you still didn’t read the whole documentation.