hengineer / captainsmess Goto Github PK
View Code? Open in Web Editor NEWA local multiplayer networking library for making games like Spaceteam in Unity
License: MIT License
A local multiplayer networking library for making games like Spaceteam in Unity
License: MIT License
I am trying to open the project with the specified Unity3D version. But a seria of popup windows with error message appearing: "Failed to load window layout. This can happen if layout contains custom windows and there are compile errors in the project, Load default layout / Revert Factory Settings / Quit"
I am developing in Unity 2019.1.4f1, and when I am trying to connect different devices through specific Wifi connection, the connection will be blocked and all devices cannot connect to the same lobby. But when I switch to other Wifi including mobile hotspot, the local connection works properly.
Are there any solutions like changing the protocol to avoid being blocked by firewalls or secure system?
I tried connecting through Unity editor and also the space team app in different Wifi environments, it only works in specif wifi connections and didn't report any errors or warnings during the connection.
Thanks for your time!
With the right timing (2 devices connecting at the same time), it is possible to make CaptainsMess to throw an exception.
It seems that, after creating a server, a new server discovery arrives and then it (also) tries to join to that server. This is the full log:
OnStartConnecting
#CaptainsMess# StartHosting
#CaptainsMess# Should join!
(Exception) A connection has already been set as ready. There can only be one.
(Exception) ClientScene::AddPlayer: playerControllerId of 0 already in use.
I solved it myself adding a internal state variable "hostingServer" and using it as a guard, ignoring any server discovery if CM already hosting a server:
public void OnDiscoveredServer(DiscoveredServer aServer)
{
if (verboseLogging) {
Debug.Log("#CaptainsMess# Discovered " + aServer.rawData);
}
if (hostingServer)
{
if (verboseLogging)
{
Debug.Log("#CaptainsMess# Already hosting a server, ignoring " + aServer.rawData);
}
return;
}
...
Don't know if it is the best solution, but it avoids the exception and the app can still run correctly :-) . If you like it I can do a pull request.
Cheers, Néstor.
Hi! I found that if wifi connection is lost while CaptainsMess is finding a server or the game already started, the following message appears after disconnecting and trying to connect again.
By some reason host doesn't have broadcast addreses
UnityEngine.Networking.NetworkDiscovery:StartAsServer()
CaptainsMessServer:RestartBroadcastInternal() (at Assets/CaptainsMess/CaptainsMessServer.cs:106)
This can be reproduced easily in the ExampleScene by:
I found a solution here here: http://forum.unity3d.com/threads/broadcast-discovery-already-running-startbroadcast-failed-err-8-startserver-listen-failed.357852/
adding a NetworkTransport.Init(); at the beginning of CaptainsMessNetworkManager.AutoConnect()
and NetworkTransport.Shutdown(); at the end of CaptainsMessNetworkManager.Cancel() solves the issue.
Cheers Néstor.
I just compiled this demo to two iOS devices. Tracking and connection seems to work, but how do you access the shared worldMap to place objects? I'm surprised this example doesn't show anything done in AR once it's connected. Any advice would be greatly appreciated.
Minor issue, but thought I'd document it as I noticed it.
The "Network" class was for Unity's old multiplayer system. It is still included for legacy reasons on platforms like Windows, Mac, Android, etc. But it is not included on the newer "Windows Store" build target for Windows 8.1 or Windows 10
The line in question is #21:
serverString += "Hosting at " + Network.player.ipAddress + "\n";
I tried searching around, but I didn't see an easy/direct replacement for getting the current device's actual local IP address (rather than something less useful like "localhost")
Luckily, since this is just debug information, I commented out the line and now things seem to be working nicely for Windows Store builds.
May be worth trying to find an alternate method to get the local IP in order to allow for maximum cross platform compatibility. Also because Network is deprecated, it may be removed in future versions.
Since the point is to just copy the Captain's Mess files into your own Unity project, shouldn't the files in ProjectSettings not be tracked/included as part of the Git repo?
Hey, is this still WIFI only? :) We're just starting our BLE stuff now and were just curious where you'd gotten to.
I downloaded Spaceteam on a Motorola Moto G2 with Marshmallow and I cannot enter the lobby, I stay in the black hole.
I don't know where to find debug logs to identify where the error comes from.
Tested on two different wi-fi networks without success.
alots of error with new version of unity
kindly please fixed them
After upgrade. I get those errors:
"The type or namespace name 'NetworkSystem' does not exist in the namespace 'UnityEngine.Networking' (are you missing an assembly reference?
"
"
Assets/CaptainsMess/CaptainsMessClient.cs(23,35): error CS0246: The type or namespace name 'NetworkDiscovery' could not be found (are you missing a using directive or an assembly reference?)
"
I guess cause the networking library was updated
Hi again! sorry for the spam, but I've been doing intensive test to this module as we are preparing a prototype using it. If you don't mind I'll keep posting bugs and what I did to fix it.
How to reproduce the error:
set broadcast identifier to "asdasd2"
try to connect.
The set broadcast key is negative and Unity launches an exception.
I solved it just by setting the absolute value of the identifier hashcode instead of just the hashcode itself.
hi
what do you think of this?
https://assetstore.unity.com/packages/tools/network/bluetooth-networking-for-ios-tvos-and-android-124274
i'm going to buy and test it.. sounds working
On Android, when connected to an IPv6-only network, NetworkDiscovery does not seem to work. It gives the following error:
By some reason host doesn't have broadcast addreses
On iOS, the error does not show up, but it doesn't discover other devices. I suspect it's because iOS still issues an internal IPv4 address.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.