The Spaceteam Admiral's Club is a community of friends and fans of the game [Spaceteam]
. Anyone can create an account but there are special rewards if you support my future projects by becoming a paying member
Join the Admiral's Club
- Henry (aka Captain Spaceteam)
CaptainsMess first release
I've released the first version of my CaptainsMess networking library for Unity!CaptainsMess on GitHub
So far it only supports Wifi but I'm planning to add Bluetooth at some point.
Please use this thread for questions, suggestions, and general discussion about the library.
The simplest game I could think of that would demonstrate a progressing game state is first to three of a random number provided by a button press of each user. (User presses button, number rolled displayed to everyone, once all button's pressed/numbers generated, they are compared, winner gets point or tie awards no points).
On a different note, if two players are connected, and either cancels, the non-canceled players screen is either "..." for host and "Lobby" for clients. I think this message should be "Disconnected" or otherwise let the user know that they need to give action to continue trying to find a game.
Thank you for making this open source. Networking has always been my biggest hurdle in game creation.
Same with the "Lobby" text field: I wanted to provide a bare minimum example but it certainly has some issues.
The network and game states are handled a bit better, but they're not perfect yet. And I'm still figuring out how to prevent the NetworkManager from changing scenes as it's connecting.
Thank you so much for releasing this. Already hit the ground running with it and it's totally exceeding my expectations.
Is there any way to test a game with multiple players on one device? Separate builds don't seem to work like standard Unity networking. I'm running out of devices to test on.
Unfortunately you can't have multiple players on one device at the moment. It could probably be added since Unity's lobby system does allow multiple players per connection, but I haven't looked into it.
Feel free to experiment!
For my own local testing I often run the game on my desktop computer and laptop, which is quicker and easier that testing on real devices.
For testing on a local device, there are some minor issues but I can get away with it fairly easily by tweaking CaptainsMessNetworkManager
On line 159:
bool isMe = (aServer.peerId == peerId);
I simply add the line following:
isMe = false;
This isn't a long term nor great solution, and some issues are caused when trying to auto connect. But for "I want to get 5 instances on the same machine to join together for basic testing" situations, works fine for me.
Thank you so much. I no longer have to have to use 3 laptops and my phone to test. You are a life saver
In the next version I'll make sure that the lobby is re-opened after the game is over.
First of all i want to thanks for sharing this project.
I'n not too good in network programming, so i want to ask for your help.
I'm trying to make different GUI for host and client and when host press a button at client must changes something, for example to appear a text.
Can you give me some advises ?
The example included with the CaptainsMess project has a simple game where each person presses a button and then the game does some calculations and changes some text. It's not great but it's a starting point.
For the game you're describing I would send a ClientRpc message when the host presses their button and then the client can display the text when they receive it.
You can learn how to use Unity's High-Level Networking API from the official documentation here: https://docs.unity3d.com/Manual/UNetUsingHLAPI.html
But, honest, i was working a week with no resultant and yesterday i tried ClientRpc and it worked.
Thanks one more time for this awesome project!
Have a nice day.
Can you please tell me if i can use your project for 3D real-time game ? I'm trying to see another player, but with no results
I recommend following the Unity tutorials for setting up a networked game (without CaptainsMess). Once you have something basic working then you can add CaptainsMess later to make connections easier.
I'm trying to make connection using a constant IP, but i can't find where is essential connection code for this.
Can you please help me?
Sorry, find it in Client script - server.ip
On the other hand, if you usually don't know the IP and you are trying to handle a special case... then carry on!
The code that starts the connection once the IP address has been discovered is in CaptainsMessNetworkManager::JoinServer
I have an issue though. I am running Unity 5.5.1f1
I host a game with Machine A, and then join with Machine B. When I leave the lobby with Machine B, I get an error on Machine A. I created a youtube video to better explain the issue I am having.
I also had another question that may be tangentially related. If I join a game (on an Android device) and then I force quit the app, is there a way I can detect that on the host?? When I do it in the CaptainsMess library, it doesn't seem to be able to instantaneously detect it. When running the SpaceTeam game and doing the same test, I notice that it can instantaneously detect it and kick the other players back to the title screen.
The way it works now is a compromise but it could definitely be improved.
I seem to remember having a hard time changing it at runtime though, so good luck!