Hosting a Minecraft Server on Windows Azure

So you have a big complicated Minecraft world built up and you want to share it with your friends, huh? Initially, you’ll just turn your home computer into a Minecraft Server,
setup port-forwarding on your router and then share the IP address with your friends. What about that open port letting worms in? What about your home computer being too slow so
that the play is lagging? What about not being able to do anything else with your computer while your friends are exploring your world. Well, maybe you get a bright idea to host
your server somewhere else … like on the cloud. I am going to talk about hosting it on Azure.

First of all the reference for setting up the server itself is found in the Minecraft Wiki

http://www.minecraftwiki.net/wiki/Setting_up_a_server

At this point, I am wondering if your first reaction is that we are obviously going to setup this server as a Virtual Machine Role on Azure. Those were my initial thoughts as
well. You simply create a VHD locally, install the server manually and then when it is all ready and to your liking, you deploy it to the cloud, turn it on and voila: a working
server. No, we are going to do something much bolder, we’re going to start with stock Worker Role and install what we need dynamically to get to the same endpoint. Why? To avoid
having to maintain the VHD with differencing disks, and to have hope that we can serve up multiple worlds at the same time.

Moving on we are going to need the correct port number in the service definition.

<?xml version=”1.0″ encoding=”utf-8″?>
<ServiceDefinition name=”MineCraft” xmlns=”http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition”&gt;
<WorkerRole name=”MineCraftServer”>
<ConfigurationSettings>
<Setting name=”DiagnosticsConnectionString” />
</ConfigurationSettings>
<Endpoints>
<InputEndpoint name=”GameEndpoint” protocol=”tcp” port=”25565″ />
</Endpoints>
</WorkerRole>
</ServiceDefinition>

Now what about the IP address? Don’t even think about having a static IP! You can’t have that yet on Azure. We are going to have to settle for a dynamic IP. Once the server starts
it can determine what IP address it has and publish it somewhere and then you can give the address to your friends. So you’ll have this kind of code running in the worker-role.
You need to create a listener that connects to the load-balancer.

TcpListener listener = new TcpListener(
RoleEnvironment.CurrentRoleInstance.InstanceEndpoints[“GameEndpoint”].IPEndpoint);

This is one way to determine the IP upon startup of the web role.

using System.Web;
using System.Net;
using System.Text;
namespace MineCraft
{
public class WebRole : RoleEntryPoint
{
public override void Run()
{
string ipAddress = “”;

if (RoleEnvironment.CurrentRoleInstance.UpdateDomain == 0)
{
ipAddress = GetExternalIp();
}
base.Run();
}

public string GetExternalIp()
{
string whatIsMyIp = “http://automation.whatismyip.com/n09230945.asp&#8221;;
WebClient wc = new WebClient();
UTF8Encoding utf8 = new UTF8Encoding();
string text = “”; //Get the Web Role’s IP address using WhatIsMyIP.com
text = utf8.GetString(wc.DownloadData(whatIsMyIp));
IPAddress externalIp = IPAddress.Parse(text);
return externalIp.ToString();
}
}
}

You are going to need Java. Download java from http://javadl.sun.com/webapps/download/AutoDL?BundleId=63692

To install java in the startup silently use the following command line.

jre-7u4-windows-x64.exe /s INSTALLDIR=C:\Java

To be continued …

Advertisements
Tagged with:
Posted in Development
2 comments on “Hosting a Minecraft Server on Windows Azure
  1. And, let Samba know about the users with the commands:.
    Put the crafting table on your hotbar, and place it by exiting out of
    your inventory and right clicking on the ground where you
    want it placed. Downloading and installing a plugin is a fairly simple process.

  2. Any time you, are fond of entirely millions of the people throughout the planet,
    have definitely slipped in love with all goals that Minecraft is
    all about – on the contrary aren’t all that false in relation to
    purchases cash almost any month to have fun on a hosting server – then you are now living in destiny!

    As you elect to press forward with our Free Minecraft Host Current hosting treatments,
    more than just could you join in one among the world’s most typical the newest game titles (ever), but bear
    in mind you’re possibly going to be capable of doing for
    that reason with fill out and total amount regulation
    over the website server with mor vacations configurations!

    Yes, for those who decide to move on with our Freely available Minecraft
    Arranging method (courtesy of our competitive sponsors
    that us to offer this service without charge),
    you may be in comprehensive control!
    No more Hamachi or else wasting hours port forwarding,
    our nodes are website not to mention for you 24/7! Needless to say,
    a 100 % free Minecraft Server Hosting choice isn’t available
    for you. Then again, there are certainly a lot of
    “power players” everywhere which only just scratched the appear
    of Minecraft as they are looking for an amazing experience.

    Knowing how to permanently manipulate varied
    varieties and styles of settings, to add your special custom plug-ins, also to reap neighbors also family
    members is an succulent and so engaging facts that you’ll be prepared to get pleasure from!
    On our Cost free Minecraft Servers i have 27 pre-installed mods suitable for you which you will need a sudden accessibility to and you can conjointly control between each
    one of them at any time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: