For those Unity devs who need an alternative solution to the Unity Technologies hosted servers, dimeRocker is pleased to offer dRock Servers: a Unity MasterServer, NAT Facilitator and Connection Tester conveniently located in North America.
While you’re at it, sign-up so we can keep you posted on all the Unity APIs we are developing specifically to allow web devs like to deploy, enrich, recoup and manage Unity content across the web - all from one centralized source!
Sign-up: http://dimerocker.com/devsignup/
dRock Server Deets:
port: 12345
port: 50000
port: 10735
The IPs for these servers may change, but the subdomains will always point where you need to go. You will need to resolve the URLs to IPs to connect from within your Unity game. Here’s snippets to do that.
Javascript:
var masterServerUrl = "masterserver.dimerocker.com";
var ip = System.Net.Dns.GetHostEntry (masterServerUrl);
var ipA = ip.AddressList;
if (ipA.Length > 0)
{
MasterServer.ipAddress = ipA[0].ToString();
MasterServer.port = masterServerPort;
}
C#:
using System.Net;
string masterServerUrl = "masterserver.dimerocker.com";
IPHostEntry ip = Dns.GetHostEntry (masterServerUrl);
IPAddress[] ipA = ip.AddressList;
if (ipA.Length > 0)
{
MasterServer.ipAddress = ipA[0].ToString();
MasterServer.port = masterServerPort;
}
EDIT:
As Leepo from wooglie.com points out, using the .Net System assembly can result in ~800K being added to your game, so this may not be an ideal solution for web games.
As an alternative, you can use a getip.php script on our server, which will resolve an url for you.
You’ll want to do it as a Coroutine, and before you make any network connection tests or poll the master server.
For example:
C#:
StartCoroutine(GetServerIPs());
while (!gotIPs)
yield return new WaitForSeconds(0.1f);
...
IEnumerator GetServerIPs()
{
// masterserver
WWW www = new WWW("http://www.dimerocker.com/api/getip.php?url=masterserver.dimerocker.com");
while (![url]www.isDone[/url])
yield return new WaitForSeconds(0.1f);
string masterServerIP = [url]www.data;[/url]
// nat facilitator
www = new WWW("http://www.dimerocker.com/api/getip.php?url=facilitator.dimerocker.com");
while (![url]www.isDone[/url])
yield return new WaitForSeconds(0.1f);
string natFacilitatorIP = [url]www.data;[/url]
// connection tester
www = new WWW("http://www.dimerocker.com/api/getip.php?url=connectiontester.dimerocker.com");
while (![url]www.isDone[/url])
yield return new WaitForSeconds(0.1f);
string connectionTesterIP = [url]www.data;[/url]
gotIPs = true;
yield break;
}
\m/on Leepo!
For more info:
Those in Vancouver immediately after Casual Connect join us for the launch of www.unityusersgroup.com. (going live July 24th)
For more info on event workshop: Eventbrite - Discover the Best Local Events & Things to Do
…or simply scroll down in Unity Gossip.
Hope to see you all there!