playMaker

Author Topic: Photon Multiple Player Control[SOLVED]  (Read 10928 times)

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Photon Multiple Player Control[SOLVED]
« on: March 16, 2013, 01:10:47 PM »
Hi,

I have a project that can successfully connect to the Photon network, create a room and instantiate a player.  If I run a standalone build on my second PC, I can successfully connect a second player in the same room (yay!), so I have all the raw ingredients for a basic multiplayer environment.

BUT- for some reason input on either machine controls both players in the environment! 

This must be simple stupidity on my part; but what do I need to do to ensure each client only controls their locally instantiated player object?

Thanks as always.
« Last Edit: March 18, 2013, 05:46:45 AM by jeanfabre »

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Photon Multiple Player Control
« Reply #1 on: March 17, 2013, 01:42:36 AM »
Hi Artician,
Have you had any luck with this?  I'm also new to PM and Unity and I've been trying to get things going from scratch.

I've been poring over the documentation, and struggling through, but I think your issue may be something to do with the Behaviour FSM:

https://hutonggames.fogbugz.com/default.asp?W875

Apparently this is where it isolates the control to the particular player.

If you check the state "Enable Third Person", it points to the controlling script, so perhaps you don't have that part set up?

As a side not, does anyone know where there is a step by step guide on how to set Photon/PM up properly?  The fogbugz docos are good, but I find as a newb, I'm struggling to get things completely going.  To be honest, if I can get a handle on how to do things, I'd be happy to write up a newbs' guide at the end of this. :'(

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Re: Photon Multiple Player Control
« Reply #2 on: March 17, 2013, 10:57:14 AM »
I haven't had the time to test it yet, but I'm certain what you're pointing out is exactly what my problem is.

I'm not new to playmaker, just this Photon extension, but I am used to jumping into things without finding the proper documentation first, (my frequent fault and apologies), so I tend to make a lot of stupid mistakes (like this!).

Thank you for pointing it out!  I'll let you know if this fixes it when I have the time to test.

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Photon Multiple Player Control
« Reply #3 on: March 17, 2013, 07:43:15 PM »
Well if it's any consolation, I've been reading the available docs over and over, and can't get much further with creating my own multiplayer game from scratch.  I'm guessing a lot of the current info assumes you have background knowledge with Unity and Photon.  I think I'll go back to the Photon documents (non PM) and try to build up from there.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: Photon Multiple Player Control
« Reply #4 on: March 17, 2013, 09:48:18 PM »
Hi,

 ok, let's sort this. It's true that diving into Unity/PlayMaker/Photon can be challenging all in one go.

First: can I assume that you managed to create a valid project and scene? that is when you open the photon wizard, all is green? If not follow these instructions:

https://hutonggames.fogbugz.com/default.asp?W982

Then

https://hutonggames.fogbugz.com/default.asp?W988

And you should then end up with the last screenshot where both project and scene are properly set up (in green).

If that's out of the way, very good, else, let me know how I can improve the doc :) I really want this to be as clear as possible.

Second: https://hutonggames.fogbugz.com/default.asp?W875

indeed, this is CRITICAL to understand to start creating your own MP projects, so let me try to reword a bit, it's actually very simple.

since you reuse the same prefab for all your different players, they all respond to user inputs, BUT if on your machine, you should only control YOUR player, and the other players should be controlled by their own "owner", by owner, I mean the physical human being interacting with your game. So we have to turn off user input related behaviors for all the players that are not YOUR player.

Does that make sense?

Third: If you have a problem with another aspect, let me know, and maybe write a new post to that things are clear. Where do you struggle when you start from scratch?

bye,

 Jean


eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Photon Multiple Player Control
« Reply #5 on: March 18, 2013, 03:10:48 AM »
Hi @jeanfabre,
Many thanks for your reply, I really appreciate your patience with us noobies!  :)

I've gone through the demo worker example again (as well as the non PM Photon Marco Polo example), and I think in combination with your tutorials I am starting to get a grasp on things. 

The final thing I haven't quite figured out, is in the 'Game' Game Object.  Under the 'enable third person control' state, it references [player prefab].

I've looked at the 'Fsm Photon player' prefab and elsewhere in my asset list, but I can't see where this is pointing to? 

Could you please tell me where to find[player prefab]?

NB: I tried dragging 'Fsm Photon Player' into the 'instanciate player' box, but that broke the game entirely.

Many thanks
EH
« Last Edit: March 18, 2013, 03:22:28 AM by eyehawk »

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Photon Multiple Player Control
« Reply #6 on: March 18, 2013, 05:08:53 AM »
Actually sorry, I found Player Prefab under the Variables tab after looking for a bit.

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Re: Photon Multiple Player Control[SOLVED]
« Reply #7 on: March 18, 2013, 06:37:44 AM »
I knew it was something simple I missed.  Thank you Jean!

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Photon Multiple Player Control[SOLVED]
« Reply #8 on: March 18, 2013, 01:10:52 PM »
That's great, does it work for you now Artician?

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Re: Photon Multiple Player Control[SOLVED]
« Reply #9 on: March 18, 2013, 03:30:57 PM »
I'm positive this will solve my problem, yes.  I am stuck at the moment though because I need to look at the example/demo scene to see exactly what Jean did with the GetMine action, however I can't get the damn demo scene to work. 
I outlined my problem here: http://hutonggames.com/playmakerforum/index.php?topic=3424.msg15675#msg15675

Frustrating!

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Photon Multiple Player Control[SOLVED]
« Reply #10 on: March 18, 2013, 09:08:20 PM »
Bummer, I wonder if that's an issue with the latest version of Unity?  Yes I feel your pain at the moment, I've been dissecting the demoworker example and looking at every single piece alongside the fogbugz docs to understand everything.  I also still have issues with the controller moving both players even though I've set it up completely in the Behaviour FSM - oh well I must have missed something so will keep at it!  8)  Good luck with this anyway, if I figure it out I'll be sure to share the information with you.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15060
  • Official Playmaker Support
    • View Profile
Re: Photon Multiple Player Control[SOLVED]
« Reply #11 on: March 18, 2013, 10:19:51 PM »
Hi,

 Start with a simple box as your player and control only its position, so that the least possible extra feature doesn't get in your way.

if both player moves, it's totally because you don't disable the other player input. you need to detect when the prefab gets instantiated if it "is mine", if not, disable the user input control for that prefab.

have you done that?

bye,

 Jean

eyehawk

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: Photon Multiple Player Control[SOLVED]
« Reply #12 on: March 19, 2013, 06:21:29 AM »
Hi @jeanfabre,
Many thanks again for your kind assistance. :)

To avoid hijacking the thread from artician (sorry!), I've created a new thread:

http://hutonggames.com/playmakerforum/index.php?topic=3430.0

Basically I've created a cube as you have suggested.  However this time, after entering the room, I get some errors.  I've shared a link to google docs with each step accompanied by screenshots of the steps I've taken.  I've also saved a copy of the scene which I've also provided links for.

Apologies in advance for the noobish questions  :-[

I'm sure I must be missing a couple of critical steps somewhere.