[Plugin] Photon Cloud

Post your completed addons to share with the community

Post » Mon Oct 31, 2016 1:54 am

TabloidA wrote:@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".
B
59
S
21
G
14
Posts: 779
Reputation: 13,927

Post » Mon Oct 31, 2016 2:46 am

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?
B
74
S
19
G
9
Posts: 377
Reputation: 9,258

Post » Mon Oct 31, 2016 4:14 pm

@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.
Image

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.
B
59
S
21
G
14
Posts: 779
Reputation: 13,927

Post » Mon Oct 31, 2016 6:26 pm

@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?
B
74
S
19
G
9
Posts: 377
Reputation: 9,258

Post » Mon Oct 31, 2016 6:55 pm

@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.
B
59
S
21
G
14
Posts: 779
Reputation: 13,927

Post » Tue Nov 01, 2016 3:17 am

so @Savvy001 - do you know if the premium plans increase speed at all?
B
74
S
19
G
9
Posts: 377
Reputation: 9,258

Post » Tue Nov 01, 2016 8:03 am

@mudmask

I dont know.
Good question for @ThePhotons
B
59
S
21
G
14
Posts: 779
Reputation: 13,927

Post » Tue Nov 01, 2016 3:47 pm

mudmask wrote: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.
B
7
S
2
Posts: 172
Reputation: 1,027

Post » Tue Nov 01, 2016 4:19 pm

@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.
B
59
S
21
G
14
Posts: 779
Reputation: 13,927

Post » Tue Nov 01, 2016 6:50 pm

@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.
B
74
S
19
G
9
Posts: 377
Reputation: 9,258

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: irina and 2 guests