ThePhotons's Forum Posts

  • arcadesindo

    Not really. The Javascript SDK is currently not in active development. If you are missing something that is implemented in other SDKs, please let us know.

  • It's applicable fot C3 in general but of course we don't have exact equivalents of the methods used in examples. The most important missing part is the server time (PhotonNetwork.Time). You need to implement the replacement for it, e.g. send ping message to the master client regularly, measure the lag and adjust the current time received in master client's reply by this lag.

  • hi 1mrpaul1

    Dou you mean that the client disconnects only when you are sending frequently? What's in your log? What if you send once per second? How large are your messages? Each message is an array of 3 floats encoded in json?

    10 messages per sec. should not be a problem for Photon client.

    The Photon plugin has "on disconnect" action in which you can connect again.

  • 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

  • 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.

  • 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

  • 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.

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

  • 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.

  • 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.

  • Try Construct 3

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

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

    Contruct events do not have parameters. To pass values to user code, I introduced variables which are set to event parameters right before calling user's handler. These variables are: ActorNr, EventCode, EventData, ErrorCode, ErrorMessage and a few others.

  • CROmartin

    OnActorLeave fires when player leaves, but for every client. It would be good if there was some kind of equivalent of "join room" for "leave room", which seems to fire only for exact client that joined. Am I understanding this events good?

    You can get the id of leaving player via Photon.ActorNr variable and compare it to the id of the player which you need.

    When you send data you should always pass ID of client(Photon.MyActorNr)

    Photon.ActorNr works the same way for events, so you do not need to send Photon.MyActorNr. Other variables for events are Photon.EventCode and Photon.EventData. Of course all these variables are valid only in the current Constructor event handler.

    I handle slots this way: when player joins already connected clients send theirs information to newly connected client information trough "OnActorJoin" and then he creates him self with "join room" event...

    Using room properties updated by the master client and read by others (in OnMyRoomPropertiesChnage) looks much simpler and more reliable.

  • CROmartin BronzeBeardGames

    OnActorLeave is the event which fired when a player leaves. The master client should update slots in the room properties in this event. It makes sense also to use OnActorJoin for slots allocation.

    Allocating slots in OnStartOfLayout will fail if the client is not yet connected at this point.

    The client can't update anything in OnDisconnect because it's already disconnected.

  • Updated Photon plugin should work correctly with workers and modules:

    dashboard.photonengine.com/en-US/download/photon-construct2-sdk_v4-1-1-0.zip