- Home /
Window synchronization for multiplayer?
I have two questions about topics that I've never seen covered before in any tutorials, so I'm not sure if they are possible...
1) Is it possible to synchronize two windows of the same game for multiplayer, one window having Player 1 and the other having Player 2? if so, can it be done by linking scenes up so when scene 1 opens in window one, scene 2 opens in window two? I haven't a clue how to approach this.
2) Is it possible to create a scene that is able to be loaded up in both of the windows at the same time when selected and have one window playing as player one and one as player two, so it's like having one scene between two separate windows?
Both of these will take place when the game is built, so I don't think they can be tested in unity itself.
I would be very thankful for any answers.
I think the answer to both of these is 'yes' but I'll let someone else fill in the details. Also, you should be able to test in the editor, by building the program and running it normally, then starting it in the editor and attaching to the already-running copy.
Let's look at 1) first.
It all depends on what you mean by two windows. Do you mean, 2 instances of the same Game running on the same machine but in separate windows. Or do you mean within the same game have two different views (possibly of two different scenes).
As long as you're not trying to load two scenes at once it's possible. If you mean two different instances running in separate windows on the same host, you need to write a server (fairly easy). As each client connectes, have the server tell them what scene to load. Done. I think you'll need more help but this takes us to deeper level so we can uncover more questions.
For 2) Yes, also possible using a network server but possibly in an easier way. Generally if you want two separate instances of the same game in different windows talkin gto each other you'll need to use some form of networking (or roll your own IPC in windows which will be more work).
$$anonymous$$ore generally what are you trying to do ?
Yes I do mean 2 instances of the same Game running on the same machine but in separate windows.
Question 1 is aimed more at demos of the game that play when I leave it too long on the main menu. Because the game is multiplayer, I thought that ins$$anonymous$$d of two windows showing the same thing at once, they at as one screen so the window on the left shows one half of the perspective and the right window shows the other half. This is why I thought that the editor couldn't do it.
Question 2 you've pretty much answered so thanks very much, but is the server you mentioned in your first answer the same type as the network server?
Your answer
Follow this Question
Related Questions
Multiplayer client and server aren't talking to each other properly after changing scenes 0 Answers
Change the game window built 1 Answer
Getting Scenes in Project From Editor 2 Answers
How do I change scenes when pressing a "play" button? 2 Answers
Question on Unity Project: Stealth - Chapter 1 - Video 2 at the beginning 2 Answers