Simpler way to do 2D multiplayer?

Hey folks, I’ve got some 2D multiplayer plans and I think I’m probably over complicating things and wanted to bounce some ideas around. My game is basically a 2-player shooting gallery, with both players shooting each other’s objects while also controlling the movement of their own. Client/server-client multiplayer is what I’m working on.

In the game, the layout is such that the players are “facing” each other, so while one player sees the other player’s object(s) and shoots them with mouse clicks, they are also moving their own objects back and forth using arrow keys or WASD. Here’s a rough example of how a level might look:

alt text

My original plan, was just to have both of these layouts in the same scene, with Player 1 looking at one and the Player 2 looking at the other. The controls for Player 1 would also be applied (and reversed) to the Player 1 objects for the view that Player 2 sees, and vice versa. Is this the easiest way to achieve the effect I’m going for or is there a cleaner way?

Any help is greatly appreciated. Thanks guys and gals!

I’m not sure how a single scene could be oriented to change like that in 2d. It looks like they would HAVE to have different positions (or something else) on each client.

For a single shared scene, I would actually have a 3D scene, where each player has their “target row” and a CAMERA and an empty object that is the parent of both of these. (I’d probably set up a pre-fab for this.)

I would place each on opposite sides of the XY plane, and orient them (using the empty parent object’s transform.localRotatation) to face each other (180 degrees, about the y-axis)

Each player/client shows only THIER camera on-screen, and WSAD controls only their own “target row”. (Note that since you have them rotated by the parent object- as long as the WSAD controls affect only the “target row’s” transform’s local Position (model-space), your controls and camera don’t need to be concerned with which direction the player is actually facing, in world-space).

Game wise: going 3D would also make it easy to increase the “distance” between players.

You can find your answer here:

Unity has this built it, you simply need to configure it. :wink: