playMaker

Author Topic: PUN: Specific room custom property Update callback?  (Read 576 times)

Infamous

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
PUN: Specific room custom property Update callback?
« on: October 16, 2019, 04: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
« Last Edit: October 16, 2019, 09:49:42 AM by Infamous »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15237
  • Official Playmaker Support
    • View Profile
Re: PUN: Specific room custom property Update callback?
« Reply #1 on: October 17, 2019, 01: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

Infamous

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
Re: PUN: Specific room custom property Update callback?
« Reply #2 on: October 17, 2019, 01: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
« Last Edit: October 17, 2019, 01:37:24 AM by Infamous »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15237
  • Official Playmaker Support
    • View Profile

Infamous

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
Re: PUN: Specific room custom property Update callback?
« Reply #4 on: October 17, 2019, 05: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

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15237
  • Official Playmaker Support
    • View Profile
Re: PUN: Specific room custom property Update callback?
« Reply #5 on: October 17, 2019, 11:29:57 PM »
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