playMaker

Author Topic: Photon Integration Beta [NEW beta3]  (Read 34582 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #30 on: May 19, 2012, 09:59:25 AM »
hi,

 not in front of my dev machine, but will run some tests,

 Have you updated to the latest from photon? I haven't yet, maybe something needs upgrading on the demo too.

 I'll let you know if I could reproduce as soon as I can,

 Bye,

 Jean

justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 227
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #31 on: May 19, 2012, 11:21:32 AM »
Yup latest photon and playmaker beta 1.4.0rc1

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #32 on: May 20, 2012, 12:11:22 AM »
Hi,

ok mixed results :)


I tested on both Unity 3.4 and unity 3.5. I do experience hickups only in 3.5 ( investigating whyt prefs in playmaker could be causing this, cause I don't see what else could create these hickups) and ONLY if the instance is running from the editor, if you publish two apps and run them, you will not have any hickups.

Tho, all players control are fine and consistent, that is no input corruption between players.

Have you modified the scene? It's of course fine and I encourage doing so, just need to know because If you haven't, and I can't reproduce it.

Bye,

 Jean

Swift_Illusion

  • Playmaker Newbie
  • *
  • Posts: 41
    • View Profile
    • Midnight Tinkering
Re: Photon Integration Beta [NEW beta2]
« Reply #33 on: May 20, 2012, 03:13:05 AM »
@Swift_Illusion: We tried to port the demoWorker shipped with the Photon as much as possible in playmaker, and we're glad that it works just as well indeed! It's also allow playmaker to shine and demonstrate how flexible and powerful Fsm's are.

Sure has :D
Speaking of how powerful FSM's are, I've been getting fairly used to the environment now as I developed
a custom character controller and I love the flow and it's flexibility :3.

However on this topic I'm now trying to adapt this to the Photon environment and I'm having a lot of trouble
with an area and I had hoped to be able to ask about this here.
I'm using quite a few global variables that are necessary to send messages between objects,
however it seems when using this character in the multiplayer environment it seems to be sending these
events to both instances of the character (I just replaced the character loading in the demo),
and I'm not sure how I would be able to go about getting and setting necessary global variables,
in a local environment.
Is there any way to go about this, or some other way to send/receive/set/get variables across objects?
I'd really appreciate some advise with this if possible.

justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 227
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #34 on: May 20, 2012, 05:49:55 AM »
@jeanfabre - It looks like running 2 instances of the game fixes that glitching stuttering issue, but the problem with 2 characters being semi controlled at once is still present.

I've made no adjustments to the demo scene or photon, brand new fresh imports

Here's a screen capture demoing the problem

http://www.youtube.com/watch?v=7_w_4b2Lqzo


edit: fixed path

thx
« Last Edit: May 20, 2012, 06:26:29 AM by justifun »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #35 on: May 20, 2012, 06:59:46 AM »
@Justifin, video is set to private, I can't watch it.

@Swift_Illusion,
If the global variables are set to synchronized over the network, then you will need to implement the required logic to know who should read and who should write to this global. Iy that creates problems as to who should read and who should right, then you are missing on the best feature of networking, the "view", Photon View is the way to handle this case. So instead of having a global variable, create a gameObject with a Fsm and a photon View watching this Fsm, in that Fsm create a variable that is synched over the network and read the next chapter on how to work with it ( this is the player set up actually, but this is not just meant for players, it can be anything in your scene).

now, for players, the "is mine" action is the only way to work with variable data being synchronized within a Fsm, one of this instance MUST set it and it is the owner ( "Is Mine" is true), every other instances MUST NOT read this variable and do something to catch up with it ( like the position, rotation and animation sync Fsm).

If you want to send messages, then the chat system is a very good example, and features all the possible ways of sending a message, that is to a player ( the sender will not receive this message), or by group ( ALL, OTHERS, MASTER). so if you want to send a message to everyone but you, use OTHERS, etc etc.

I recommend implementing something similar to the chat system for anything that is not a constant stream of change. Sending one event when necessary is a lot more efficient than having a variable ( global or locale) that is set to synch over the network and never really change every frame.

Hopefully that answers your question. Else, I think it would be good if you explain what you are trying to achieve with these global variables, and we'll be able to provide more useful advices.

Bye,

 Jean

justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 227
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #36 on: May 20, 2012, 09:21:39 AM »
Doh!

Ok fixed the video
http://youtu.be/7_w_4b2Lqzo


Swift_Illusion

  • Playmaker Newbie
  • *
  • Posts: 41
    • View Profile
    • Midnight Tinkering
Re: Photon Integration Beta [NEW beta2]
« Reply #37 on: May 20, 2012, 09:31:59 AM »
Thank you very much for your informed response :).

I looked through the demo seen looking at all the uses of "is mine"....looks like there will be quite a bit of
setup for a lot of parts of a game running lol..
Though I believe I understand it a bit, and it's certainly something I'll have to setup in a lot of areas,
I don't think this solves my current problems, or at least I don't see how it can.
It's just choosing what to do based on whether your the controller or not, if it sends it's data to a global
variable and has other objects read that variable, they can't also send their data to the same variable and
have you read theirs. So for example one of my global variables tracks your characters state.
If you were only using the "is mine", you'd have to setup an individual character state global variable for
each object for them to set/read...and that won't work.


What I'm trying to achieve with is control over the character and it's areas within the character controller.
This includes keeping track of objects associated with it and objects created by it like weapons,
I also use global events along with global variables to keep track of and change the 'state' of the character.
This all also controls the camera and keeps track of that.
For example with the variables : character state(has it landed on the ground), combat state, combat phase.
And events : land, change state to [some state], return to idle.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #38 on: May 20, 2012, 11:58:45 AM »
Hi Justifin,

 ok, yes, I see, the controller is not disable it seems...

 Can you do one thing.

 Run one instance from the editor, and select the player that should not be controlled by you ( the one player object not labeled with "me" ).

 
 go to the "Behavior set up" fsm. This fsm is responsible fro enabling or disabling the camera and controller script. Can you double check that the variable "is mine?" is indeed set to false.

If it is, can you double check that indeed the "third person camera" script and "third person controller" scrirt are disabled from the inspector?

 I do not understand yet how come you have this glitch. If you can do the steps I described above and get back with the results, I would greatly appreciate this, we'll take it from there.

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #39 on: May 20, 2012, 12:31:25 PM »
Hi Swift_illusion,

I think you are indeed confused with the network "view" system and what a playmaker global means in a multi player context. I also think that you are confusing Global Events and Global Variables, they do use the same "global" word, but in our case, this is very misleading unfortuntly ( I think global events should be simply called events, and that events should be made "public" for other to see them, not "global").

-- A playmaker global, synched over the network, is something that can not be used to define a property that belong to a particular player. Because there will be several players, EACH of this player would share the same value, because the global variable IS syncehd over the network.
-- A playmaker global, NOT synched over the network, is NOT fine neither, because all players are prefab so they work the same, and they would ALL try to access the same global, so imagine storing the name of your player in a global... you create the room, fine, the global string has your name, if someone else, joins, the global gets overwritten with the name of the new player that joined the room... not good.
 
A global variable synched over the network should only be used to represent a property of the environment in general, not something that is meant to be specific to the running instance ( a player, an enemy, etc etc).

Now,  A Global Event is necessary even within a player Prefab, and even within the multi player envirnoment because, to communicate between Fsm, Global Events are necessary. You can fire a Global event to a very specific Fsm, this is not "global" as "everyone will get it", it's a "public" Event as "I am listening to a Global Event is someone wants to communicate with me".

If these concept are not fully grasp, We need to discuss this more, on another thread, because this is core to playmaker and how Fsm are built.

Now, for your example, completely remove global variables from your thinking process ( for now ).

-- keeping "state" as you describe it: Study how the animation of the character is handled in the demo, this is very much how I would suggest you implement your character state as well.

   1: the current animation playing for the player is stored as an integer, 1 if for idle, 2 walking, 3, running, 4 jumping.
  2: this integer is stored in the "variable synch repository" Fsm of the player in variable "Animation (synched)"
  3: In "Animation synch" Fsm
       IF this player is mine, then I MUST set Animation (synched)
       IF this player is NOT mine, then I MUST read that value and FORCE this player to match the animation integer

So, for states it would be the same, have an integer ( integer are smaller than strings, so they are more efficient to stream over the network then strings, but you can use string if it is easier for you to begin with, not a problem)
make that state variable synched over the network, and have a fsm responsible for either setting that state or reading that state AND force it to reflect that state.

If you don't understand this, I think I will do the following:

 Extend the demoWorker with a weapon. I am thinking that the best way to illustrate fully your dilemma would be to let the player drop a "mine" ( no pun intended (no "PUN" intented) :) ), or let's call it a bomb.

Ok, as the user drops a bomb, this bomb would explode if another player touch it, if you touch it it doesn't explode. This would totally illustrate the "is mine" concept, because the bomb would be instanciated by the same application instance as the player ( I hope you are following me here), the bomb belongs the player. so when a player would hit the bomb trigger, the bomb would check that the player "is mine" or not, if it is not, then it means it's another player, and BOUM.

 In short: A player and ALL objects instanciated over the network by the same running instance ( by running instance, I mean "running application")  would respond to "is mine" to true in that running instance.


I hope I did not wrote any nonsense, it's late here :) I think your question is very important to many to properly grasp how to build multi player apps. So I am really willing to get to the bottom of this and be as clear as possible. So do not hesitate to quote and ask for clarification where you require it.


Bye,

 Jean



justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 227
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #40 on: May 20, 2012, 07:40:37 PM »
@Jeanfabre

I ran the tests you suggested and it appears that "Third person controller" remains active, while "Third person camera gets deactivated" and "Is Mine" is set to false"

So i guess that's what's wrong.  As you as you disable the third person controller it behaves correctly between both instances.

is it not reading the is mine variable correctly then?

I'm running playmaker beta 1.4.0 beta 3 for debugging purposes and beta 2 of the photon playmaker package

« Last Edit: May 20, 2012, 07:42:20 PM by justifun »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #41 on: May 20, 2012, 10:11:17 PM »
Hi Justifin,

 uhm odd. ok let's try something, bear with me, cause I can't reproduce ( and that's worrying me to be honest).

select the prefab "Fsm Photon player" in the project browser ( using the search it's direct). and deselect the "third person controller" just like the "third peron camera" is deselected and try, it might solve the issue.

 Also, in the "Behavior set up" Fsm of that player prefab, select the one offending instance when running the game and check if the state "enable thirdperson control" action "set property" is properly configured ( could you make a screenshot actually?).

If that's doesn't help, then I'd like to be able to set up a gotomeeting session if you don't mind? so that I can see what's going on directly.

 Bye,

 Jean

justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 227
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #42 on: May 21, 2012, 06:17:59 PM »
Ok I discovered a few things jean

On the behavior setup fsm, on the "get is mine flag" state, the photon view get is mine action is set to blank for both Is mine event and is not mine event. that's not correct right?

also, on the set property action on the "enable third person controller" state, the object type is filled, however the property is set to "none"


justifun

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 227
    • View Profile
Re: Photon Integration Beta [NEW beta2]
« Reply #43 on: May 21, 2012, 06:29:08 PM »
OK good news!

I started with a clean scene again, and everything seems to be working.

There appears to be a conflicting problem though if you import the free photon networking asset along with the standard character controllers default unity asset.  which i think was causing the issues.... It throws a bunch of errors. 

everything works perfect now though with a fresh clean start! (until you import character controllers though)


Swift_Illusion

  • Playmaker Newbie
  • *
  • Posts: 41
    • View Profile
    • Midnight Tinkering
Re: Photon Integration Beta [NEW beta2]
« Reply #44 on: May 21, 2012, 09:39:08 PM »
@Jeanfabre

Thank you so so much for your response, I've been trying to interpret and look over the demo with everything
you've mentioned in mind, however I still have things I'm unsure about so as suggested I responded with
your post quoted in a new topic - http://hutonggames.com/playmakerforum/index.php?topic=1621.0