Multiplayer Platformer Engine Problems

Get help using Construct 2

Post » Sun Feb 02, 2014 6:59 pm

I had an older topic about this engine, but I think I might as well start a new one, considering it's been a couple of months.

For context: I have a modular platform engine with multiplayer functionality that can incorporate any number of characters who can interact with each other, using a linked series of objects, starting with two objects for a Player, and a second object to handle that player's controls, enabling customization for controls. The second set of objects is the actual player character and the 'skin' that visually represents that character, both objects are also assigned to families. To make this work, 'for each' loops are used to link the Platform object with the right input object. Certain events that can't go in this specific loop, such as trigger events, go in a separate set of sub-events.

Well, here's my problem - while this is all fine and dandy when every player character is unique, but if there are two players with the same character, then there are inevitable conflicts. Player 1 will control just fine, but Player 2 will not only control slightly differently, but also hang up at the end of certain animations, which are supposed to transition back to the "main" action. Note that the problem areas are triggers.

Now, the big question is, how do I get both players to work exactly the same without having to create a whole bunch of new events to work around the triggers?

.capx here, of the stripped-down version of my engine with just one character with two players, for simplicity. Requires r159, Personal/Business Edition.

Controls:
Player 1: WASD for movement, hold Shift for running, mouse buttons for attacking.
Player 2: Arrow keys for movement, JKL; keys for jumping, basic attack and running, and control for secondary attack.


Sorry about the lack of comments in the events, but hopefully you'll be able to get a good idea of what I'm trying to do with them.
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Sun Feb 02, 2014 9:02 pm

You should be creating custom variables to ID each player object. relying on different player objects is not a good way to design anykind of multi control system.

1 Player object, create isntances, name each instance for each player
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Sun Feb 02, 2014 9:50 pm

I really don't see how that would remotely help at all, unless you're suggesting merging the Player, Input and Character objects completely. Which, aside from this resulting in a ridiculous amount of variable bloat for each object, I still don't see how it would help much, since you still have to deal with the skins.

Edit: Actually, you know what? I'll give it a shot, and hope it works. We'll see.Candescence2014-02-02 22:03:12
B
94
S
37
G
11
Posts: 404
Reputation: 11,275

Post » Mon Feb 03, 2014 2:22 pm

So, I tried merging the Player_Stats, Input and Platformer objects into a single object, and much to my surprise, the end result works... Sort of. Apologies to @jayderyu, I was mistaken. I guess I can work with a more bloated set of variables in exchange for better functionality.

Here's how I have it now:



(Alternatively, the "for each skin" events are packaged with its own seperate "for each MultiPlayer" loop, rather than being sub-events, they seems to work the same either way)

While, for some reason Agumon works perfectly when there's two or more of them, Renamon and Gabumon, when there is duplicates, results in, well, complications. Neither Renamon or Gabumon can turn around, and Gabumon's attacks, depending on the target, can cause unrelated players to be damaged.

Well, I think I might be able to fix this by duplicating Agumon's events and modifying them to accommodate Renamon and Gabumon to see if that solves the problem, but I'm not sure. We'll see. Either way, the current solution does work better for 'duplicate characters' when it comes to just one particular character, it seems.Candescence2014-02-03 14:25:08
B
94
S
37
G
11
Posts: 404
Reputation: 11,275


Return to How do I....?

Who is online

Users browsing this forum: mikehive and 11 guests