- Home /
Networking - 2 Scenes where one i selection and other actual game
Alrighty, I've immersed myself into networking this weekend and I succesfuly done all the tutorials about it and now I'm trying to create my own Template Game to test learned stuff and take it to the next level.
All of the tuts I've seen so far have 1 scene and dont bother with loading actual game which is the essence of game networking, stating that they don't want to complicate things. Well you should because that's the way networking is. Anyway I've created two scenes: First is the selection scene where you can select your character (cube ^^) and the other is actual playground where u can run around.
The thing I need explained is following: How to make server which has multiple games and then you connect to one of those. This implies that you cannot have game active on server so you can watch how the players move, meaning that no player can be server. Can this be done with Unity Networking?
Also on other tutorials which have 1 scene they have player on server side also which can move around his cube, but given the approach with loading scenes, I cannot load scene when server is
Answer by homer_3 · Apr 28, 2014 at 03:26 AM
This is a pretty big task (one I'm working on currently). There are also multiple solutions. One option (which is the one I'm doing) is to have a stand alone server program that accepts messages from your game and manages all the game rooms. I wrote my server in C++, but you can use whatever language you want. The Unity game connects to the server and tells it that it either wants to create a new game room or it can ask for all the current game rooms. In the 2nd case, the server sends the info back to the Unity game and you have to display it to the user so he can pick which room he wants to join.
In order to do this across multiple scenes, you need to create a global, static Socket object so it doesn't get destroyed when a new scene is loaded. Then always reference that socket when you want to send or receive data.
Answer by MDarkwing · Apr 28, 2014 at 08:06 AM
Thank you thought it was something like that. I've read that Unity's Master Server is open source, do you think that can be remodeled for this?
Your answer
Follow this Question
Related Questions
Multiplayer Level Loading 1 Answer
Architecture for a network game- problems with events 0 Answers
Room change error in multiplayer 0 Answers
Audio disappers after Application.LoadLevel 2 Answers
Online levels database 0 Answers