[Plugin] Photon Cloud

From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • aminhanifm

    createFish accepts 2 parameters. You need to add 2 more to pass position. Also add position values to payload when raising event 1 and parse them when handling "On event 1". Current payload is fish type number. You need to pass a table with 3 parameters instead: type, x and y. Because Construct does not support js objects as parameters, encode this table in string, with json e.g.

  • aminhanifm

    createFish accepts 2 parameters. You need to add 2 more to pass position. Also add position values to payload when raising event 1 and parse them when handling "On event 1". Current payload is fish type number. You need to pass a table with 3 parameters instead: type, x and y. Because Construct does not support js objects as parameters, encode this table in string, with json e.g.

    Thank you so much ! i will try it soon

  • Anyway can i add more than one data on raise events ? if yes how can i add more than one value data on raise game event for example Fish.X and Fish.Y ?

  • Data can be Sprite.X & "|" & Sprite.Y & "|" or using any delimiter you want, then you use tokenat to grab what index you need.

  • Data can be Sprite.X & "|" & Sprite.Y & "|" or using any delimiter you want, then you use tokenat to grab what index you need.

    Thank you so much again ! but i tried it again and im still getting stucked at this problem

  • What exactly is the problem?

    So once the data is sent like so on the Photon raise event action, on the TRIGGER, if you want to access Sprite.X, you use say, a local variable Token0 and assigned it to int(tokenat(Photon.EventData,0,"|")).

    As an example if Sprite.X = 50 and Sprite.Y = 75, Photon sends as a string 50|75|

    tokenat(Photon.EventData,0,"|") gets the 1st element from that string until the delimiter, which is |, so 50, then using int(50) you transform it from string to int.

  • ThePhotons :: I have a question, how do we use the features custom authentication, userIDs and Friends in the Photon Plugin for matchmaking.

    It seems that it isn't very much documented.

    An example project would be nice with Friendlist, authentication and with the use of ActorNr and UserIDs.

    Thanks a lot.

  • What exactly is the problem?

    So once the data is sent like so on the Photon raise event action, on the TRIGGER, if you want to access Sprite.X, you use say, a local variable Token0 and assigned it to int(tokenat(Photon.EventData,0,"|")).

    As an example if Sprite.X = 50 and Sprite.Y = 75, Photon sends as a string 50|75|

    tokenat(Photon.EventData,0,"|") gets the 1st element from that string until the delimiter, which is |, so 50, then using int(50) you transform it from string to int.

    I used Demo-pool from photon examples, first i edited on join room with a function called "createFish" with random(Layout.Width) on parameter 2 and random(Layout.Height) on parameter 3 and add raise game event 1 with Function.ReturnValue & "|" & Fish.X & "|" & Fish.Y after that function, then on event 1 it calls "createFish" function with float(tokenat(Photon.EventData,1,"|")) at parameter 2 and float(tokenat(Photon.EventData,2,"|")) at parameter 3, then on function "createFish" i changed the position of creating fish X to function.param(2) and Y to function.param(3). but i still getting randomed spawn whenever i play it..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's hard to understand your code, maybe you can provide a screenshot or something? Also I don't know demo-pool from the photon example so I'm rather clueless.

  • Sure.. im so glad if you can help me to solve this issues <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" />

    so i got the screenshot of the events and here are the screenshot..

    imgur.com/a/NNAqe

  • First off, the Function.ReturnValue should only be used inside a function, at the end of the code hopefully, otherwise it will not do anything.

    Remove the function and put it's content in the code for now. Whenever there is a bug in a code (not necessarily in C2) start removing useless things that can cause problems.

    Divide and conquer.

  • So the point is, can i spawn joined player to a randomized position and old joined player spawned on the last place he moved (not by randomized) ? maybe you can help with the events that should i put..

  • ThePhotons I'm running 4.0.0.8, I checked the changelog for 4.0.0.9 but couldn't find anything.

    In the version I'm using I don't seem to be connected to a master server. I got a server for self hosting and the game works via wss but I get error messages when I try to gets appPeerCount and lobby stats, etc.

    I've tested the game and it's running great with up to 10 people, so I don't understand how I'm not connected to the master server hmm..

    Would you know any issue with this?

    I checked the demo-test with the 4.0.0.9 plugin, self hosted and the app stats update triggers only for an actor when he leaves; it doesn't trigger for anyone else

  • Btw please fix this issue of trying to connect to a random room while connected to a room. Getting alerts with js errors is not too great.

    I used 4.0.0.9, modified the demo-test from self hosting to photon cloud, added app id, previewed.

    The demo started, connected to a room after which i pressed join random room (obviously a bad idea)

  • I got a server for self hosting and the game works via wss but I get error messages when I try to gets appPeerCount and lobby stats, etc.

    When clients connects to a game server, it disconnects from master by default. Leaving room reconnects client to a master where LoobbyStats requests start working again. JS SDK client supports keeping connection to a master while joined to a room. But this is not recommended and the feature is not exposed in plugin.

    Also Lobby statistics events are sent as client connects to a master server. Then they are sent every minute.

    Application statistics events are sent automatically each 5 sec. while client is connected to a master.

    [quote:3bl4x0iq]Btw please fix this issue of trying to connect to a random room while connected to a room. Getting alerts with js errors is not too great.

    Underlying Photon js library throws exceptions. This is not a problem in js app but it seems like it's not possible to catch exceptions in Scirra app. We will think about changing error handling w/o breaking existing js apps.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)