[Plugin] Photon Cloud

2 favourites
From the Asset Store
Clouds
$2.99 USD
30 Photoreal clouds from subtle to stormy. Perfect for multiple game genres.
  • CROmartin in regards to your prev question, I think the way i got round it was to give each player an id (instead of using MyActorNr)...

    4 players > on join > id = 1, 2, 3, 4

    Add a 'room variable' called 'availableSlot'

    player 1 leaves > availableSlot = player1.id

    player 5 joins > player5.id = availableSlot (player 5s id becomes 1, to replace the player that just left).

    Hopefully this makes sense, might be a better way to do it with arrays

  • CROmartin in regards to your prev question, I think the way i got round it was to give each player an id (instead of using MyActorNr)...

    4 players > on join > id = 1, 2, 3, 4

    Add a 'room variable' called 'availableSlot'

    player 1 leaves > availableSlot = player1.id

    player 5 joins > player5.id = availableSlot (player 5s id becomes 1, to replace the player that just left).

    Hopefully this makes sense, might be a better way to do it with arrays

    Thank you on your answer, but can you tell me how did you locate which player is leaving?

  • CROmartin maybe something like this, i have not tested though!

    ThePhotons may be able to help in regards to the last bit

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

  • HA of course, thanks ThePhotons... so replace 'on start of layout' with 'OnActorJoin' and 'on disconnect' with 'OnActorLeave'... will get you closer to the result. Will prob still require a bit of work though! Sorry im super busy and not able to try it out.

  • hello, do you have any idea on how to keep the game running even though you "alt+tab" the browser

    because , i put the player 1 as the Master's Client right?

    then all of the Data and Timer from the Player's 1 screen will start to Run, and then it will be sent to other Player's Data ,

    So in short, if youre not the master's client then , the timers and data in your screen will not work, because all of your data relies on the Master's client.

    Here is my problem, when I start to "Alt + Tab" the Master's client browser, every running Data Pauses too, therefore those players that are not the master's client , their data will pause too, i mean it will only work if the Master's client screen is up.

    how do we fix this? pls help

  • Pogi99 Someone on a FB group just asked the same thing. I suggested forcing the player to leave the game when they 'alt+tab' then someone else automatically becomes the master.

    System > on suspended - photon > leave room.

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

    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?

    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, he needs to get information about existing clients so that he would know which slot is take and which isn't, everything fine, but it makes is so clumsy to do same when leaving as there isn't any equivalent of "join room" for "leav room", but I did it this way: while loop in "OnAcotrLeave" I set before loop a "counter" to "ActorNr" as this variable is equal to biggest client ID. While loop decrements each time and checks if ActorNrAt(counter)*-1 is equal to any ID stored in slot if it is then it sets slot to free(0) and stops the loop.

  • Does anyone can tell me how i can make, that every Player sees the walking animation of a sprite and not just the sender of it?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Does anyone can tell me how i can make, that every Player sees the walking animation of a sprite and not just the sender of it?

    When you send data you should always pass ID of client(Photon.MyActorNr) and also you should assign that same ID to objects that present player, other vise locating correct sprite(player) on each clients side would be impossible.

    Set "Receivers" Others and maker sure that "TargetActors" are not defined(just ""), define TargetActors only when you want to target ONLY ONE client by his ID.

    something like this, also have in mada that data is send as strings, so have in mind that you will need separate data with something in my case "|" and extract exact information you need like this: tokenat(Photon.EventData,0,"|"), index 0 would extract data before first "|" and index 1 would extract after first "|" etc.

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

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

    Just to be clear about this you are telling me that ActorNr will change in "On event number" based on client which "Raises event"?

    YES, this is exactly how it works. I have tested it out.

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

  • can photon devs add ms(Ping or Latency?

    like (69ms), so we can know how much ping we have

  • can photon devs add ms(Ping or Latency?

    like (69ms), so we can know how much ping we have

    i mean can you post the exact code?

    because you know, some of us dont have exp in coding, we are just hobbyist

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