playMaker

Author Topic: Photon + ArrayMaker - syncing an array  (Read 2701 times)

jess84

  • Hero Member
  • *****
  • Posts: 515
Photon + ArrayMaker - syncing an array
« on: November 14, 2015, 02:02:36 PM »
Hi,

So I'm working on a scene with multiplayer gameplay, and I'm using Photon. Everything is sync'd and working properly.

I'd like to have a object with an Arraymaker array on it, and use that to keep track of an array list. What's the best way of making sure that the array is updated on all clients when the array list is added to / has an item removed. (which could be from any of the 4 players connected)

I don't really want to be sending messages / RPC calls to all players, as that will get complex and messy - is there a way of doing this?


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon + ArrayMaker - syncing an array
« Reply #1 on: November 16, 2015, 07:47:05 AM »
Hi,

Uh, that would be an interesting feature, but quite problematic to cover all cases.

If you need to share some data between the players, use the room properties, this is going to be a lot more efficient, rooms properties will persists during the room lifetime and the integration has all the feedback and listeners to deal with room properties.

Bye,

 Jean

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Photon + ArrayMaker - syncing an array
« Reply #2 on: November 16, 2015, 06:03:01 PM »
Hi,

Would it really be that problematic?  All I'd want was: On Array Change - Make sure all players see that change.

On the surface, it sounds pretty reasonable.

My problem at the moment is that if a player uses ArrayList Add, then I have to send network messages to the other players AND the text of what has changed, and then update the array on all players. That seems pretty inefficient and prone to problems.

Array Lists are awesome, but I just can't figure out a good way to share this with all players. (If I've got a bunch of strings on the array, I don't see how Room Properties is an adequate solution)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon + ArrayMaker - syncing an array
« Reply #3 on: November 18, 2015, 04:53:26 AM »
Hi,

 yeah, you are right, saving arrayLists isn't ideal with room properties as is ( within PlayMaker supported custom actions for Photon, cause photon rooms properties can host any types of data including arrayLists, if done in c#).

I don't have a ready solution for this unfortunatly. what's coming up when 1.8 will be out is support for the turn based photon server in PlayMaker, and I worked a lot with ArrayMaker for this, and so I'll be transfering what I can from this project back to Photon realtime solution over time. So it's coming :)

and, indeed it's not trivial, because I need to account for all types of variables that can be stored in an ArrayList, making serialization a nightmare... so indeed not that easy as it seems to support, unless a c# guru steps in with some tricks :) I would appreciate this so much :)

 Bye,

 Jean