Multiplayer template

Discussion and feedback on Construct 2

Post » Mon Mar 17, 2014 10:54 am

Did someone can tell me why players dont see projectiles of other players? And how to fix this of course
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,426

Post » Mon Mar 17, 2014 11:36 am

anyone?
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,426

Post » Mon Mar 17, 2014 12:45 pm

@Ashley 'Multiplayer support" or something familiar New bookmark for a set of threads and posts on the main page of forum will by nice
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,426

Post » Mon Mar 17, 2014 12:53 pm

You need for the local action to trigger only the object that's associated with the local player's PeeID.

Once you do that, you need to have the input you use to be transmitted to the host. If you check out the PEER group on the multiplayer demo, you can see what it does VS what the server does.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Mon Mar 17, 2014 1:04 pm

@Thndr ok i will try but Can you help me more if i send You capx?
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,426

Post » Mon Mar 17, 2014 2:56 pm

if I understood well
Image


But this not working for me and others
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,426

Post » Mon Mar 17, 2014 11:52 pm

@delgado
I don't have a capx. Use the Real-time Multiplayer example from C2

Also from you're image you're giving them actions locally, but not telling the host what you're doing
What you need to do is send a variable to the host that when the host receives the variable and then does the same action base on what variable it receives and transmits that action to the other peers. The example has this already coded into it.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Tue Mar 18, 2014 12:05 am

@Thndr i build game based on real time multiplayer tamplate.
Im going great but (prabably its simple but not for me) i cant figure out how other playerA can see projectile spawned by PlayerB and when PlayerA destroy for example solid wall on Player B screen this same wall is still there.
Weird dont you think?

CAPX if needed https://dl.dropboxusercontent.com/u/44710358/dbon.capx
B
111
S
28
G
48
Posts: 1,882
Reputation: 36,426

Post » Tue Mar 18, 2014 1:05 pm

You need to either sync the object (see the stuff in the Signaling group for example) or use some form of messaging (Broadcast Message in the Multiplayer object) to tell the peers what is happening so they can do it locally.

For example if you make kiblast a synced object (Position and Angle) then when you spawn a new one on the host it will spawn them on the peer clients as well.
B
8
S
2
Posts: 17
Reputation: 1,484

Post » Tue Mar 18, 2014 1:15 pm

@delgado
I'm not at my C2 computer often during the week so I won't be able to look at it, but all the information you need to know is in the Real-Time Multiplayer example. Just look at the events and see how it sends input to the host.
If you see on the PEER object that it has a variable called "inputs" that is synced, and when the Not-Host pushes a button, it moves it locally AND sends that input to the host. That input is read by the host and makes your character move on his end. Since you're playing the same game it syncs up fine 90% of the time.

The left click action spawns lasers and such so that would be the best way to figure out how to make them see it, and you can use the same information to see how it processes being hit. Since it's basic it revolves around the PEER object so it won't give the most optimal way to handle secondary objects like the wall being destroyed, but it's all the same system so you can just make the wall sync or receive a message to be destroyed.

My first assumption I'd treat it like how player-damage is treated from the laser, but there might be a method that uses less bandwidth (unless sync only sends data when it changes, then it'd probably be pretty sweet)
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests