Okay, this is baffling and I’m hoping that I’m wrong - someone please set me straight if so.
There are 2 basic methods to send data across the network in Unity
NetworkView synchronization
RPC
Okay fine great.
BUT, why does each one only provide half of what I need to just send unreliable UDP packets?
If I use network views with ‘unreliable’ set and a custom OnSerializeNetworkView implementation then I can send packets unreliably (or so it seems). However, all late joining clients receive a buffered history of old messages? WTF? It’s unreliable right? Yes, but clearly each new joiner needs 5 second old position data. NO! But surely I can set a parameter to discard history? NO?!
If I use RPCs then I can get rid of the buffering. BUT RPCs are only reliable?!!!
Why Unity, why?
Or, like I said, someone just set me straight.
I know that I can write my own sockets to deal with this but that’s utter crap. Unity is already doing the work to punch through the NAT and set up a session for me with Raknet. Why should I have to repeat that just to piggyback on the underlying network sockets and send some unreliable unbuffered data?
function Awake () {
// Start by switching state synch mode (before any networking is started).
networkView.stateSynchronization = NetworkStateSynchronization.Unreliable;
}
Thanks for trying to answer my question – but I’m afraid I don’t understand your answer. I think you are just repeating one of the methods I listed, which doesn’t help. Are you implying that setting this parameter will make RPC calls unreliable? I didn’t see any documentation that would indicate that. Or does putting this code in place somehow get around the issue of having old buffered unreliable network accumulate? Doesn’t seem likely but please clarify.
RPCs can’t be made unrealiable.
As the name implies its a “Remote Procedure Call”, which are by industry definition always reliable, potentially even ordered.
If you just want to send a UDP message you will have to use the UDP Socket or something that builds upon it within System.Net which means making use of .NETs socket and network support instead of relying on the support unity provides primarily for “many clients - 1 server” game support
yeah, i’m getting the idea that what i want isn’t possible (or i already had that idea and wanted to be proven wrong), but it is frustrating. the framework is already set up in unity to allow this and i don’t understand why they block access to simple unreliable message send. as explained above, there are good reasons to want to use unity’s network layer for this. i also don’t understand why if you explicitly mark a networkView as unreliable that they buffer up some huge amount of back data and send it across to new connections. that seems counterintuitive and NOT what i expect most people want for things they mark unreliable.