[Plugin] Photon Cloud

Post your completed addons to share with the community

Post » Sat Oct 29, 2016 3:00 pm

@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.
B
58
S
20
G
13
Posts: 775
Reputation: 13,314

Post » Sat Oct 29, 2016 4:53 pm

@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
I like giving game advice more than I actually like making games ;)

Image
B
40
S
15
G
3
Posts: 129
Reputation: 4,651

Post » Sat Oct 29, 2016 4:58 pm

@TabloidA

How do you handle the collision for the player being hit.
Can you add a few screenshots?
B
58
S
20
G
13
Posts: 775
Reputation: 13,314

Post » Sun Oct 30, 2016 1:47 pm

@Savvy001 Here you go: http://i.imgur.com/mpm3Lm7.png
I like giving game advice more than I actually like making games ;)

Image
B
40
S
15
G
3
Posts: 129
Reputation: 4,651

Post » Sun Oct 30, 2016 3:25 pm

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
B
58
S
20
G
13
Posts: 775
Reputation: 13,314

Post » Sun Oct 30, 2016 3:46 pm

@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
I like giving game advice more than I actually like making games ;)

Image
B
40
S
15
G
3
Posts: 129
Reputation: 4,651

Post » Sun Oct 30, 2016 4:05 pm

@TabloidA

Great.
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.
B
58
S
20
G
13
Posts: 775
Reputation: 13,314

Post » Sun Oct 30, 2016 9:04 pm

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:
http://threesevenhosting.com/builds/spaceraiders/alt/

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!
Last edited by mudmask on Sun Oct 30, 2016 9:41 pm, edited 1 time in total.
B
66
S
16
G
9
Posts: 372
Reputation: 8,748

Post » Sun Oct 30, 2016 9:10 pm

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
B
66
S
16
G
9
Posts: 372
Reputation: 8,748

Post » Sun Oct 30, 2016 9:33 pm

hey - who was in there just now?
B
66
S
16
G
9
Posts: 372
Reputation: 8,748

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: Lawrence310x and 6 guests