- Home /
Architecture for a network game- problems with events
Hi,
I'm intending to develop a simple multiplayer fps with Unity. I know that's not very innovative but it's just meant to be fun. After digging through the various tutorials I think I got the idea and started making a few notes to come up with an easy but flexible architecture. Here's my plan. I wish to build several scenes to handle the players.
- 1 Scene : This scene contains the necessary connect GUI. "Do you want to start a server/connect to a server". If the player presses "start server", a new GUI is displayed to select a map. This is loaded.
Now we have to distinguish. The server actually chooses the map and sets up the game. A simple client however receives upon connection an RPC to load the map the server has chosen.
- 2 Scene : This is the "standard" Unity level. It features a terrain, ammo crates, and most important: an object that listens to "OnServerInitialized" and "OnConnectedToServer" to spawn a player prefab
Actually there will be many 2. scenes with each of them being a unique map that can be chosen in the first scene.
So far, so unity.
Now, here's my problem:
In the various examples - Unity Networking Example and others- there was always only one map that had "everything" with everything being:
- Connect GUI
- some kind of "spawnscript", "playerspawn", "spawn", ...
- environment
Thus the spawnscript listened to "OnServerInitialized" and "OnConnectedToServer" events that were fired within its own level. I suddenly realised that it's not very probable that they are available in my 2. scenes/the maps, too. At least "OnServerInitialized" is due to be cast in the first scene. Can you help me ?
- Is there a flaw in this architecture. Where should I improve/ change
- Is there another event that might serve my needs ?
Thank you for your help.
Your answer
Follow this Question
Related Questions
networkink and load level 0 Answers
How to avoid spawn delay on client? 0 Answers
UnityScript not recognizing NetworkServer "Unknown Identifier" 0 Answers
UNET Network.Spawn and child objects 1 Answer