[Plugin] Photon Cloud

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

    Hi, thanks for the feedback!

    It is a room, with max 4 players. Where each player should have a variable set to 1-4, but not the same value as anyone else. People can leave and join as they want, so it will always be new players joining, not the same ones. So not possible to assign according to index number.

    I was more thinking about some easy Construct event solution, to just validate the variable for the existing sprites and assign the "free" variable value for the joining player. just a small 'for each'-loop I guess.

    Haven't found it out yet though :)

    I think it is a bit overkill to use some slot or property function in the photon framework for it. I will try some stuff..

  • Hi, I solved the issue with an array.

    Now I have got into a new small issue. When creating a mobile game (actually Facebook Instant game), sometimes when you die in game the game will show you an ad. When the ad is shown, the actual game is paused in the background.

    I see two issues with this:

    1. If you view the AD for a very long time, you will be suspended from the game in background (I guess it will timeout somehow).(I know I can increase the supsended time.)

    What is the best practice here?

    2. When you get back to the game (from the Ad), you will have a LOT of queued raised events waiting for you which will all be executed in one go. (Example: All other players send an event every time they shoot a bullet (and for positioning and angles). You have three other players, shooting four bullets/s, and you view an ad for ten seconds: then when you get back you will get 3*4*10 = 120(!) bullets created directly, since all these are queued. Also all messages for all positionings are queued, several hundreds of messages! So I need some way to just exclude the user who just died from getting the events until he gets back into the game again, since he will not really need to get those. and also the queue is an issue on its own..

    EDIT: I guess you will use InterestGroups! and exclude him when he "dies" and include him again just before re-spawn? Is this "Best practice"?

    Thanks in advance for any tips! :)

  • Hi fredriksthlm ThePhotons

    I'm trying to do something similar to you with 4 players but can't quite wrap my head around it.

    Where are you storing your player list? In a room property?

    My though process is this -

    1) when a player first joins is checks a playlist property for a array (as json) (the first player will get nothing cause it will be blank.

    2) They add their actorNr to the list and save it back to the property.

    3) when player 2 joins they repeat the same thing, but this time since player one has already added their ID theirs will be added, and they will updated player 1 to grab the new list

    I keep ending up with different lists though for each player :(

    Which way did you approach it?

    Also, how did you limit the max number of players in the room. I've tried using the max players action, but no matter where i put it, it doesnt seem to limit the room correctly, more then the max players can still join the room.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have no idea what you refer to as "player list". I don't have any list. I have not used any property functionality at all.

    when a player jions he will have his user created. every player can just count the players to get a list of the players. i have asigned a name to every user at start.

    max room seems to work fine for me. I set it when I create the room.

    max rooms can be called from the api, so you can see if you have it set or not.

  • Chat is resetting everytime I changed layout, I can only be able to get history on first boot. Can I get history with an action? or how can I solve the reset problem?

    Thank you

  • fredriksthlm

    1. If you view the AD for a very long time, you will be suspended from the game in background (I guess it will timeout somehow).(I know I can increase the supsended time.)

    What is the best practice here?

    2. When you get back to the game (from the Ad), you will have a LOT of queued raised events waiting for you

    Maybe app still runs but very slow in backround and getting messages but can't handle them.

    If you really suspend the game with "Suspend room" action, client disconnects and does not receive any messages. The point of suspending is later rejoin with the same actor id as was assigned at previous join which may be more appropriate than joining with new actor id.

  • justifun

    Where are you storing your player list? In a room property?

    It's stated clear in my post above that rooms properties should be used. Is anything unclear in that post or it's just not relevant to your case?

  • coi

    Chat is resetting everytime I changed layout, I can only be able to get history on first boot. Can I get history with an action? or how can I solve the reset problem?

    Chat history may be loaded only with "Subscribe" action. Client does not store messages. You have to do this yourself and make sure that storage persists when you change layout.

  • ThePhotons

    Thanks!

    A question: If I send events to Interest group I am not receiveing it myself, even though I am part of that group. Is this intentional?

    Is it possible to send events to a interest group including yourself?

    (It seems for me that sending to Interest groups are automatically combined with Others, not All? Regardless what you have actually stated)

  • Hi, tell me the photon plugin will work in construct 3?

  • idjer83 - yes it does

  • fredriksthlm

    Is it possible to send events to a interest group including yourself?

    Did you try "All" receivers? It should do what you expect.

  • Hello, is it possible to simulate the reception of an event?

    This would allow me to add the offline game in a short time but with the infrastructure of the online game.

    That is, if the player selects the offline game, the code would be the same, it would not take much work to program the offline mode because now the events would be simulated.

  • I use functions a lot. When online the event calls the function, when offline calls the function directly without photon.

    For example:

    Pressing Jump.

    - Player is Online. Raise event 2.

    - Player is Offline. Call function Jump.

    On Photon event 2. Call function Jump.

    Function "Jump".

    Simulate pressing Jump key..

    Something like that, so you can use the same mechanics for both online and offline. use all cahracter behaviour and movement in funcitons, then the function can be called either directly (if offline) or by a photon event.

  • I use functions a lot. When online the event calls the function, when offline calls the function directly without photon.

    For example:

    Pressing Jump.

    - Player is Online. Raise event 2.

    - Player is Offline. Call function Jump.

    On Photon event 2. Call function Jump.

    Function "Jump".

    Simulate pressing Jump key..

    Something like that, so you can use the same mechanics for both online and offline. use all cahracter behaviour and movement in funcitons, then the function can be called either directly (if offline) or by a photon event.

    It's a good idea, I'll consider that mode.

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