Hi,
i just submitted a “bonjour” plugin for Android on the asset store.
This plugin use multi-casting for service registration and discovery in local area networks between android devices, and so allow easy multiplayer games discovery via WIFI without the use of a “MasterServer”.
From the readme:
============
| ABonjour |
============
ABonjour is a "bonjour" plugin for android free/pro.
ABonjour use multi-casting for service registration and discovery in local area networks between android devices, based on JmDNS.
Advantages:
===========
- Easy to use: call "Register" to register a service/server, "Discover" to discover a service/server
- Multithreaded: service registration and discovery done in background
- Return a "HostData" object for easy integration with Unity networking (Network.Connect)
- Written in C#
Usage:
======
- Drag "ABonjour.cs" script to any GameObject
- Call "Register" on server, "Discover" on client
- Add REQUIRED PERMISSIONS below to your "AndroidManifest.xml" file,
or simply rename the "AndroidManifest.dummy.xml" file in "Plugins/Android" folder to "AndroidManifest.xml".
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
Simple usage, on the server side:
void StartServer()
{
bonjour.Dispose( delegate( bool status )
{
bonjour.Register( "ServiceTest", "Level 1", "Welcome to the party!", 5555, delegate( HostData hostData )
{
if( hostData != null )
{
Log( hostData );
}
else
{
Debug.LogError( "Could not bind service" );
}
});
});
}
On the client side:
void StartClient()
{
bonjour.Dispose( delegate( bool status )
{
bonjour.Discover( "ServiceTest", delegate( HostData hostData )
{
if( hostData != null )
{
Log( hostData );
}
else
{
Debug.LogError( "Could not find service" );
}
});
});
}
Only three functions:
public void Register( string gameType, string gameName, string gameComment, int port, System.Action<HostData> cb );
public void Discover( string gameType, System.Action<HostData> cb );
public void Dispose( System.Action<bool> cb );
20$ on the Asset Store : https://www.assetstore.unity3d.com/#/search/abonjour