A couple of basic questions

I’ve got a FPS-style game that has been entirely single-player up until now. I’m exploring options to rework it to allow multi-player support. After an initial pass at this, I encountered a number of issues with how I designed my application, based on assumptions that are true in a stand-alone game, but not true in a network game. I have a couple of general questions on how to proceed with some of my implementation of multi-player.

  1. Supporting both multi-player and single-player levels : It seems that as soon as I put a Network Identifier on my “player” prefab, it preventing me from playing any of my single-player levels. Assuming I’m using the same Player prefab in both my single player and networked levels, do I need to dynamically add/delete the network identifier from the prefab, depending on whether the scene is a multi-player or single-player level?

  2. I have a lot of UI code (HUD, pause screen, changing game options, etc). That’s currently handled by a global “GameManager” class I have, which drops the UI object into the scene. My understanding is that I’ll need to rework all of that UI such that each player has their own one of these UI objects, so that each player could be looking at a different set of UI screens at any given time. So, in general, does all of the UI in my game need to be associated with a NetworkBehavior class, and all interaction filtered by isLocalPlayer?

Thanks,

-Dan

  1. Objects with a NetworkIdentity component attached are set to be unloaded and not spawned in until the server spawns them in. Basically what you can do is just have your game treat single player modes as multiplayer, the only difference being is that there’s only one player. You won’t have any lag because you’re “connected” to yourself, and everything will work the same no matter how many players you have connected.

  2. Unless each player specifically needs to know what menu screen another player might be on, there’s no reason to really network anything relating to the menus outside of maybe letting other players know that a player is paused. For example, why would Player 3 need to know that Player 1 is changing his audio settings, or if he’s changing his controls? You will need to do some stuff to make sure that each players’ UI is tracking the correct player, but that’s about it.

Thanks, Crynryn. The first point makes complete sense. I hadn’t thought of that.

With your second response, I think you’ve highlighting something I’m less clear on. Let’s say my scene has a GameObject in which my “Options” screen is contained. The scene start with the UI canvas disabled, and whenever the player presses “Escape” it enables the canvas and shows the Options UI. If I don’t attach any networking to this object, then I interpret your statement to mean that when player 1 presses “Escape”, his version of the Options UI will be enabled in his client, but that won’t affect the other players’ Options UI? So, essentially, anything that isn’t “networked” will behave completely independent on each player’s client?

Thanks very much for your response. I think it sets me on a better path.

Correct, there’s no way for one client to know about another client doing something unless you send the data that says they are doing something. As long as it isn’t networked and synchronized (meaning you’re sending data pertaining to the status of an object), you can have completely local objects that are completely independent of every other player.