playMaker

Author Topic: Is SendRemoteEvent actually working? [Solved]  (Read 3004 times)

Gevarre

  • Playmaker Newbie
  • *
  • Posts: 49
Is SendRemoteEvent actually working? [Solved]
« on: May 18, 2013, 10:47:34 PM »
I ask this question because I can't seem to make it work and I can't find any examples of this in use anywhere, so I have nothing to go by.

I've created a simple FSM that's set up so that when the right mouse button is clicked, it goes to a second state that contains the SendRemoteEvent action. So far this works when testing.

I then have another state that has a global transition going into it. (I attach this by right-clicking on the state and selecting "Add global transition>Global Events>myGlobalEvent)

The "Remote Event" field is then set to the global event, "Game Object" is left on the default "Use Owner", and "Mode" is set to default "All". Additionally, a network View has been attached to the object containing the FSM and is set to observe the FSM.

When played, the FSM proceeds normally to the state containing the SendRemoteEvent, but the global event it's set to never gets triggered.

I've checked the SendRemoveEvent.cs script and I see it's using a standard networkView.RPC call, so all I can think of is that whatever is done when you click the "Global flag" on the event isn't setting up the event as a proper RPC or something along those lines, though I can't seem to find where the actual FSMs are stored to check that. (I'm guessing they are actually encoded into the main Playmaker framework and are not accessible?)

Anyway, I've found the networking examples on the website here, but all they do is go through the very basic steps of connecting players. There's nothing in them at all about sending messages. Is there any example anywhere of this being set up for a networked game and properly working? This is something that is really, really needed.

Thanks in advance as always for all the help.
« Last Edit: May 20, 2013, 08:31:50 PM by Gevarre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is SendRemoteEvent actually working?
« Reply #1 on: May 20, 2013, 02:41:34 AM »
Hi,

uhm, I can only seem to be able to fire an event on the fsm itself. I will investigate.

Any reasons why you don't use Photon?

 bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is SendRemoteEvent actually working?
« Reply #2 on: May 20, 2013, 05:34:33 AM »
Hi,

 ok, everything is "fine", here is the few catches....

-- RPC call only send to the networkView ID, that is the event you send from playmaker will only be fired to the SAME fsm observed by a networkView. I forget that since I am used now to the way it works with Photon PlayMaker port.

  In short, don't expect a PlayMaker global event to be broadcasted, instead, it's only within the Fsm that you will receive that remote event. It doesn't matter if the event is global or not.

Nowing this, you still need to be aware of the following when implementing Unity Network remote event with PlayMaker.

-- This "Send Remote Event" action is basic in the sense that it will take the first networkView component it finds on the GameObject. IT MAY NOT BE the one you expect, that is the one observing the fsm that will fire the remote event. If you have two fsm, and both are observed, the second will fail to send remote event properly, it will try to fire the event from the first networkView component on that gameObject.

The best way to go about that, is to have only ONE fsm on the gameObject and ONE networkView on that gameObject observing the Fsm ( you can set the "state synchronization" to OFF if you only fire remote event and no Fsm variable have "network synch" checked.)

-- Also, for some reason, I realize that the string variable you can pass with the remote event is not implemented yet, I have reported it to PlayMaker, I hope it will be available in the next update.

 so, yes, Send remote Event is working, but you need to be aware of these points above to make it work properly.

I recommend in all cases to switch to Photon Networking since it's now supported by PlayMaker in its official package and it a lot more actively developped, in close collaboration with ExitGames. Also, the way I implemented the remote event system is a lot more powerfull and deals properly with what you expect from a PlayMaker Event.

Bye,

 Jean

Gevarre

  • Playmaker Newbie
  • *
  • Posts: 49
Re: Is SendRemoteEvent actually working?
« Reply #3 on: May 20, 2013, 11:53:43 AM »
Thanks. That helped a lot. I had two FSMs, just to keep things organized, and two network views on the object, so once I fixed those, it worked. Playmaker seems to be a bit more limited in their networking abilities than just using straight Unity network scripting.

And yes, I would definitely use Photon networking, but with all the tests I've done I've had dissappointingly horrendous synchronization issues. (as in, a player moves on their side, and it can be up to a second later before they move on the other clients' machines) I've researched this on the Photon forums (just do a search for "lag") and it seems others are having the same problems. They don't seem to have really implemented the extrapolation/interpretation methods fully/correctly, and the semi-official response from them seems to be "we don't have time to look into this, but you're welcome to find a solution yourselves if you like." They even started a forum topic for people so they can post their solutions, which of course has gotten nowhere. In my opinion, for a company whose entire business is based on reliable networking, this is not a good way to handle it, but this is the wrong forum/board to discuss the issue in. I just hope they come to their senses and fix it, in which case I would switch over (and even eventually become a paying client) in an instant.

Anyway, as always, you've been wonderful and solved my problem! I'd be getting nowhere without your expertise :)
« Last Edit: May 20, 2013, 11:56:49 AM by Gevarre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is SendRemoteEvent actually working?
« Reply #4 on: May 20, 2013, 12:48:12 PM »
Hi,

 Uhm.. that's odd indeed. It seems to me it could be more a problem of internet connection than the server or the implementation itself. That's where they may draw the line. I did not experience such lags so far, anyway if you have it working, then that's cool.

Yes, PlayMaker has only a single set of RPC built in connection. But by all means, you can simply copy paste the photon proxy, because all the rpc handling is open source, so you can have any RPC signatures and behavior ( like if you really want to dispath a global event on the other side of the network).

bye,

 Jean

Gevarre

  • Playmaker Newbie
  • *
  • Posts: 49
Re: Is SendRemoteEvent actually working?
« Reply #5 on: May 20, 2013, 02:01:24 PM »
Well, I have pretty much ruled out internet lag (as in, the time it takes for the message to go across the net and back). My ping is usually 50 - 100 ms. Others on the Photon forums have also investigated this.

I already have a working version of my game, which is a vehicular shooter using lots of network traffic, and it's rock-solid using Unity's standard networking code along with Leepo's (M2H) "NetworkRigidBody" interpolation code. I can't even get the most basic examples from them to be anywhere near acceptable.

I do admit I may be a bit spoiled though. I worked for EA and with DICE on the Battlefield series, so I had access to extremely optimized network code and the benefit of DICE's programmers to help me, which I'm realistic enough to know I'm never going to get here.

Sadly, the type of game I'm working on may be more suited to a different engine that's built from the ground up for shooters, and I may have to go with a custom-coded solution, which is what all the developers I know do with Unity, which is too bad because Unity, especially with Playmaker, is so wonderful for design and prototyping.

But I digress again. Right now I just need to get a basic demo working, and once I solve these last few issues, this should work fine for that. I don't want to confuse people with more discussion here about issues not related to Playmaker, but if you're interested, I'd love to chat more with you privately to see if it is possible to overcome the Photon issues. If we can figure out exactly what's going on and/or come up with a demo with all this stuff set up correctly, I'd be more than happy to share it with everyone to help others. Just send me a message if you'd like to continue the discussion.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Is SendRemoteEvent actually working? [Solved]
« Reply #6 on: May 21, 2013, 02:12:47 AM »
Hi,

I don't see any problem is discussing this. Since Photon is serving

 It may very well be the case that the Cloud service from Photon is not playing in the same league as if you get a Photon Server? Have you tested their photon Server system or Photon Cloud system?

You'll see the difference in Photon's clients using the Cloud and client using the Server, I think this is where the catch is, Photon Cloud is good for indie games, Photon Server is for the big boys. That's just what I can make up from their site tho :)

bye,

 Jean
bye,

 Jean