Handling 4 Players. Combine Events

Discussion and feedback on Construct 2

Post » Thu Nov 07, 2013 6:06 pm

Hi Guys!

I am working on a single device multiplayer game for tablets
***-->Main Thread: Jelly Jam!<--**
And I have big trouble with handling events for all players without writing the same event for every player over and over again.

In my game i want to have different cooldown times. at first I used a cooldown plugin which worked like that:


I wasn't happy with it because I couldn't reduce the cooldown for every player. I tried nearly EVERYTHING with families, instance variables and stuff like that.

The latest thing i came up with is a cooldown-system that uses an array.
Here's a live preview:
Cooldown-System with an Array

and here's the .capx
https://drive.google.com/file/d/0B9IR6fhnjEUvUnpyRzRCWW9Od0k/edit?usp=sharing

Here is a sketch for the Array i use:



My Array system is like 10 times more complicated then my system I had before which had 10 times more events but does not work half as good!

If you click the buttons fast or click one while the other is on cooldown, the system gets bugged really fast.!
Why is it not working properly?

what would you guys recommend for creating games with multiple players?

with placeholders this would be like the easiest task ever.
On touched p*_button : p*_char - spawn p*_bullet

where * can stand for player 1,2,3 or 4.

please help me, it's really grinding my gears.
ask me if you need further information.

by the way I made a similar post 2 and a half months ago, but no one answered. Maybie you can imagine my problem better if you also have a look at this:
Old Thread


cheers! Philphilx2013-11-12 19:31:12
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Thu Nov 07, 2013 7:15 pm

I'll take a look today when I have some more time. If there is no answer that is :D
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Post » Thu Nov 07, 2013 7:22 pm

@jayderyu
I actually got something to work 5 minutes ago. I'll post it here tomorrow.
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Thu Nov 07, 2013 10:01 pm

Use functions.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203

Post » Thu Nov 07, 2013 11:42 pm

[QUOTE=philx] @jayderyu
I actually got something to work 5 minutes ago. I'll post it here tomorrow.[/QUOTE]

Awesome. good work :)
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Post » Fri Nov 08, 2013 1:14 am

instead of sepperate keys, use 1 touch object with vars, spawn that, give it variables like: name and action.

ie
name: player 1
action: moveleft



on layout start spawn all objects on desired locations

Make 1 input on touch event for the spawned objects.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Fri Nov 08, 2013 5:30 pm

[QUOTE=lennaert] instead of sepperate keys, use 1 touch object with vars, spawn that, give it variables like: name and action.

ie
name: player 1
action: moveleft



on layout start spawn all objects on desired locations

Make 1 input on touch event for the spawned objects.[/QUOTE]
[QUOTE=lennaert]

ok. that sounds interesting. Are you talking of something like Sprites with different UID's ?
You cant creat them if you hold control while you drag a sprite.

couldn't you use family variables then?

and how would you go on with the movement events then?

on "Buttons" touched (family)
---> if player variable = 1 -> move player 1 to the left

?? could you explain?
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Fri Nov 08, 2013 5:31 pm

[QUOTE=jayderyu] [QUOTE=philx] @jayderyu
I actually got something to work 5 minutes ago. I'll post it here tomorrow.[/QUOTE]

Awesome. good work :)[/QUOTE]

i didn't get it done. and haven't got time at the weekend but i will definetly work on it a lot on monday. and i hope i can post it on monday evening.

How have you dealt with the movement in your multiplayer game? Have you created something like this yet?
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Fri Nov 08, 2013 5:54 pm

[QUOTE=philx] [QUOTE=lennaert] instead of sepperate keys, use 1 touch object with vars, spawn that, give it variables like: name and action.

ie
name: player 1
action: moveleft



on layout start spawn all objects on desired locations

Make 1 input on touch event for the spawned objects.[/QUOTE]
[QUOTE=lennaert]

ok. that sounds interesting. Are you talking of something like Sprites with different UID's ?
You cant creat them if you hold control while you drag a sprite.

couldn't you use family variables then?

and how would you go on with the movement events then?

on "Buttons" touched (family)
---> if player variable = 1 -> move player 1 to the left

?? could you explain?[/QUOTE]


check the test page

Its part of a game im making, I stripped of the other stuff, was quicker then rebuilding, lol


Its an on screen login keyboard

If you pres any key it appears in the top input box

I added some compare stuff, and see what happens if you press x,y or z



Capx
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592

Post » Fri Nov 08, 2013 6:00 pm

I create a variable called PLAYER in botht he controller objects and the Player object.

Then when a controller object is pressed. I have direct access to the Player ID. Which then I compare to create a SOL of just that 1 player.
B
92
S
18
G
9
Posts: 2,455
Reputation: 15,113

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Yahoo [Bot] and 15 guests