Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Infamous on October 16, 2019, 07:35:10 AM

Title: PUN: Specific room custom property Update callback?
Post by: Infamous on October 16, 2019, 07:35:10 AM
Hello friends-

I am making a turn based game with photon where each turn is timed by the master and the timer moves the turns.

During the turn, the players choice is recorded via custom room properties.

Everything works fine, however, sometimes the the master goes to the next process before the server update. It's causing the wrong choice to be processed.

I found the custom event call back "on room properties update" but it doesn't work for my project because there are many room properties to be set during game play.

What I'm looking for is a callback for a specific custom property update.

Is such thing possible or are there any suggestions on how I can prevent this issue during bad or slow connections?

Thanks for the help
Title: Re: PUN: Specific room custom property Update callback?
Post by: jeanfabre on October 17, 2019, 04:19:33 AM
Hi,

you should probably use Check and swap system, where if a player wants to change a property, it also tells the server the value it thinks it is, and if the the value is not the right one, then that means the player is wrong and the property is not updated.

 would that fits for you?

Bye,

Jean
Title: Re: PUN: Specific room custom property Update callback?
Post by: Infamous on October 17, 2019, 04:33:02 AM
Hi Jean,

Could please elaborate more on the “check and swap” setup? Maybe when and how?


From what I understood from you is that when the master timer ends, it’s sends  an event to the same player to “get room properties” and check those results with the local choice, if it matches it tells the master to process, if not it would set it and loop to compare the master until they match.

Is that correct?


Thanks
Title: Re: PUN: Specific room custom property Update callback?
Post by: jeanfabre on October 17, 2019, 04:34:09 AM
Hi,

 make sure you read the doc on this:

https://doc.photonengine.com/zh-tw/pun/current/gameplay/synchronization-and-state#check_and_swap_for_properties__cas_

Bye,

 Jean
Title: Re: PUN: Specific room custom property Update callback?
Post by: Infamous on October 17, 2019, 08:53:37 AM
Hello Jean,

Thanks for the help.

After reading through the documents, it seems like what I need is in this page:
https://doc.photonengine.com/zh-tw/pun/current/gameplay/optimization#send_right_away

It seems like I need to use the “Send Right Away” method.

Can you help by showing where I should add it in the action if I edit it?

I appreciate the help

Thanks
Title: Re: PUN: Specific room custom property Update callback?
Post by: jeanfabre on October 18, 2019, 02:29:57 AM
Hi,

 No, sending right away isn't going to make up for the fact that you may have the wrong data still and that it's coming anytime soon.

Send right away is used when you quit app or leave room for example and you don't want to let photon to go through the usual process of gathering, optimising the data payload etc etc.

Bye,

 Jean