How do I Implement Turret Behavior to a multiplayer Game

Get help using Construct 2

Post » Mon Nov 30, 2015 9:34 pm

HI!

I am trying to tackle a simple multiplayer action game (and I know it`s nowhere near of simple to implement).

Anyways, wanted to ask if there`s anyway to use turret behavior to "target" another player?

I mean like attaching turret to player (peer) and to add target enemy player (peer).

I am using the real time multiplayer example to test this out, so i do not have CAPX that would clarify this more.

Also if turret behavior cannot pick specific peer (which I suspect is the case), is there a way to pick different Peers "manually"? For example use lookX lookY variables to aim at the location of another peer. I have experimented with this but I am having really hard time picking specific peers..

Anyway, I hope some1 can point me to right direction.
B
24
S
6
G
4
Posts: 31
Reputation: 4,673

Post » Tue Dec 01, 2015 8:55 pm

UPDATE!

I`ve figured out some bits of this. I got "AutoAim" to work from host side on prototype level.

I used: set lookx to Peer(Peer.peerid<>Multiplayer.MyID).X

to pick enemy player and to set player Aim Position.

Now i need to figure out how to do this on the peer side.

Again, any help is welcome.

Also here`s Capx
https://www.dropbox.com/s/eeklkieiwswat ... .capx?dl=0
B
24
S
6
G
4
Posts: 31
Reputation: 4,673

Post » Wed Dec 02, 2015 1:23 pm

I would relay the target ID (target PeerID) and set the angle for a turret towards that peers X,Y
Who dares wins
B
53
S
13
G
11
Posts: 1,757
Reputation: 13,828

Post » Wed Dec 02, 2015 7:51 pm

Thanks for getting back to me lennaert.

I got this to work, with a little workaround.
I created separate sprite as a target for the turret. Then attached target sprite to only those peers that are not the player.

Works like a charm, but since there is now second object that moves 1 tick or in multiplayer environment 2 ticks after the peer, the latency might be an issue.

I`ll have to test this more and maybe try to find some improvements.

Thanks anyway, and here`s Capx to show my progress. https://www.dropbox.com/s/kxus09e8sqs2f ... .capx?dl=0
B
24
S
6
G
4
Posts: 31
Reputation: 4,673


Return to How do I....?

Who is online

Users browsing this forum: AekiroStudio, R0J0hound, Soulmachine and 7 guests