GameManager - Data - LOCAL Multiplayer

Hi guys !

I’d like to “convert” my game to local multiplayer for a “pvp mode”.
The core of the game is already coded, the player interacts properly with my GameManager and I already can save the player progression, xp etc.

I already dealt a little bit with networking but here I’d like to have a really “retro” way to play it : 4 people in the same room, 4 controllers and let the fun begin !

Now how can I manage the extra players ? I’m not really talking about gameplay here but more about the overall structure of the my game manager.
Also, I’d like to have “persistence” of the different players (for instance if KawhiLeonardMvp unlocks the skill “flybaby” I would like him to keep his abilities and stuff the next time he joins the game)

I’m a total stranger to this subject so ANY input or advice would be really appreciated :wink:
Cheers guys !

Complicated topic.
unlocking abilities and remembering them would just require some kind of login system (to save to the right player/person).
I don’t know what you meant exactly with regard to your game manager.

For a shared game, I’d believe that you should work out which parts the server is responsible for resolving, and which parts can be carried out on the client (“out of sync” - in that they don’t have to be exact…)

Then you have to of course connect, and sync data.

Unity has some networking stuff which would probably work pretty decently for you in this scenario. Have you tried to implement anything at all, yet?

Hi man, first of thank you for trying to help out :slight_smile:
I previously worked with the Unity networking system but I wasn’t planning on actual networking here !

I was more seeing this game as a “Mario Kart” or “Smash Bros” local multiplayer ! In this case I don’t think I can/need to setup a networking system right ?
I guess the problem then could just be “multiple input controllers” for multiple players in the scene and a manager referencing the different players…

But again, how about the “persistent” side of things :confused:
I was thinking that the player data could be manage as a steam account (considering the game would be intended for Steam in the first place) but I really don’t have any experience with these side of development…

Ah okay, that makes sense when you talk about multiple controllers - my bad , sorry. I was still thinking about local multiplayer (thinking LAN in my head), when I read that, and kept on going lol…

Multiple input controllers sounds reasonable, for sure.

I don’t have any experience with Steam, so I’m not sure how that works or what’s allowed for storing that kind of data, etc…

As a note, though, if it’s meant to be played locally like that, you could save the data locally on whomever “hosts” the game(s), I mean I don’t see why not…

Maybe someone with Steam knowledge will respond :slight_smile: Good luck.

1 Like

It’s worth mentioning that you’ll have to do a minor overhaul to your audio to play any split-screen, because Unity only allows one Audio Listener. Maybe the best way to handle this is to give environmental audio sources infinite range with no rolloff, and modulate their volume based on proximity to the nearest player?

I should definitely think about the sound matter, thanks for pointing that out :wink:
I hope a “steam expert” will be able to help me more about the persistence/data side of things :slight_smile:
Thanks again

multiple controllers requires you looking into using the InputManager, not networking.
The way I did it was to create a set of inputs for each controller with similar names like “Fire1Joy1”, “Fire1Joy2”.

In script you will be accessing them based on the controller number, so the input key would look like:

//gets changed based on when it was plugged in maybe, point being it is an identifier for the controller
int joyNum

//in update
if(Input.GetButtonDown("Fire1Joy" + joyNum)){
    //whatever this button does
}

The tricky thing here will be the persistence, although you have not explained it so it might not be as complex as I think it is. It would be fine if it was simply unlocking characters like in street fighter, where it is just the console owner’s account data. If you want every player to have persistent data however, that is by no means impossible but it will be a UI design challenge, since now every player requires a login screen/account creation screen, and then be able to join the game at any point in time, or remain in a waiting state until the current running game ends.

sorry not a steam expert

Hi man, thank you for helping :slight_smile:
I’m not really moving towards a fix “character screen” like street fighter but more like the game “Gauntlet” where every player in the room log in his PS4 account and then when you select your character you keep the stuff that you already bought, your gold etc.

I guess my problem is that I don’t really know if I really wanna stick with a ONE game instance and computer or if I should implement a LAN system.
With a really old-fashioned approach and 1 system running I could create multiple “player account” in a local data folder and offer a character selection screen based on the character already created (And imagine that players are clever enough to select their own character).

However It feels like this type of gaming is really out of date and that the player should be able to play his character wherever the game is with an internet connection.
If I go that road, I guess I still don’t have to really go into networking gameplay, as I would just need to do almost the exact same thing than in the previous case, but this time I would check for the player name in a collection of name hosted wherever I want. From a UI design standpoint, the easier solution would be :

  • main player controller select in the main menu the number of players. (exemple 3players)
  • lobby screen “press select to join”
  • each player are invited to send their username
  • username is connected to the controller in a temporary local file so the players don’t have to send username every game
  • data is collected

This is almost the first thing that comes to my mind, I wrote this down so people can destroy it and show all the flaws so please, do it ^^

You really have to decide if you want multiplayer via LAN connection or all on one screen. If it’s a party game then it can be one screen, but if it’s like the first Halo game then it would be split-screen.

You can have both systems, but most devs would weigh the pros and cons of each multiplayer approach, which goes hand in hand with the experience they want for their players, or the types of players they will have for their game.

By no means a realistic example, but an example nonetheless:
If the game is going to attract more social people who game in groups, then maybe they are with other people most of the time, and local-multiplayer is more viable.

There is a more business reason for decline of local multiplayer. If one person buys a game and plays it with his 4 friends, the publisher has essentially lost 4 customers, since those 4 friends now have ready access to the game regardless.

Network based multiplayer be it LAN or Online, requires every person who wants to play the game needs to own a copy of the game, thereby selling more copies.

1 Like

Totally agree with this :slight_smile:

But a real LAN game implies a pretty hard networking dev… I already worked with Unet and Unity networking system and I have to say that it’s NOT easy.
I mean, if you wanna set a character selection screen and a one level game, yeah sure it is not so hard. But if you wanna have a fairly rich game it is really hard, or at least for a person who has not studied networking and server hosted development.

The ideal would probably be a LAN game, the realistic point of view would probably not ^^’