-What are the rules of RFC numbers?
-I would assume they need to be unique per script, but what about across the project?
-What about RCCs? Do they share the same pool? If so, why are RFCs bytes and RCCs ints?
My first remote function anything was an RCC:
public enum EMessageType : byte
{
//1 I think is for syncing rigid bodies.
createPlayer = 243, //me now trying random values
playerUpdate = 3
}
internal void SpawnPlayer(Vector3 position, Quaternion rotation, string faction)
{
TNManager.CreateEx((int)EMessageType.createPlayer, false, player, position, rotation, faction);
}
[RCC((int)EMessageType.createPlayer)]
private void OnSpawnPlayer(GameObject prefab, Vector3 position, Quaternion rotation, string faction)
{
GameObject go = (GameObject)Instantiate(prefab, position, rotation);
CPhysicsPlayer player = go.GetComponent<CPhysicsPlayer>();
Debug.Log("this is working? " + player.name);
}
Which seemed to work fine for a while, until I added my first RFC in a different script:
To call it:
if (myTNObject.isMine)
{
myTNObject.SendQuickly((byte)CNetworkManager.EMessageType.playerUpdate, TNet.Target.OthersSaved, forwardInput, strafeInput, primaryInput, secondaryInput, useInput);
}
The function it is calling:
[RFC((byte)CNetworkManager.EMessageType.playerUpdate)]
private void Receive_Update(float forwardInput, float strafeInput, bool primaryInput, bool secondaryInput, bool useInput)
{
this.forwardInput = forwardInput;
this.strafeInput = strafeInput;
this.primaryInput = primaryInput;
this.secondaryInput = secondaryInput;
this.useInput = useInput;
}
Now I have been swimming in "parameters don't match" Hell for an hour (it's like Windows 9X all over again with DLLs!). I assumed the worst case scenario and made all IDs unique across all my scripts.
I have deleted the server.dat I found, and I have yet to see another one.
I have restarted the stand-alone server multiple times.
Once I switched my SpawnPlayer to a random number, it resumed working without any parameter issues, except now none of my objects synchronize movement anymore.
What in the world is going on?!?! All I am trying to do is spawn one player prefab per player and have them move, but this is like pulling teeth.
Thanks in advance. I am sure it's something I'm doing wrong, but I feel like documentation is rather scant on the particulars.
EDIT: Well, I gave up on the RCCs and my objects' movement is synchronizing again. I have been wandering the forums and it was hinted that the RCCid is actually the ID given to the TNObject upon instantiation? If that's the case, how does it now which RCC function to call? Eventually I will need to do RCCs again, but at least I can make some progress in other areas, such as proving my primitive prediction works beautifully.