playMaker

Author Topic: What is being done in the network tutorial? [SOLVED]  (Read 3282 times)

ShawnMcCool

  • Playmaker Newbie
  • *
  • Posts: 21
What is being done in the network tutorial? [SOLVED]
« on: February 28, 2012, 02:10:41 PM »


See here, there seems to be multiple event starting points.  What is happening here with that?

'connected to server', 'server initialized', etc
« Last Edit: February 29, 2012, 01:02:20 PM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: What is being done in the network tutorial?
« Reply #1 on: February 28, 2012, 10:50:19 PM »
Those are global transitions (right click on a state and Add Global Transition).

See Global Transitions in this overview: https://hutonggames.fogbugz.com/default.asp?W133

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: What is being done in the network tutorial?
« Reply #2 on: February 29, 2012, 12:34:06 AM »
Hi,

 Before diving into networking with playmaker, it's important to read the unity documentation on networking.

http://unity3d.com/support/documentation/Manual/Networked%20Multiplayer.html

and this very important reference on the network class:

http://unity3d.com/support/documentation/ScriptReference/Network.html

pay attention to the "Messages Sent" section. Each of these messages have been implemented as "Global transitions" within playmaker.

So in the demo:

-- "Connected GUI" state:
IF the application start or is disconnected from the server, we show the connecting GUI that let the client connect to a server OR start a server.

-- "client GUI" state:
When the application connects to a server ( after the user as asked to connect to a server from the "Connected GUI" state), it shows the Client GUI, which basically allow the user to Disconnect from the server.

-- "server GUI" state:
When the application connects AS a server ( after the user as asked to start a server from the "Connected GUI" state), it shows the server side GUI with the possibility to disconnect.


Each of these states are reached because they have global transitions set up. All these global transitions are INTERNAL, they are triggered by Unity and playmaker, not by script or manually using an action such as "sent event". This important to realize, and I agree not visually very clear compare to an event sent manualy. For example "CONNECTED TO SERVER" is something that will be  triggered automatically when Unity networking system will have successfully connected this application to a given server.

In order to test and see it happening in real, simply publish the application, run it, and then within unity run it again. You end up with two application running, one publised and one within the editor.
1: on the published application, start server.
2: in the editor, connect as client, and watch this fsm getting the "CONNECTED TO SERVER" event triggered.

 you can then with this set up, verify all precessed involved with networking ( most of them), if you need more than one client, simply publish two or three apps under different name ( app1, app2, app3), and run them all at the same time. Then you can work out for example player connections and management.

Hope this answers your question. Else, can you precise what concept you are not feeling confortbale with? is it the way plamayker works, the way network wors or the integration of networking within playmaker?

Bye,

 Jean

ShawnMcCool

  • Playmaker Newbie
  • *
  • Posts: 21
Re: What is being done in the network tutorial?
« Reply #3 on: February 29, 2012, 12:01:54 PM »
Alex actually answered my question.  Then, your response helped in a number of additional ways.  So, thank you.

I felt embarrassed that I missed something as basic as global transitions.  I'm not sure if they were added to playMaker after I had originally read the docs or if I had just missed them.  I reread the docs today and realized that this was the only thing that I had missed as I easily recognized everything else.  So, sorry about that.

At this point I'm creating --for myself-- a scene that in general reproduces the network test.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: What is being done in the network tutorial? [SOLVED]
« Reply #4 on: March 01, 2012, 12:14:38 AM »
Hi,

 Don't worry, there is no stupdi questions, and the forum is here to reply to any of your problems, at any levels of undertanding!

to be honest, it took me a real while to figure out the different between transition/events/global events, and only discovered recently that you can plug a global event as a transition, which is a real nice trick, so if you are in a state, you can move out of that state using a transition set to a global event, it doens't necessarly has to come from one of the action from that state.

Your approach is the best, now that you have the basics, re building from scratch is the ideal way to learn.

Have fun with this!

 Bye,

 Jean