Mud Engine + Server running on Mac OS X

As of tonight, the Mud Engine has been tested and runs on Macs running OS X. I was even able to wire up the server and get a OS X server running with the game.

Thanks to how the server was refactored into the adapter pattern I adopted a couple of weeks ago, it took very little code to wire up a OS X based server.

The code

class MainClass
{
    public static void Main(string[] args)
    {
        SetupMessageBrokering ();

        var bootstrap = new Bootstrap ();
        bool startupCompleted = false;
        bootstrap.Initialize ((game, server) =>
        {
            // Start the game loop.
            while(game.IsRunning)
            {
                if (!startupCompleted)
                {
                    startupCompleted = true;
                }

                Thread.Sleep(1);
            }
        });

        while(!startupCompleted)
        {
            Thread.Sleep (1);
        }
    }

    static void SetupMessageBrokering()
    {
        MessageBrokerFactory.Instance.Subscribe<InfoMessage>(
            (msg, subscription) => Console.WriteLine(msg.Content));

        MessageBrokerFactory.Instance.Subscribe<GameMessage>(
            (msg, subscription) => Console.WriteLine(msg.Content));

        MessageBrokerFactory.Instance.Subscribe<PlayerCreatedMessage>(
            (msg, sub) => Console.WriteLine("Player connected."));

        MessageBrokerFactory.Instance.Subscribe<PlayerDeletionMessage>(
            (msg, sub) =>
        {
            Console.WriteLine("Player disconnected.");
        });
    }
}

This code should look almost identical to the source previously posted showing the Mud Engine server running on Windows. The only difference is that I abstracted the code that can be shared across the two platforms into a bootstrap. The shared code is stuff like configuring the server and game, setting up the game and adapter and starting the game.

As development of the engine continues, I will regularly check and make sure it builds on OS X. The engine itself and its server should always run cross-platform without any issues.

I'm not sure yet what I am going to do in regards to the designer tools. Initially I was going to write it as a XAML app for Windows. Considering that the engine can now run on OS X (and I will be testing it on Linux soon), I might reconsider and look at a more cross-platform UI approach. Perhaps that would be a good excuse for me to pick up the new cross-platform ASP.Net MVC 6 stuff Microsoft is doing, and build a cross-platform self-contained web application for the designer.

Anyway, I wanted to share the progress on my cross-plat goals. At the moment, everything seems to be working just fine between Windows and OS X.