How do I update sprite location same on both sides using construct 2 with photon multiplayer.

1 favourites
  • 5 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Pong game using construct 2 with photon

    Hello guys, I have made simple pong game just for seeing if photon can be used to make smooth multiplayer games.

    But I am facing serious issue now.

    Consider a scenario : A ball in pong game moves on its own and the moment change happens only either paddle hits the ball or ball gets hit on walls.

    I have used every Tick event ( which is just to show that this event runs every tick i know that)

    Ball only moving at player 1's game and player 1 sends ball position every tick to player 1.

    But I am facing extreme lag as if Data is getting loss in between and not receiving all the data sent.

    So then I have used another approach of sending angel of motion and bullet speed to both players and that how Ball is moving smoothly until paddle hits ball which can change paddle's angel and then both balls are going in different directions.

    I am confused whether photon is not giving smoothness or maybe I'm doing something wrong

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To improve the gameplay experience, the multiplayer engine interpolates between updates for values like X and Y co-ordinates. In the case of positions, it will linearly interpolate between updates. For example if data is coming in every other frame, then the frame which does not receive an update will use a value half way between the two updates either side. This makes the motion smooth again without needing any more data.

    The official multiplayer plugin has interpolation built in. You will probably need to implement this yourself if Photon does not have it built in. (I imagine it should, so check Photon documentation on how to handle it)

    After interpolation is applied on the peer side, you will want a way to reconciliate any differences from actual synced positions when they become available from the host. These differences can vary due to latency. The official plugin will "fast forward" or "slowdown" the engine based on latency to compensate, which is a more advanced method. A simpler way would just be to adjust/tween the predicted position to the actual position over the course of a multiplayer tick/update.

    These concepts are described here

    I have no experience with Photon though, so you'll need to find out the equivalent features in Photon. I'm 99% sure Photon has this sort of basic functionality, you'll just need to find out how to use it.

  • oosyrag

    First of all, Thank you very much for answering and addressimg really important points.

    I have worked on construct 2 multiplayer and what I want is to change all the games to photon as Construct multiplayer have network issues and all NAT stuff.

    Anyway, Photon doesn't have any documentation for their plugin at the moment and they are just telling us to check out provided tutorials by other developers and try to learn it and use it as per your need.

    i have checked pretty much all the options in photon plugin they aren't providing anything regarding syncing, interpolation and lag compensation.

    I have made one game using photon and converted one from C2/3 multiplayer to photon.

    But I got stuck in this situation.

    sharing ball positions to each player as ball will be moving constantly

    Thanks again.😊😊😊

  • It looks like interpolation is included as part of the Photon BOLT product's functionality.

    You'll need to implement it yourself, locally, otherwise.

    Regarding the network and NAT issues on the official plugin, 99% of those can be solved by simply adding a TURN server to your ICE list. These are usually not free, and therefore there are none added by default. I know some users have found free solutions in the past though, at least for low utilization/traffic.

  • I'll surely read it. I am also working on unity using photon and god! Its easy cause most of the complex things are handled by photon itself.

    You'll need to implement it

    yourself, locally, otherwise.

    I will surely look for a way!

    99% of those can be solved by simply adding a TURN server to your ICE list.

    Well, Yes, I have read many forums and stuff about NAT stuff.

    But I can't afford to pay for just making game playable as I just want games to be there to play. And I just wanna try if games which I have made works fine and if people like it. If they like it then I'll surely adding many things too.

    But that's in the future time.

    I hope I can find easier solution for this photon thing.

    Atleast photon doesn't have issue with network I can still make turn based multiplayer

    Anyway thanks for pointing out on issues I should focus on. :)

    Multiplayer is tough as Ashley said 🤣🤣

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