[Plugin] Photon Cloud

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

    Depends on the type of game you are making.

    So without knowing that it is hard to tell what the best option is.

    In my wip top down shooter i spawn a sprite "line" on each shot.

    1 on the pc of the player that is shooting.

    And on on all the other players pc's.

    The shooting player spawns a "dummy" and raises a photon event to the other players with the data which players is hit and by who and the type of gun.

    The other players receive that message, and this time the "real" sprite line is being spawned hitting the player, and if the name in the photon event data matches their own player, then uppon this event, life is substracted according to the gun that whas used.

    Then this player being hit raises a photon event with its own life information and player name to the other players updating life status.

    Its flawless

    Note that this method does not involve flying projectiles.

    Its a instant hit method just like raycasting in 3D fps shooters.

  • Savvy001

    Thanks for the reply. I'm currently working on a 2D platformer shooter. Each player has a gun they can fire, which is a projectile with the Bullet behavior. Firing the bullet itself is synced up nicely, it's just collisions I need to figure out.

    If it helps anymore, I have two teams the player can pick from. Depending on what team they're on, they have a different colored bullet object that sends it's own events etc

  • Try Construct 3

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

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

    How do you handle the collision for the player being hit.

    Can you add a few screenshots?

  • You are targeting the Photon.actornr to be destroyed.

    So when "on the pc of player A" a sprite is hit.

    The actor number of that pc owner is going to get destroyed on the other players pc.

    Instead of the sprite you actually want.

    Solution is to use the "data" line when you raise a photon event.

    Make each sprite have a variable called actornr.

    On the "is joined" event of that player sprite set that variable to photon.actornr

    Now you have the actornr embedded in the sprite to compare to.

    Then on collision with the bullet raise event with event data sprite.actornr

    Then on received event.

    If sprite.actornr = photon.eventdata(sprite.actornr)

    Destroy sprite.

    Hope it makes sense

  • Savvy001

    Alright, I'll try this out and I'll come back to say if it worked or didn't work. Thanks for the help

  • TabloidA


    Remember you can also put multiple data in the raise event like: sprite.actornr & "|" & sprite.team & "|" & sprite.life

    Than recall 1 of the 3 data using the expression "tokenat".

    (From the C2 Manual)

    tokenat(src, index, separator)

    Return the Nth token from src, splitting the string by separator. For example, tokenat("apples|oranges|bananas", 1, "|") returns oranges.

    I use this to limit the amount of events raised.

    This way i can get the life/guntype/actornr in 1 go.

  • OK guys - this plugin seems really awesome. So far it's been way simpler to implement over the multiplayer plugin.

    I thought I would compare two versions of an early build of a multiplayer platformer I'm working on (surprise), but actually I'm able to achieve better latency locally with the multiplayer plugin than I am with photon. I was hoping you guys could jump in here and do some tests and let me know what you guys think.

    Controls: arrow keys and Z to jump

    Photon Version:

    http://threesevenhosting.com/builds/spa ... rs/photon/

    Multiplayer Version:


    It seems advantageous to use a cloud based system to host, instead of individual users becoming hosts. But I'm wondering if the competitiveness would suffer with the current latency I'm getting, even on my local machine? Do the premium plans cut down on latency? Also I haven't been able to test too much over a long distance.

    Note: if no characters show up, either give it some time or hit refresh. Seems like the spriter files take a bit to download sometimes. Also for whatever reason, players aren't disappearing when they disconnect. I'll figure that out later.

    Thanks guys!

  • Also, if you happen to be the host on the multiplayer plugin version, you can drag that green block around in the spawn area... also players can shoot on that version using X

  • hey - who was in there just now?

  • mudmask

    I had a little lag on the version with the multiplayer object.

    But that could have been some pc stuttering as well.

    Both seem to run fine.

  • Savvy001 - I guess the true test would be in implementing bullets and a scoring system...

  • Yep.

    The thing is with the multiplayer plugin from C2 (as they told in articles) is that there can be many things "routers" and such between the players destinations around the world.

    This mainly can cause a lot of lag.

    For me why i go with photon is because it minimizes this problem.

    Everyone connects to the cloud.

    Seems to me like the short best route.

  • Savvy01 - I hear ya. So minimizing all those factors would be one of the biggest advantages. However here's what concerns me, but maybe I'm doing something wrong? Here are some side by sides:

    Multiplayer Plugin:

    Photon Plugin:

    Is there any way to get that level of latency on photon? Even the examples that I've run that other people have made have similar results.

  • mudmask

    Well assuming you run the C2 version side by side on 1 pc does not make it connect "cross country".

    Meaning the connection and data stays within your home network.

    The photon version does connect to the photon cloud and the data then travels all the way back to you.

    So the photon version gives a more accurate latency representation than the C2 version.

    A question i have to ask, is did you copy paste the movement events from a photon example?

    If so would you please be so kind to show a screenshot of the event that "raises" on motion of the character.

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