Possible addition of "Unreliable" RPCs?

Questions, feedback, feature requests for Photon Unity Networking Plugin

Possible addition of "Unreliable" RPCs?

Postby ubhkid » Thu Feb 16, 2012 8:29 pm

I'm just curious if the subject had been talked about at all. Would be a neat feature to have as I'm an RPC fiend.
ubhkid
 
Posts: 37
Joined: Mon Jan 23, 2012 9:12 am

Re: Possible addition of "Unreliable" RPCs?

Postby Tobias » Fri Feb 17, 2012 1:04 pm

We didn't talk about it so far. It's no problem, we just didn't expose this option.
If you want it asap, go ahead an refactor the RPC method chain starting with PhotonView.RPC.
Exit Games - Lead Client Engineer
Tobias
Exit Games Team
Exit Games Team
 
Posts: 3551
Joined: Thu Jan 07, 2010 11:11 am

Re: Possible addition of "Unreliable" RPCs?

Postby invulse » Fri Feb 17, 2012 11:00 pm

I would like to second this motion!

Unreliable RPC's would allow people to not rely solely on OnPhotonSerializeView for sending serializations, these could change at runtime.
invulse
 
Posts: 15
Joined: Tue Feb 14, 2012 3:45 am

Re: Possible addition of "Unreliable" RPCs?

Postby dreamora » Sat Feb 18, 2012 1:35 pm

You don't need unreliable RPCs if you want to send unreliable datablobs, just expand the PUN implementation and raise events. Thats exactly what they are for.

RPC is by definition reliable, if its not its no RPC anymore but some overcomplicated way to send data, because the whole point of RPC is to execute a function at a remote point (hence Remote Procedure Call), if the function isn't called for sure or not meant to, you never should have used RPCs at all but just send unreliable datablobs which in Photon are called Events
Disclaimer: I'm not part of the ExitGames staff. I'm just another user like you :)

More from me can be found on my game development blog and my twitter stream
Portfolio & contact
User avatar
dreamora
 
Posts: 1076
Joined: Thu Jan 14, 2010 1:42 pm
Location: Switzerland

Re: Possible addition of "Unreliable" RPCs?

Postby invulse » Mon Feb 20, 2012 7:10 am

Your getting stuck on the definition of RPC. I honestly don't care what its called, but a simple way of sending a message to a designated function, which right now is using the [RPC] declaration and .RPC() method, and being able to have it unreliable would be a great addition. I can understand why "RPC"s should always be reliable, but if there is a simple way to implement unreliable RPC's in Photon, and it would come in handy for some users, why not implement it?
invulse
 
Posts: 15
Joined: Tue Feb 14, 2012 3:45 am

Re: Possible addition of "Unreliable" RPCs?

Postby Tobias » Tue Feb 21, 2012 11:32 am

I have to agree that unreliable RPCs are against the expectations you (should) have with RPCs.
On the other hand, it's technically possible to use unreliable communication for RPCs, too. Cause each player's connection is (independently) unreliable, a call might execute on any number of "other" players: none up to all.
In Photon, you can expect this behavior from "events".
RPCs are just special (reliable) events you send in PUN and which are used to identify game objects and call methods on those.

I would like to know more about the usecase you think about. Unreliable RPCs would be useless to trigger actions for multiple players. A door might or might not open. At the same time, you certainly don't want to send "door is open" repeatedly to be able to use "unreliable RPCs".
As far as I can see, unreliable data makes sense only for position or health or in general: values that get updated soon, so it doesn't matter if individual updates are missing. This can be done by observing a script. Set it to "unreliable" and observe a script that puts relevant data into the stream.

What's your usecase?
Exit Games - Lead Client Engineer
Tobias
Exit Games Team
Exit Games Team
 
Posts: 3551
Joined: Thu Jan 07, 2010 11:11 am

Re: Possible addition of "Unreliable" RPCs?

Postby invulse » Tue Feb 21, 2012 9:27 pm

I actually have a very specific usecase that came up recently that I needed to create a crazy workaround for.

In my current game, AI players are spawned and controlled by a client. However the control of this AI player can change from client to client depending on certain circumstances. The ai currently uses OnSerializePhotonView to synchronize positions unreliably, but since PhotonViews cannot change ownership, I cannot simply change who is sending and who is receiving for the OnSerializePhotonView callback. If I had the ability to use an "Unreliable" RPC I could simply not use the OnSerializePhotonView callback and just call an unreliable RPC on whichever client is currently controlling the character, and it would send its serialization data to all other players.

What I had to do to work around not being able to send unreliable messages like this, is whenever an AI player is spawned by a player, the remote client who received the network instantiate message would then create a "proxy" controller for this character with PhotonView that is owned by that remote client. Then when a switch of control happens on a character, some RPC's are fired to cause change of ownership and the original PhotonView that was controlling this player is turned off and the proxy is enabled and takes over serializing and synchronizing positions.

As you can see with the addition of unreliable RPC's I could skip this "proxy" step completely and the whole thing would be alot easier.
invulse
 
Posts: 15
Joined: Tue Feb 14, 2012 3:45 am

Re: Possible addition of "Unreliable" RPCs?

Postby dreamora » Thu Feb 23, 2012 9:34 am

What you have there is not really a usecase for unrealiable RPC but for View Owner Transfer :)
It would be a very good case against unreliable RPCs as it seems that you send quite a bit of data and going with RPCs would be a major performance delta.


Also what prevents you from doing just doing Owner Transfer?
Photon is not Unity Networking, you have the whole source of the 'Unity Networking alike layer' right in your unity project and can change this aspect as you see need for it, including ownership handling :)
Disclaimer: I'm not part of the ExitGames staff. I'm just another user like you :)

More from me can be found on my game development blog and my twitter stream
Portfolio & contact
User avatar
dreamora
 
Posts: 1076
Joined: Thu Jan 14, 2010 1:42 pm
Location: Switzerland

Re: Possible addition of "Unreliable" RPCs?

Postby invulse » Thu Feb 23, 2012 6:55 pm

I do think change of ownership would be a good idea. Considering players can leave at any time and spawned entities from other players who have left become unusable after they are gone.

However I am wondering why RPC's that are sent unreliably would have any more overhead than using OnSerializePhotonView? After looking through the code quickly, it appears that both RPC's and OnSerializeNetworkView end up just invoking OpRaiseEvt with the same arguments, but RPC's are always marking send reliably as true, whereas OnSerializeNetworkView has the option to send reliably or not. The only difference that RPC's and OnSerializeNetworkView appear to have is that RPC's can go to specific functions where as OnSerializeNetworkView always calls the same call back function.

I am probably going to refactor the networking solution just a bit to add one more option for RPC's to send them unreliably, but I was hoping I could stay away from that as I want to update with new releases without having to refactor each time and make sure it works.
invulse
 
Posts: 15
Joined: Tue Feb 14, 2012 3:45 am

Re: Possible addition of "Unreliable" RPCs?

Postby dreamora » Thu Feb 23, 2012 11:02 pm

Actually porting this kind of changes is rather simple and straight forward.
We expanded PUN to have UDP -> TCP fallback (in case the client side has UDP blocked in some form) among other things.

Sure it takes some time upgrading the stuff again but its no day-night difference and nothing compared to porting server side changes ;)
Our case just is different in the sense that we don't use the cloud but an own slightly modified LoadBalancing backend
Last edited by dreamora on Thu Feb 23, 2012 11:37 pm, edited 1 time in total.
Disclaimer: I'm not part of the ExitGames staff. I'm just another user like you :)

More from me can be found on my game development blog and my twitter stream
Portfolio & contact
User avatar
dreamora
 
Posts: 1076
Joined: Thu Jan 14, 2010 1:42 pm
Location: Switzerland

Next

Return to Unity Networking Plugin (PUN)

Who is online

Users browsing this forum: goksanguner, Google [Bot], Yahoo [Bot] and 2 guests