[Plugin] Photon Cloud

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

    When you need to measure the latency, send an event to yourself (TargetActors = "" & Photon.MasterActorNr) with the current time as a payload, then calculate the difference between current time and the time stored in incoming event in "on event" handler.

  • Hi ThePhotons, I'm new to multiplayer game development and I'm creating my first multiplayer game. I'm using Photon Realtime SDK with Construct 3. Everything works fine, but I have a lot of lags on players moving.

    I'm using 8 Direction behavior in my game and just send event with player's x,y coordinates on "Is moving" event. I don't use any data structure as arrays, just text with x and y coordinates. I thought it's the easiest solution for networking games.

    I didn't find any documentation or solution for Construct with Photon games.

    I will be grateful for any help, any article, example or anything else.

    Thank you!

  • Hi XOPC

    How large the lag is? You can't avoid network delay. You can only somehow simulate or predict object movement on other clients to make lag less noticeable.

    In any case sending coordinates on each frame is a bad idea. Instead, send coordinates and velocity each few frames and interpolate or extrapolate the position. Or better, send only next position target and let other clients simulate entire path between key points.

  • Thanks for the answer! Lags are mostly on moving, all other actions as shooting or collecting objects works with smaller amount of lags. Also, after your answer, I think other actions lag may be present because of each frame raising players positions. I'll try to send just direction and move the object while event "is stopped" will be raised. Thanks for the idea.

  • Pogi99

    When you need to measure the latency, send an event to yourself (TargetActors = "" & Photon.MasterActorNr) with the current time as a payload, then calculate the difference between current time and the time stored in incoming event in "on event" handler.

    Hi ThePhotons any sample project implementations for this one? I kinda confused how to count on that. Thanks

  • arcadesindo

    I added Ping button and 'On event 101' condition to demo-test. Sometimes round trip time is 0 probably because 'time' property is not precise enough.

    dropbox.com/s/bbl9nnzr3byrr18/demo-test.capx

  • Hi ThePhotons!

    I need to count players in room. I use Photon.RoomPlayerCount(Photon.MyRoomName) for this, but it's showing wrong value. I've 4 player in my room, but it shows 3.

    Also, I use System.EveryTick to update number of player when someone joins, but it doesn't update a value.

    What I'm doing wrong? Is this a right way?

    Thanks a lot.

  • Hi XOPC,

    Use 'ActorCount' to get the number of players in the currently joined room.

    'RoomPlayerCount' returns correct value only when the client is connected to the lobby.

  • arcadesindo

    I added Ping button and 'On event 101' condition to demo-test. Sometimes round trip time is 0 probably because 'time' property is not precise enough.

    https://www.dropbox.com/s/bbl9nnzr3byrr18/demo-test.capx?dl=1

    Thank you so much! I just realised that we could use the *time* expression!

    anyway I tried to multiply it with 1000, and I got like 16ms, or 33ms, and send them every 3 or 5 seconds, I think it can be useful!

    "Ping: " & int((time - float(Photon.EventData))*1000) & "ms"

    another question, how can we sync the game round time? currently mine was like this

    - If player was local, and actornr = 1

    - Timer start

    - Raise event xx with data Timer to All

    its working well, everyone get the exact time. But.. when the master was exit/minimized the game, then the timer will freeze.

  • arcadesindo

    Use master client as a source of time sync. When the current master leaves, the other client automatically becomes master. The client is master if Photon.MyActorNr == Photon.MasterActorNr

  • arcadesindo

    Use master client as a source of time sync. When the current master leaves, the other client automatically becomes master. The client is master if Photon.MyActorNr == Photon.MasterActorNr

    Thank you, it works only when the master was left, but the same thing also happen if the master is minimized the game without quit..

  • arcadesindo

    Maybe you can handle loosing window focus and suspend or disconnect master client. After suspension, the client can rejoin to the room with the same ActorNr. After disconnect, it can only join as a new player.

  • so the only way is to suspend them? :/

    btw ThePhotons what is the function of actor properties? can we do something with it like save their costume, or anything? and how to use it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • arcadesindo

    To keep master client active, you need to run game logic at least several times per second. But this is not possible while the page is in the background as far as I know.

    Actor properties is a convenient way of sharing per actor properties. You set some named value on one client and it's updated automatically (in "On actor properties change" condition) on all other clients. You can also use room properties to share per room values

  • sir can you make a photon code to show ms or latency like in other games?

    for ex: my ping is 60ms

    For Construct 3 because i dont have Construct 2, if not

    can you just copy paste the code? or step by step on how to do it?

    thank you :)

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