playMaker

Author Topic: Basic networking advice[SOLVED]  (Read 222 times)

jess84

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Basic networking advice[SOLVED]
« on: May 21, 2020, 09:06:59 AM »
So I've picked up Unity for the first time in about 5 years (thanks to the lockdown), and I'm working on a multiplayer board game.  Desktop app as the board view, control the cards etc. + mobile app for each player to have their cards, submit their turns etc.

I was previously using Photon PUN a few years ago (I paid for the premium package), so have tried to integrate it into this new project but ran into a few issues that I'm not sure is my error or down to Photon maybe not being the most appropriate nowadays.

I guess question 1;  as I don't need to sync a scene or gameobjects, purely just sending/receiving RPC calls - is Photon the best approach?  Is there any other package that could handle this and be more lightweight? Is there native Unity networking and PM actions nowadays.


question 2; I have my scenes set up, and I can connect to photon fine with both the host and a player - and it shows that they're both in a Room called TEST independently - but when I try and list the players in the room, each app is only showing itself as present.  Any ideas?

question 3;  for simply recieving an RPC call, do I need to have any specific components on that gameobject holding the FSM I'm trying to reach? I'm firing an event from one player, and the other isn't receiving it, despite both showing as in the same room.  (I do have the Playmaker Photon Proxy in all scenes)


Any pointers would be gratefully received!!

« Last Edit: May 25, 2020, 12:35:18 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15237
  • Official Playmaker Support
    • View Profile
Re: Basic networking advice
« Reply #1 on: May 21, 2020, 11:12:44 PM »
Hi,

1: photon is ok with just sending rpc yes, not need to synchronize any value if you don't want to. there is a more light weight system from Exitgames, where you simply use the loadbalancing underlying system upeon which pun is built and you then simply send events, nothing more, but I don't recommand it, as you need to use c# ( no playmaker support) and you loose a lot of goodies for easy networking.

2: you are likely in different regions for each client, make sure they connect to the same region, and have the same client app version ( which is another way of separating users)

3: It depends how you send that rpc, can you details your action setup?

Bye,

 Jean

jess84

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Basic networking advice
« Reply #2 on: May 22, 2020, 06:12:03 AM »
Thanks for the quick response Jean!

1) Cool, I'll just stick with PUN

2) Will try and manually set region and retest. Thanks.

3) I'm using 'Photon View RPC Broadcast Fsm Event' on a button click.  When I run in editor, I can see it firing in the console.  However when I run it in windows standalone, and I'm running a client in the editor, I don't see anything in the console.  I'll make sure it's not #2 causing the issue.

I've just noticed this though, when trying to resolve the region issue and testing everything from scratch...

See screenshot.

The transition for On Connected To Master isn't being triggered - but you can see in the console, it has actually been fired/received.  Any ideas?

Edit: Ignore that last bit. the event 'Connected to Master' works.  Not really sure of the difference between 'Connected to Master' and 'On Connected to Master', but hey, I've got one that works :)
« Last Edit: May 22, 2020, 06:14:57 AM by jess84 »

jess84

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Basic networking advice
« Reply #3 on: May 22, 2020, 10:27:39 AM »
Does 'Photon View RPC Broadcast Fsm Event With Data' action no longer work?

I'm triggering it, but it's not firing - nothing in the console.  Whereas if I'm using 'Photon View RPC Broadcast Fsm Event' instead, with the same event etc, it's fine! Showing in the console, and is being received by other players.


jess84

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Basic networking advice
« Reply #4 on: May 23, 2020, 06:04:18 PM »
Hmm, could this be the reason for my RPC with Data not working -

When I right click on the action in the action browser, and choose Find Script - it tells me it can't be found. I can see the script in the folder, and it looks fine when it's added to my fsm. If I choose File Script on any of the other photon actions, unity highlights them without any issue.

I've tried deleting the script from the folder, and pasting it back in, but that doesn't resolve the problem.

It's pretty frustrating not being able to send data with my RPC 😔

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4968
    • View Profile
    • jinxtergames
Re: Basic networking advice
« Reply #5 on: May 24, 2020, 12:31:17 AM »
Hi.
Not finding scrip can be because the class name is not the same as the script name.
but it only affects finding the script.

jess84

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Basic networking advice
« Reply #6 on: May 24, 2020, 07:01:31 AM »
OK, thanks djaydino.

How am i supposed to get data over an RPC?

Using 'Photon View RPC Broadcast Fsm Event' and adding a string = I can see it on the console as being included in the RPC call.  However using 'Photon View Get RPC Event Data' on the other end doesn't grab the string. (I get an error instead).

'Photon View RPC Broadcast Fsm Event With Data' with a string doesn't work. It doesn't even fire from the host - nothing in the console.

So what are my options for being able to transmit some data?

Honestly this is just becoming farcical now. I'm trying workaround after workaround.  Broadcase Event with Data SHOULD work.   Can anyone confirm it does still work for them?

jess84

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Basic networking advice
« Reply #7 on: May 24, 2020, 07:23:49 AM »
Hi.
Not finding scrip can be because the class name is not the same as the script name.
but it only affects finding the script.

Addressing this part;  The action was from the EcoSystem, but I've just deleted them and imported them from https://hutonggames.fogbugz.com/default.asp?W928 - and immediately I have the same problem.  I haven't touched the namings at all, so it's a bug in the source.

LordHorusNL

  • Beta Group
  • Full Member
  • *
  • Posts: 184
    • View Profile
Re: Basic networking advice
« Reply #8 on: May 24, 2020, 08:34:55 AM »
Hi jess.

Are you using Photon Classic or Photon 2?

I'm guessing Classic because the "Photon View RPC Broadcast Fsm Event With Data" action isn't included in the PUN2 package.

When using "Photon View RPC Broadcast Fsm Event" you can just receive the string on the other end with a normal "Get Event Info" or "Get Event String Data" action.

jess84

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Basic networking advice
« Reply #9 on: May 24, 2020, 11:05:27 AM »
Hi jess.

Are you using Photon Classic or Photon 2?

I'm guessing Classic because the "Photon View RPC Broadcast Fsm Event With Data" action isn't included in the PUN2 package.

When using "Photon View RPC Broadcast Fsm Event" you can just receive the string on the other end with a normal "Get Event Info" or "Get Event String Data" action.

Hi.

Yep, I'm using Classic.

Oh - that's an excellent tip! I don't know why I assumed I had to use a RPC event to receive the data, but your suggestion of using a regular event get is working like a charm.  Thank you!!