[Plugin] Photon Cloud

From the Asset Store
Clouds
$2.99 USD
30 Photoreal clouds from subtle to stormy. Perfect for multiple game genres.
  • OK guys - this plugin seems really awesome...

    .................

    .....Thanks guys!

    I will agree with what mudmask said. This plugin makes Multiplayer MUCH simpler to implement, but the latency seems to be inferior to the Multiplayer object built into C2. That could possibly be a server thing like you said Mud, because it does say on the Photon site that the free server should mainly be used for testing and developing.

    I haven't managed to get as bad of a lag issue as you have (Although I still get slight stuttering). How often do you have the movements of the player being updated?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Savvy001 Alright, here's what I have currently: http://i.imgur.com/WWjySN0.png

    The opposing player is now in fact destroyed, except it doesn't need to be hit by the bullet to do so. Right when I press Shift.

    It seems I need to find a way identify that the bullet hits only the enemy, because I'm sure what's happening currently is that it's looking for ANY instance of the player to get hit. An easy work around to this though could be to make two separate Player instances for both teams?

  • mudmask & TabloidA

    When i first started with the photon plugin.

    I used the multiplayer example from the first post.

    It had the same latency mudmask is showing.

    This example capx photon provides, has a event raised for movement, but it is not set at each tick.

    They have it set at like 0.2 seconds interval.

    As soon as i removed that the latency was as good as gone.

    So be sure to check that raising the motion of player characters.

    Do it at each tick, or remove that condition completely.

  • Savvy001 Alright, here's what I have currently: http://i.imgur.com/WWjySN0.png

    The opposing player is now in fact destroyed, except it doesn't need to be hit by the bullet to do so. Right when I press Shift.

    It seems I need to find a way identify that the bullet hits only the enemy, because I'm sure what's happening currently is that it's looking for ANY instance of the player to get hit. An easy work around to this though could be to make two separate Player instances for both teams?

    TabloidA

    Just add a variable to the bullet.

    When you fire the bullet, set it to photon.myactornr

    Then on collision with the bullet add the condition:

    Player.actornr "does not equal" photon.myactornr

    Then you when you shoot, the bullet can't hit you.

    In my game the bullets all have actornr variables to figure out who hits who

    And keeping the bullets from hitting the player who fired them.

  • TabloidA

    Also, make sure to use 2 different bullet types of each bullet.

    1 Dummy (spawning on your pc, not harming anyone, this one is purely for visual reference)

    2 Real Bullet (spawning on the other players pc's, harming them when they are being hit)

    Imagine NOT doing this what would happen.

    You fire a gun.

    Bullets get spawned on both pc's, both harming the other player, and both sending event data to the other one.

    This clutters up the data on the photon server, and it could trigger multiple hits when actually it was only 1.

    The right way would be:

    You fire a gun.

    You see a dummy bullet flying.

    All the other players see the "real" bullet flying.

    The player is being hit with the real bullet.

    His game checks if the bullet.actornr is the same as his Photon.myactornr

    If true, then life is substracted, the bullet is destroyed and a event is sent to all other players with the update players life.

  • Savvy001 Alright, here's what I have currently: http://i.imgur.com/WWjySN0.png

    The opposing player is now in fact destroyed, except it doesn't need to be hit by the bullet to do so. Right when I press Shift.

    It seems I need to find a way identify that the bullet hits only the enemy, because I'm sure what's happening currently is that it's looking for ANY instance of the player to get hit. An easy work around to this though could be to make two separate Player instances for both teams?

    PS: The fact that the player does not need to be hit by a bullet to be killed is because you inverted the event 8 and 9.

    Looking at your image event 8 and 9 say: Player.actornr DOES NOT = photon.eventdata

    It should be: Player.actornr = photon.eventdata

    Somehow you inverted those events "THE RED X".

  • thanks TabloidA

    Savvy001 - ok so, here's essentially what I'm doing for both plugins:

    1. I'm using setbit/getbit for the player's inputs

    2. I have it check for whenever the player's input variable changes, it raises and event that sends out that particular players inputs to the other players

    3. that input is then synced with the corresponding player objects on the other screens

    So essentially, it's not even raising events to sync positions at regular intervals. to account for discrepancies though, I raise two events that sync X and Y for each player every .5 seconds. Maybe I'll fold that in to a token though.

    Anyways - is that not a good method? Can you go more in depth into how you would do that, to achieve relatively smooth movement with low latency?

  • mudmask

    With Photon there is no need to use setbit/getbit.

    That logic only applies to the C2 multiplayer object.

    Check the tutorial https://www.scirra.com/tutorials/5023/how-to-build-a-multiplayer-game-with-photon

    The part where they say: Send your Position to every player.

    They do the x/y in 2 events, but with tokenat it can be done in 1 event.

    Here is a screenshot from my wip, you can see how it handles the x/y position of players.

    If you want fluid motion, this is the way to go. (and lerp the position on receiving the event)

    Also (just to be sure) photon does not need as much host to peer management, because in a cloud there is actually no host.

    So syncing objects can be done by picking the photon.masteractornr and setting a variable in the game to host = true.

    But if you do not have to, then you can choose a other route.

    This had my mind occupied for a while.

  • Savvy001, OK that makes sense! how does that work with jumping for example? will a lerp still do the trick? And what about animations? Just raise more events?

  • mudmask

    Lerp will do the trick just make it lerp fast enough but still smooth.

    Animations depends.

    If a player shoots you already have that event raised.

    So on receiving that event you can set the animation.

    For the players movement animations just add that info to the data you are sending when raising the event of player x & y

    Then you can set it that way uppon receiving.

  • so Savvy001 - do you know if the premium plans increase speed at all?

  • mudmask

    I dont know.

    Good question for ThePhotons

  • so Savvy001 - do you know if the premium plans increase speed at all?

    We never decrease speed intentionally.

    To get the best of Photon, you need to use UDP which is not available in Constuct2 for obvious reasons. Websockets are slower.

  • ThePhotons

    Can you explain what those obvious reasons are?

    Because the official multiplayer object from scirra does support UDP.

    (As taken from the manual) https://www.scirra.com/manual/174/multiplayer

    The Multiplayer object supports a number of features to enable low-latency gameplay over the Internet:

    UDP-based transmission for minimal latency avoiding head-of-line blocking, with optional reliable modes

    NAT traversal to connect through common router/network setups

    Compensation for poor quality connections with high latency, packet delay variation (PDV), and packet loss

    Maybe i do not understand correctly, but if the official C2 MP object can do it, then why not the Photon Multiplayer plugin.

    If we can get more speed with this UDP method, we would love to see it implemented.

    Photon is the way to go.

  • ThePhotons - I second Savvy001, and I'd gladly jump on a bigger plan if I could just nail down the latency issue. As it stands right now, I can't really see how that amount of latency can be fun or competitive.

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