[Plugin] Photon Cloud

  • aminhanifm

    Which exact Photon example do you use? What is the name of the function? Do you have any errors or something does not work as expected?

  • aminhanifm

    Which exact Photon example do you use? What is the name of the function? Do you have any errors or something does not work as expected?

    I am using Demo-pool Photon example, the name of the function is createFish, i don't get any errors but if i change the position of creating fish to random then if there's new player joined, the new player will be created on randomed place on my screen then it moving until the new player get into the real position, and the new player's screen is also creating my fish to a random position and it moving to my real position.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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..

  • 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

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