David Whitney

 

The Death of Middle Tier Games Studios

December 18th, 2008

So, it looks like Free Radical, a Nottingham based games studio, closed its doors today. 

The surrounding scenario isn’t a pretty read (or at least the picture the gaming press paints isn’t) and it’s the latest in a trend of SME sized games developers folding despite the games industry growing month on month with disregard to the current economic climate.  Month after month websites like Gamasutra seem to report record sales of both console hardware and games (and that’s ignoring the Wii shaped monolithic elephant in the corner).

To directly quote a Kotaku commenter (Pyrefly)

“All that will emerge will be EA, Ubisoft and Activision with each consoles respective first party devs. It would be awful for all us gamers to keep losing more and more studios.”

This seems to be the pervading feeling amongst gamers but I can’t help feel that it might be slightly off target.  Nobody likes to see the little guys fail.  In any community people love rooting for the people they can identify with, with the human faces to development.  However, I just can’t help feeling that the studios currently suffering aren’t just suffering as a result of the economic climate, but more because of the evolving nature of games development. 

Gamers seem to be pointing fingers blindly at the mega-publishers as the cause of the collapse of these small studios but I can’t help feel that this isn’t really the case.  It appears as if they’re really just the victims of technological progression in a time of restricted finances.

Nobody likes seeing the little guys fail, but just to single out today’s example.  From memory (and a little wikipedia verification), Free Radical were formed as an offshoot of Rare, started by some of the Goldeneye and Perfect Dark team.  They had pedigree and went on to produce (what wikipedia claims) is the “highest-ranked first person shooter on the Playstation 2″, Timesplitters.  Since then, they’ve released a few Timesplitters sequels, Second Sight on the xbox, Haze on the Playstation 3 and they were apparently working on an unknown Lucasarts game (speculatively, Star Wars: Battlefront 3).

I’m going to go out on a limb here, I never played second sight (though I hear it was decent), I disliked all of the Timesplitters games (they had no soul, and I found them utterly trite) and Haze (which I also haven’t played) was critically panned and a commercial failure.  In my own personal opinion, their games sucked (straw-man here, they’re not terrible, but I’d not choose to play them).

Don’t kick a man while he’s down, I know.  I’m sure the developers that worked at Free Radical are exceptionally talented.  Technologically, their products all seemed very sound and polished, but from the rundown, they’re not exactly iD software or Epic.  They probably fall into the “averagely reviewed, decent sales” bracket of games companies.

I don’t think what happened to Free Radical today was necessarily their fault.  Whilst people point the finger at the big publishers for not supporting enough SME innovation, I think actually this is indicative of the diverging nature of game development at the moment.

This year has seen the resurgence of the tiny independent game studios using the new content delivery channels, operating outside of the bounds of the current mega-publishers and there seems to be an increasing little and large divide to games development.

The middle tier seems to be being either gobbled up by majors (perhaps saved from bankruptcy) or collapsing and if I were to suggest a reason, I’d say that it’s probably indicative of the increased pressure of producing “AAA quality” games for the current generation of consoles.

You can’t produce a Halo 3 or Mass Effect on a shoestring budget anymore.  You either have to think really big and get help from a large publisher (EA have done some great work this year with games like Mirrors Edge and Dead Space, Ubisoft I’d argue have been doing great work for a number of years), or you need to actually scale down to smaller productions to be competitive with a smaller team.

Huge titles are plagued by content creation, gamers want more re-playability and value for money.  Your games have to look fantastic.  You have to be able to afford expensive middleware engines and components. 

Middle tier, under resourced attempts at AAA grade titles end up like Haze and Too Human it seems, whilst gems like Braid and World of Goo thrive in their microcosm and appear to be sustainable and competitive in their corner of the market (I have no idea what the financial rewards of small productions look like, to be clear and open).

I guess there’s always the option of pushing out a bunch of Wii shovelware if you’re an SME that’s running out of ideas, I hear people buy anything with added waggle.

At the end of the day while we’re losing more studios I’m curious if we’re actually loosing talent.  I’m not sure what the job markets like for a game developer, but I’d have thought that actual talent tends to get re-employed.  Your average coder producing average games might suffer, but anyone with a stellar portfolio (or even a half decent one) in an industry so starved of skills must be re-employable?  I guess the bigger risk is losing game development talent to other areas of computer science where jobs are seemingly more secure and the work is less based around a sustained 8 month crunch.  You really have to be in it for the love of games or be working for a good company (as seemingly the scenario this morning at free radical proved, the staff appear to have been quite badly treated in the last few hours).

I just suspect that the industry is going through a period of restructuring at the moment.  Maybe it’s time for the major labels to stand up for more than just profit margins and defend the culture that helps them thrive.  But at the end of the day, the SME with world class talent will probably be just fine.  Look at iD, I’m sure John Carmack isn’t too worried that somehow his skill set will become irrelevant and he won’t be able to compete.

It genuinely is always sad to see the little guys go, you often need the space in a small company to come up with some of the most brilliant ideas, and as a fellow developer, I know how intellectually nourishing small team environments are, I just hope that the majors that hold the financial security (or what’s left of it) choose to nourish and re-house these individuals so everyone can thrive (and more importantly, keep making great games for me to play).

I don’t work on games, and I’m just a casual observer of the games industry, albeit an enthusiastic one, so take everything above with a pinch of salt.  This has been one of the best years for games I can remember, I just hope this year end doesn’t wipe out lots of talented developers.

On How I Learnt More About Business And People From World of Warcraft Than From "Corporate Life"

December 1st, 2008

I value time.  In fact, I value time above all else, I really believe it’s the only commodity that you never get back.  I’m not a religious man, I hope something great happens when you die, I’ll settle for something interesting, the thought of nothing terrifies me.

So when I say I’m a “recovering” World of Warcraft player with (well) over 100 days /played over three years (not ultra-hardcore, but reasonably so) and I haven’t logged in for over two months, many people would probably react in utter confusion as to how somebody that values his time so highly can so fruitlessly waste it on a repetitive game like WoW.

It’d probably also surprise you to know that when I look back on my life and mentally prepare the list of “things I regret”, I don’t think that spending three years playing WoW will be on that list.  There are lots of things I regret about playing Warcraft.  I regret missing films, the odd social event, I regret angering my partner, I regret putting on weight, I regret being the caricature that South Park made so famous, but I don’t regret playing the game.

I spent a good year and a quarter of my time playing WoW as an officer and raid leader in a medium sized, social, adult raiding guild (hello “Home of the Ghost Lords”!) and I loved every second of it.  I spent a good four months driving home from work during my lunch hours to plan raids, running through sign-ups for that evening.  I spent all my evenings reading up and planning subsequent raids, and I spent the time in between raid start and getting home quickly raid-prepping whilst eating off my lap.  Sounds like the rock and roll lifestyle, I know.

The funny thing about a medium to large sized Warcraft guild is that it functions as a tidy little ecosystem representative to some degree of the larger world, much like high school.  Only in this world, instead of teens desperately trying to find themselves, you’re paired with adults with the largest sense of entitlement you’ll ever meet.  That’s not a criticism per se, it’s just the attitude that emerges regardless of best intentions.  The other curious thing that emerges, is that you start identifying the traits of natural leaders easily.

A natural leader, in any realm, is a rare and delicate commodity.  I’m no fan of middle management and business meta-work and I believe that anyone that desires to have power over their peers should never be given an ounce of it.  That’s the archetype of a bad manager at work, someone obstructive and destructive to a team dynamic.  World of Warcraft encourages the most unlikely of natural leaders to come forward and do what they do best, they naturally lead.

There’s a very special kind of chemistry that just works when a raid is planned by somebody that nobody will argue with.  They don’t not argue because the leader has a singular vision that’s universally approved.  Often far from it, they don’t argue out of respect and trust in someone with such presence that they’re willing to see through the raid on his judgement alone.

These are the people you need leading your business projects, your art projects, your rock bands.  These are your superstars, your thinkers, and the people that should be given control, often without themselves realising it.

You learn a few things when you’re managing a team of 25-40 people every night.  The first thing you learn is how to say no.  In business, it’s easy to say no, any unobservant middle manager type can say no to something.  Try saying no to 10 people who are paying for the privilege to attend.  Once you learn how to say no with tact and grace, you never forget.  You learn politics far surpassing your average workplace micro-dramas.  You learn team selection.  You learn to play to individual strengths and weaknesses with subtlety.  You learn how to use humour to control a crowd and how to be serious to drive one.  You learn to trust strangers to do their jobs.  But most importantly of all, you learn how to keep moral up (WoW wipe nights aren’t anyone’s idea of fun).

You also start to notice the anti-patterns and their real world equivalents.  You notice the meta-workers.  Anyone that’s played the game will be able to identify them.  The rogue that browses wowhead for 16 hours a day checking out gear upgrades only to stop raiding when he achieves them.  You know who to flag up as a no-show or unreliable team member, you can identify the middle managers of the world, the players that re-open endless debate on trite subjects of non-interest just to make a noise.  The sales people / DPSers that are all talk and no performance.  And you always notice the people that just never meet deadlines, whilst simultaneously hoping that they’re not your healers.

You also notice that however hard they try, people that just aren’t leaders will never be able to learn to be.

I’m a software developer by trade, so there’s a certain amusement value that comes from seeing these same stereotypes in the work environment, purely because the type of mind that’s conducive to working in IT and the type of person that plays RPG’s are often one and the same, so perhaps the similarities resonate more in my field than most, but if you think you ever want to manage people, I’d recommend you try some raiding first.

I miss playing Warcraft, and I miss going to work from the night job for a bit of easy graft.  I miss the guild in particular and I played with fantastic people from all wakes of life and nationalities.  But I’ll always remember, regardless of if I relapse or not, that I had the honour to encounter three genuine leaders, even if they don’t know it yet.

Your teams are broken if your leaders aren’t doing the leading and the troops aren’t naturally rallying.

If you’re going to take anything away from this post:

  1. Always know who your leaders are
  2. Let them lead
  3. Always know who your A team are
  4. Less QQ moar pew pew

XBox Live Connection Bug - Live won’t automatically connect until you perform a network test

November 19th, 2008

I’m not sure if the XBox live team have an official bug reporting mechanism, so I’ll put this post here in the interim and hopefully a search engine or two will pick up on it.

This has no bearing on the NXE that launched today, I’ve just coincidently solved the problem.

Symptoms

XBox 360 fails to automatically connect to xbox live after power on.  If you then go and perform a network test, it’ll succeed.  Following this, live will connect fine until you power off the xbox for a time greater than a minute or two.

Cause

There appears to be a bug in the code that deals with manual network configuration of the xbox 360.  If you manually assign the console an IP address and then manually assign a DNS server but leave the DNS server discovery setting to automatic, the xbox fails to do a DNS lookup, either automatically or manually, on system startup.

Solution

If you manually assign an IP address and DNS server, ensure that the DNS lookup mode is also set to manual.

I have no idea why the console lets you configure a DNS server and then gives you the choice to use it or not, I’d have thought it’d be one or the other, and it’s a very easy mistake to make and quite tricky to diagnose.

Peer to peer networking using Windows Communication Foundation (WCF) Peer Channels and the Peer Mesh (C# .Net)

November 17th, 2008

What Is P2P?

Peer to peer communication became somewhat notorious through its use in the sharing of materials of dubious origins online.  File sharing networks like Napster, eDonkey and Kazaa made use of decentralised peer to peer communication, but there’s far more to peer to peer networking than file sharing.  Essentially, Peer to peer is a method of exchanging data between two points, without the use of a central server.  Wikipedia description here (makes for good reading).

Uses For P2P

Peer to peer networking is a great way to build decoupled message-based distributed systems.  It’s a great way of sharing the available amount of bandwidth between a series of nodes effectively, and it’s a great way to produce push-based systems.

Some obvious simple uses of p2p communication would be file sharing networks, chat networks, or large file distribution networks (e.g. Valve Software’s’ Steam platform).

In business, I’ve implemented p2p in place of solutions that were traditionally patched together using email (small notification clients that monitor other applications that send peer messages being a specific example) and p2p is ideal for these kinds of usages.

Reliability

P2P differs from traditional sockets programming in the way that it isn’t deemed a reliable communication channel.  Without your own additional logic the messages you send cannot be guaranteed to arrive, nor should they be, as peer communication is built around a “fire and forget” model.  When designing applications that use p2p, it’s important that you deal with failure conditions and program defensively.  Presume messages will be lost, however unlikely that is to actually happen.

P2P in .NET 3.0/5 - The WCF Peer Channel

In .Net 3.0, Microsoft introduced the Windows Communication Foundation, a new unified communications model for .Net developers.  The WCF Peer Channel was provided with the first release of WCF for developers to use.  The WCF Peer channel is quite easy to understand as an abstraction.  It features two main components; the peer resolver and peer participants.

The Peer Resolver

The peer resolver is the registration server for the mesh.  Whilst in principle p2p is decentralised, there needs to be a known address which a new node uses to connect to other peers.  The resolver keeps track of all node registrations, when a node connects, the resolver supplies the new node with the peer addresses of its nearest neighbours.  The node maintains an internal database of nodes, and (implementation dependant) often requires nodes to phone home at a set interval in order to advertise their membership of the mesh.

Participants

Each and every node on the mesh is a participant.  In traditional sockets programming there’s a very strong concept of connected and disconnected; not so with p2p connections.  A participant is online if it can “see” other nodes.  A participant joins the network by registering with a resolver.  The resolver then supplies the participant with a number of peer addresses that the participant then attempts to establish connections to.  When peers are found, they exchange and relay messages across the mesh.

Working examples

The rest of this piece is concerned with implementing a peer to peer network in C#, along with providing some useful helper libraries, some tests and a production-ready peer resolver.

The Persistent Peer Mesh Resolver

The Microsoft SDK provides a basic peer mesh resolver example.  Unfortunately, this resolver is stateless and as such if the resolver is restarted or crashes for any reason it looses its registration database which leads to something akin to an IRC net split if peers register with the resolver before and after a restart.  I’ve extended the default Customer Peer Mesh Resolver so that it backs up its registration database to disk and reloads any active node registrations on restart.

The bulk of the work is done by the PersistentCustomResolver class.  It’s accessible only as a thread safe singleton and manages the instantiation of a StatefulResolverService (which is an extended instance of CustomPeerResolverService from System.ServiceModel.PeerResolvers) and deals with opening a WCF endpoint for listening for new peer registrations.  The StatefulResolverService manages a PersistingRegistrationCache which backs up new peer registrations when they occur or are refreshed.

The Persistent peer mesh resolver can ultimately be used very simply in either a Windows service or a stand alone application.

Usage example:

    class Program
    {
        public static void Main()
        {
            PersistentCustomResolver.Instance.Listen();

            Console.WriteLine(”Custom resolver service is started”);
            Console.WriteLine(”CleanupInterval: {0}”, PersistentCustomResolver.Instance.CleanupInterval);
            Console.WriteLine(”RefreshInterval: {0}”, PersistentCustomResolver.Instance.RefreshInterval);

            Console.WriteLine(”Press <ENTER> to terminate service”);
            Console.ReadLine();

            PersistentCustomResolver.Instance.StopListening();
        }
    }

The resolver has two public properties, one of them (CleanupInterval) defines the length of time between the purging of inactive nodes, and the other (RefreshInterval) defines time period in which the resolver expects that active nodes will refresh their registration information.

In addition to the simple usages example above, a not insignificant amount of WCF configuration has to take place in App.config in order to allow the framework to listen correctly.

    <?xml version=”1.0″ encoding=”utf-8″ ?>
    <configuration>
      <system.serviceModel>
        <services>
          <service name=”Resolver.StatefulResolverService”>
            <host>
              <baseAddresses>
                <add baseAddress=”net.tcp://localhost/peerResolverService” />
              </baseAddresses>
            </host>
            <endpoint address=”net.tcp://localhost/peerResolverService”
                      binding=”netTcpBinding”
                      bindingConfiguration=”PeerResolverBinding”
                      contract=”System.ServiceModel.PeerResolvers.IPeerResolverContract” />
          </service>
        </services>
        <bindings>
          <netTcpBinding>
            <binding name=”PeerResolverBinding”
                     transferMode=”Buffered”
                     transactionProtocol=”OleTransactions”
                     hostNameComparisonMode=”StrongWildcard”
                     closeTimeout=”00:01:00″
                     openTimeout=”00:01:00″
                     receiveTimeout=”00:10:00″
                     sendTimeout=”00:10:00″
                     transactionFlow=”false”
                     maxBufferPoolSize=”50000000″
                     maxBufferSize=”268435455″
                     maxReceivedMessageSize=”268435455″
                     maxConnections=”10000″
                     >
              <readerQuotas
                maxDepth=”50000000″
                maxStringContentLength=”50000000″
                maxArrayLength=”50000000″
                maxBytesPerRead=”50000000″
                maxNameTableCharCount=”50000000″
              />
              <security mode=”None”/>
            </binding>
          </netTcpBinding>
        </bindings>
      </system.serviceModel>
    </configuration>

The above configuration tells the resolver to listen using the endpoint net.tcp://localhost/peerResolverService using the standard peer resolver contract.  Participants will need to be aware of this endpoint to register on the mesh.  The net.tcp binding configuration has some very large configuration values set that would likely be revised for a production system.

Joining a Peer Mesh

Connecting to a peer mesh requires two things; an active peer mesh connection, and a peer message processor.  The peer connection acts as the communication channel and the message processor instance responds to any peer events received on that connection.  I’ve encapsulated this into the class PeerMeshManager.  The PeerMeshManager class simplifies joining a mesh, leaving a mesh, and sending a message to the mesh.  It’s left to the individual implementation to instantiate a Message processor and set the public property of the PeerMeshManager appropriately, allowing the application to respond to events on the mesh.  See the following example:

    Console.Write(”Connecting to Peer Mesh…”);

    PeerMessageProcessor messageProcessor = new PeerMessageProcessor();
    messageProcessor.PeerEventRaised += messageProcessor_PeerEventRaised;
    PeerMeshManager.Instance.MessageProcessor = messageProcessor;
    PeerMeshManager.Instance.ConnectedToPeers += Instance_ConnectedToPeers;
    PeerMeshManager.Instance.DisconnectedFromPeers += Instance_DisconnectedFromPeers;
    PeerMeshManager.Instance.JoinNetwork();

The PeerMessageProcessor makes a handful of events available to the application:

    public event PeerEventHandler PeerEventRaised;
    public event UnhandledPeerEventHandler UnhandledPeerEventRaised;

    public event ConnectedHandler ConnectedPeerEventRaised;
    public event DisconnectedHandler DisconnectedPeerEventRaised;
    public event RequestPeerAnnounceHandler RequestPeerAnnouncePeerEventRaised;

The first two events are the more interesting…

  • For each peer message that is sent, PeerEventRaised will be fired.
  • If an even of a specific type is fired (say ConnectedPeerEventRaised) and there is no listener wired up to ConnectedPeerEventRaised, then UnhandledPeerEventRaised will fire for that event.
  • The specific event handlers will fire if a peer event of that type occurs on the mesh.

If you were to expand the provided source code with your own peer events, I’d recommend adding custom events for each peer event, and maintaining the above pattern (always fire a PeerEventRaised event, for every event, regardless, always fire a specific event, and always fall back to firing an UnhandledPeerEventRaised event) for consistency.

I’ve provided a few helper classes that the PeerMeshConnection uses, however I’ll skip explaining them in full.  I’ve provided two working peer applications that talk to each other.  One is a listener that listens and outputs peer messages, the other sends them in bulk.  Feel free to experiment.  The sample listener looks like this:

    class Program
    {
        static void Main()
        {
            Console.Write(”Connecting to Peer Mesh…”);

            var messageProcessor = new PeerMessageProcessor();
            messageProcessor.PeerEventRaised += messageProcessor_PeerEventRaised;
            PeerMeshManager.Instance.MessageProcessor = messageProcessor;
            PeerMeshManager.Instance.ConnectedToPeers += Instance_ConnectedToPeers;
            PeerMeshManager.Instance.DisconnectedFromPeers += Instance_DisconnectedFromPeers;
            PeerMeshManager.Instance.JoinNetwork();

            Console.Write(”Done.”);

            Console.ReadLine();
        }

        private static int _recievedCount = 0;
        static void messageProcessor_PeerEventRaised(PeerEvent e)
        {
            Console.Clear();
            Console.WriteLine(”Rcvd {0} messages.”, _recievedCount);
            Console.WriteLine(”Recieved: {0}”, e.UniqueIdentifier);
            Console.WriteLine(”App: {0}”, e.Application);
            Console.WriteLine(”From: {0}”, e.UserId);
            Console.WriteLine(”At: {0})”, e.Timestamp);
            _recievedCount++;
        }

        private static void Instance_ConnectedToPeers(object sender, EventArgs e)
        {
            Console.WriteLine(”Connected to peers.”);
        }

        private static void Instance_DisconnectedFromPeers(object sender, EventArgs e)
        {
            Console.WriteLine(”Disconnected from peers.”);
        }       
    }

and requires the configuration…

    <?xml version=”1.0″ encoding=”utf-8″ ?>
    <configuration>

        <system.serviceModel>

          <client>
             <!– chat instance participating in the mesh –>
             <endpoint name=”eclipseEndpoint”
                       address=”net.p2p://eclipseMeshTest/messages”
                       binding=”netPeerTcpBinding”
                       bindingConfiguration=”BindingCustomResolver”
                       contract=”PeerMesh2008.IPeerMessageProcessor”>
             </endpoint>
             <!– client used to communicate with the custom resolver service –>
             <endpoint name=”CustomPeerResolverEndpoint”
                       address=”net.tcp://localhost/peerResolverService”
                       binding=”netTcpBinding”
                       bindingConfiguration=”Binding3″
                       contract=”Microsoft.ServiceModel.Samples.ICustomPeerResolver”>
             </endpoint>
          </client>

          <bindings>
             <netPeerTcpBinding>
                <!– Refer to Peer channel security samples on how to configure netPeerTcpBinding for security –>
                <binding name=”BindingCustomResolver” port=”0″>
                  <security mode=”None” />
                  <resolver mode=”Custom”>
                    <custom address = “net.tcp://localhost/peerResolverService”
                                    binding=”netTcpBinding”
                                    bindingConfiguration=”Binding3″ />
                  </resolver>
              </binding>
               <binding name=”BindingDefault” port=”0″>
                 <security mode=”None”/>
                 <resolver mode=”Auto”/>            
               </binding>
             </netPeerTcpBinding>

             <netTcpBinding>
                <!– You can change security mode to enable security –>
                <binding name=”Binding3″>
                    <security mode=”None”/>
                </binding>
             </netTcpBinding>
          </bindings>

       </system.serviceModel>

    </configuration>

This configuration should allow the application to register with the persistent resolver provided and join a mesh.

The second application requires exactly the same configuration and looks like this:

    class Program
    {
        static void Main()
        {
            Console.Write(”Connecting to Peer Mesh…”);

            PeerMessageProcessor messageProcessor = new PeerMessageProcessor();
            messageProcessor.PeerEventRaised += messageProcessor_PeerEventRaised;
            PeerMeshManager.Instance.MessageProcessor = messageProcessor;
            PeerMeshManager.Instance.ConnectedToPeers += Instance_ConnectedToPeers;
            PeerMeshManager.Instance.DisconnectedFromPeers += Instance_DisconnectedFromPeers;
            PeerMeshManager.Instance.JoinNetwork();
            string input = “y”;
            while(input.ToLower()!=”n”)
            {
                DoMessages();
                Console.WriteLine(”Send messages? (Y/N)”);
                input = Console.ReadLine();

                if(string.IsNullOrEmpty(input))
                {
                    input = “y”;
                }
            }

            Console.ReadLine();
        }
        private static void Instance_ConnectedToPeers(object sender, EventArgs e)
        {
            Console.WriteLine(”Connected to peers.”);
        }

        private static void Instance_DisconnectedFromPeers(object sender, EventArgs e)
        {
            Console.WriteLine(”Disconnected from peers.”);
        }

        private static int _recievedCount = 0;
        static void messageProcessor_PeerEventRaised(PeerEvent e)
        {
            //Console.WriteLine(”Recieved: {0} from: {1}”, e.UniqueIdentifier, e.UserId);
            _recievedCount++;
        }

        private static void DoMessages()
        {
            const int defaultNumberOfMessages = 1000;

            Console.Write(”Done.”);
            Console.WriteLine();
            Console.Write(”Number of messages to send (defaults to {0})? “, defaultNumberOfMessages);
            string upperString = Console.ReadLine();

            if (string.IsNullOrEmpty(upperString))
            {
                upperString = defaultNumberOfMessages.ToString();
            }

            int upper = Int32.Parse(upperString);

            Console.WriteLine(”Sending {0} messages…”, upper);

            for (int i = 1; i <= upper; i++)
            {
                var peerEvent = new PeerEvent();
                PeerMeshManager.Instance.SendMessage(peerEvent);
                //Console.WriteLine(”Sent: {0}, GUID: {1}”, i, peerEvent.UniqueIdentifier);
            }

            Console.WriteLine(”Sent {0} messages.”, upper);
            Console.WriteLine(”Rcvd {0} messages.”, _recievedCount);
        }

In order to run the provided code, you need .Net 3.0+ (I’d recommend 3.5 SP1).  First, compile and run the resolver and leave it running.  Then run the listener application, followed by the PeerMesh sample application.  You should (firewall permitting) be able to send messages in bulk between the two applications over the peer channel.  For further tests, you could run the peer clients on different machines (remembering to change the localhost address in the app.config for the resolver) or multiple instances of the client on one/many machines.

I’ve also provided an additional project containing MbUnit tests for the persistent resolver.  They’re not required to use the samples, so feel free to remove the project if you’re having build issues.

I’ll hopefully follow up this post with a larger explanation of the classes that underpin the PeerMeshConnection in the participant, but a working example now is likely more valuable the further exposition!

I apologise for any slightly ambiguous explanations given above, this post is here to serve as a little bit of a brain dump on WCF P2P, especially as the available resources online are alarmingly slim and without useful examples.

DOWNLOAD EXAMPLE SOLUTION HERE

Do Good Things (Fable II)

October 30th, 2008

This (well last) weeks chosen game purchase was Fable II (apologies to Dead Space and Far Cry 2, I’ll probably skip on the former for the time being and get to the latter over Christmas).  I’ve been quietly hopeful about how good Fable was going to be since the first pieces of concept art of the castle in Barrowstone made their way on to the internet (how shallow of me), and unlike the unfaltering critics of the world, I’ve been pleasantly surprised by the game.

I didn’t really take to the first Fable.  It felt far too empty, framed in the context of having recently played through Planescape: Torment (late at the time) Fable managed to get far too much arcade in my RPG.  I didn’t take to it and I gave up pretty early on.  The world wasn’t big enough, it felt too linear, it felt very simple and really it wasn’t much of a roll playing game.  You didn’t play a role, you played an archetype and there really wasn’t too much of you in the character.

I then played World of Warcraft for almost three years.

Funny how that taints the way you look at games before and after, because this time when I came to play Fable II, I adored the lengths they went to to put the arcade back in to my tedious RPGs.  Mass Effect did it last year by putting a story that I was interested in back in there and Fable II apparently did it with mini-games.  I think that this time I’m enjoying Fable for what its meant to be.  It’s brought out the Warcraft inspired power gamer in me, but alarmingly, the grinds in the game somehow remain fun (I’m looking at you, tedious manual labour jobs), the world, while lighthearted enough, feels like it has some depth and the whole package looks beautiful.

My only problem with Fable II is that the morality system feels broken.  See, when I do action/adventure/RPG-with–choice type games, I always like to play the equivalent of a paladin first time around.  Not the literal paladin class, but the “for the greater good” brooding hero type.  You know the one, most games force you to play the roll, and it always feels like the ones that don’t hope you’re going to anyway.  I guess I feel like it’s my way of pandering to the game designers.  I have no desire to be a software tester, and if the game is geared towards that character type, I tend to feel quite fulfilled playing it.  The story (where applicable) tends to feel like it works well, and you get to travel through the hero’s journey and a good time is had by all.

So I started playing Fable II with the motivation of “being as good as naturally possible”.  I was nice to everyone, spent about 3 hours emoting around town pleasing the comedicly fickle folk and spent about an hour working for the blacksmith.  I started my (currently expanding) property empire and was having a great time.  Everybody loved me.  And I really mean everybody, the villagers started following me like zombies who seemingly had nothing better to do than follow me around begging for marriage / sex / my babies / a roll in the hey and my suspension of believe was totally broken.

It appears I’d been too good.  I couldn’t really do any wrong at all.  I took a (lesbian) wife, I bought us a modest house, yet the villagers still came.  I had extramarital sex with a village in my marital house with my wife in the room.  Still adores me?  Yep.  I went into the middle of town and was very nasty to lots and lots of people.  Everyone still wanted to make out?  Sure.

I backtracked to the starting village, married a man and had a kid.  Everyone was still very happy.  Bought the entire town up and they loved me even more.  I’ve stopped short of driving the town into financial ruin for the amusement value but I feel like I’ve almost ruined the game for myself by being too good.  It seems that while the game design actively encourages you to go one way or another (despite offering a sliding scale of corruption you’re allowed whilst still being good or evil) it really doesn’t know what to do with you when you get there, and really it made me realise that Fable II failed with me in exactly the same way Fable did.  I felt disconnected from the game and the character I was supposed to inhabit and no stupid (if well programmed) virtual dog (I’m a cat person) was going to keep me there.

I love Mass Effect for the sense of morality actually having impact, and I hope Biowares recent mumbling’s about trying to maintain that sense of moral responsibility in the upcoming Old Republic game comes to fruition.  I think Lionhead need to realise that good and evil isn’t just a smile/dance or fart/angry emote before they’ll get the solid emotional connection they seem to have been aiming for since Black and White.

That said, I’m really enjoying Fable II, I’ve hardly touched on the plot and spent four full evenings engrossed in its world, being a good and righteous happy capitalist.  My property empire will be the envy of all the land and I really think they’ve got the action / RPG balance spot on this time.

Now Playing: Ulver - Lyckantropen Themes - NOFVJ0224090

Toteninsel

October 20th, 2008

One of a couple of projects I have on the go at the moment is a large digital painting.  I work exceptionally slowly when producing anything vaguely creative, but I’m quite pleased with how far it’s come currently.  A little bit of this is placeholder, and this is only a preview of the top half of the illustration.  The lower half is currently mostly white, and will likely be mirrored from the top (i.e. the lower half is upside down).

It’s a little bit cooperative, being based around a piece of music currently being demo’d by King Venus (plug).  A companion piece really, illustration influenced by audio influenced by a series of well known paintings of the Isle of the Dead.

Anyhow, I work very slowly, and slowly working on this is currently my idea of relaxation, so I should be done with it by about 2020.  I jest, hopefully in the next few weeks I’ll be comfortable enough with the lower half of the image (this is the second take on the whole thing as it is).

toten-top-preview

Click it for an ever so slightly larger version (the full size thing should be somewhere in the region of 1920×1080, which is a joy to work on on those monitors I picked up not so long ago).

Losing Direction, Or Why I Don’t Understand Little Big Planet

October 20th, 2008

I’m a pretty big fan of sandbox games.  Always have been.

I was the kid that enjoyed flying around in Magic Carpet but couldn’t stand the combat (1994 me just wasn’t that interested in the quirks of early FPS aiming I guess), the kid that loved pretending that the over-world of Zelda games was infinite and I just hadn’t quite got round to checking out its extremities and I still remember my infatuation with the demo of Grand Theft Auto in 1997 (it was time limited and felt vastly different to the finished game, the change of pace changed the gameplay mechanic).  I love the sandbox, I adore Morrowind (and to a lesser degree, Oblivion), I loved killing time running about the levels of Mario 64, I loved the original Tomb Raider, Nights, anything that gives me impression that the world is infinite and worth exploring, it’s what draws me to MMOs.

With all that said, I’m not really sure about the upcoming PlayStation3 game Little Big Planet.  It’s an interesting predicament, because if anything it appear that the game is the epitome of sandbox gameplay.  A physics based platformer that…. Now here’s the thing.  I’m not really sure what Little Big Planet is really about.  I’ve read the hype (and oh god has there been hype), I’ve watched tons of videos from the (almost public) beta, but I really don’t understand what they’re trying to do with the game.  I understand that there’s a single player “story mode” that’s about 50 levels long (so we’re talking Super Mario World-esq), and I understand that the rest of the game is based around level creation and sharing, but honestly?  I just don’t get it.  I don’t think it’ll work.

As a long time PC gamer, the replayability of many of my favourite games (notably early online FPS games like Quake and Tribes, and RTS titles like the original Total Annihilation) was made by the community of hardcore devotees spending seemingly all of their free time developing mod’s and add-on’s, but I get the feeling that that kind of attitude to interactive game design has slipped by the wayside as the barrier to entry has risen.  We’ve moved from a point where the tools and the inclination for homebrew modding was there, to a world where the tools vanished, and as a result, the inclination to produce a polished add-on for a game seems to have died with them.  The PC homebrew crowd had and still has a little bit of that us-against-the-world mentality that made homebrew development so fun.

So what’re they doing with Little Big Planet?  They’re placing the tools and the caring sharing attitude right into the hands of the players.  Excellent!  I love that.  But do people really care anymore?  The 2008 console market is a vastly different place from the homebrew lands of mid-90s bedroom coding, so I’d imagine it’ll be more difficult to get gamers enthusiastic, however, creation is addictive so they’ll capture an audience that way.  Once we’re at this point however, I’m just not really sure that people will really want to play a bunch of largely mediocre 2d platform traversing levels.  I’m sure someone will do something amazing, I’ve seen some really interesting proof of concept stuff (the shadow of the colossus level that was doing the rounds a week or two ago springs to mind) however I’ve not really seen anything I’d describe as breathtaking.  Sure it’s a bit quirky and cool, but is it actually a great, compelling game?  Recent experiences with games that are based largely around user created content haven’t exactly been positive (I’m looking at you Second Life, barely a game…).

Maybe I’m missing the point.  I love 2d platform games for what they are, I’m just not sure that a game focused around disjointed downloadable experiences without any kind of special mechanic or cohesive body is really as compelling as it used to be.  I can’t see how LBP can stand up to games like Braid (as an obvious example), which actually offered something compelling and new to the genre.  Braid succeeded not because it was a platformer, but because it was clever and featured compelling narrative.  The big success stories of the last few generations of gaming (in my mind at least) have been the ones that introduce interesting narrative, the Mass Effects, the Fahrenheits / Indigo Prophecies (the first half of at least), The Longest Journeys.

I can see the joy in LBP revolving around its simplicity.  It’s a great looking game for sure, and maybe the distilled Micro Machines style fun of a console level creator are something that’s been missing from the casual market for long enough for it to be massive, but I just don’t really see the justification for the hype at the end of the day.

I hope people care enough to create something brilliant inside the sandbox Little Big Planet gives them, but I think I’ll sit on the fence until I see something really great happen before being drawn in by the hype of this one.

————–

As a side note, I’m working on a full sample implementation of Peer to peer networking in C# .NET 3.0+ that should be done in the next few days.

Information on how to correctly use the WCF PeerChannel in an Enterprise environment seems really lacklustre and we’ve been fighting our way to a really practical implementation at work.  I should have some sample code ready in a week or so with any luck.  We’re currently using similar code as the core of a distributed, push-based system in production, and whilst it’s had it’s quirks, they’re being ironed out in the sample.

Suffering so you don’t have to!

Protecting Your Software - Authorisation and You

September 30th, 2008

Piracy is always a big issue in the software industry.  It’s a global epidemic and everyone is guilty of it.  You are too, and you know it.  That doesn’t make you evil, it just means you are as morally flexible as everyone.  So taken this as a given, as a SME developing custom software, how do you protect your investment and ensure the success of your product?

First, we need to address some universal truths.

  1. All software of any value will be pirated.
  2. All copy protection mechanisms will be worked around by someone of sufficient intelligence.
  3. If you have produced a good product for sale on the open market, it will be pirated.

Stealing software is VERY easy.  Once we, as professionals, are comfortable with the fact that our products WILL be stolen, we can start attempting to maximise the sales.  In order to sell just about anything, you need to know who your target audience is.  Who exactly are you selling to?  There are four types of user…

  1. The Legitimate Customer

    If you have the pleasure of having a legitimate customer, make sure nothing stands between them and using your software.  Help them out at every turn and never obstruct their usage.  They pay your bills, remember that.  These people will pay for your software and upgrade and maintenance.  They may well all be corporate entities who under threat of inspection need to remain 100% above board (tip: Develop software for the legal industry, they’re pretty much not allowed to steal).  Home users may fall into this category simply because they don’t know they can steal software easily.

  2. The Moral Pirate

    You probably fit into this category.  You pay for software, you like to think you’re a good software citizen.  You may occasionally go to the pirate bay to grab a cracked version of an application because the demo or cripple-ware version really gets in the way of you trying the software.  You probably wouldn’t think twice about installing one copy of Windows on two separate machines however.  People can end up accidentally becoming moral pirates simply due to a lack of understanding of (often confusing) software licenses.

  3. The Immoral Pirate

    Immoral pirates use file sharing networks, Usenet, peer to peer or private FTP as their default method of software delivery.  They don’t want to pay for software.  They may believe they’re stealing, they may believe they’re in the moral clear as your product endorses evil / closed source mentalities / kills kittens.  You’ll only ever get a sale from the camp if your software is so incredibly hard to steal or find that it’s much more convenient to pay for it.  And even if that’s the case, they’re more likely to investigate an alternative first.

  4. The Career Pirate

    You will never sell a copy to this person, except if they’re actively trying to produce a crack themselves.  Career pirates will produce cracks, publish 0-Day copies of your application, and they’ll do it for the challenge.  Intricate copy protection mechanisms act as encouragement to career pirates.  The harder the better.  It’s an arms race that they will *always* win.

Coming to Terms With Piracy

The first thing you have to realise is that software piracy isn’t actually a bad thing.  Software piracy often introduces people who will later become legitimate users of your software to your product.  If you find that a vast majority of your users are stealing your software, the first thing you need to do is find out why they’re stealing instead of paying…

  • Is your software too expensive?
  • Are you pricing for business but aiming at the individual user?
  • Is the cracked version of your application actually better than the paid for edition?
  • Is your “home” offering too basic and people prefer to steal an overpriced “Professional” edition?
  • Worst of all, is your software crippled by draconian DRM?

If the answer to any of the above questions is yes, then you’re not dealing with a technical problem, you’re dealing with a social engineering and marketing issue.  It’s YOUR FAULT that your software is being stolen because you’re not selling it properly.  You have to be prepared to take responsibility for a misjudged business decision.  It’s not about blaming anyone, it’s about fixing the problem.

Targeting Your Audience

Out of the four groups of users listed above, ignore the fact that the third and fourth group exist.  You will never sell software to those people, they will steal it.  Get over it and move on.  You’re not going to stop them, don’t waste valuable time and money trying to.  Yes?  Good.

You need to protect your software in a way that it actively encourages the first and second groups of users to pay you for your hard work.  The legitimate customer is easy.  They’re going to pay.  Don’t make it hard for them.

The second group is slightly harder.  They’re probably going to pay you, but if they can steal your software really easily, they probably won’t bother.

What you need is some kind of authentication system that is reasonably simple, doesn’t hinder the users and offers some kind of advantage to the paying customer.  Now the funny thing is, this is a solved problem.  For the past decade companies have been experimenting in trying to squeeze the odd payment out of the immoral and career pirates who were not going to pay a penny to start with.  The answer is the serial number.

Serial numbers work.

If you take anything from reading this essay, please take this.

What Not To Do

The following authentication mechanisms are horrible ideas…

  • Online authentication

    Do not presume your clients have always on internet access.  If they don’t and you implement this, they WILL pirate your software or go to a competitor.

  • Products that Phone Home

    If you’ve been naive enough to saddle your software with online authentication and start thinking that products that phone home are a good idea, start thinking about what happens when that product no longer has internet access…

  • Commercial Root-kits 

    There is nothing more immoral than saddling your users machine with software they don’t know about and can’t remove, especially when it is recording their usage and using up CPU cycles.

But!  What if these authentication mechanisms can actually net me a few more sales!  Forget it.  They won’t.

The pirates will still steal, and most importantly…?

You’ll have just spent a small fortune in R&D, infrastructure and development creating a bypass-able authentication system that you then have to keep operational forever.  Unless you manage to con your users into what is essentially a software rental model, those servers of yours have to be available until the end of time, with databases of all your registered users, the level of access they’re allowed to your application and all manner of other data.

Running these oppressive registration mechanisms is expensive, and can potentially introduce defects into your pristine code.  What’s more, they can get in the way of legitimate users and paying customers, driving them to become moral pirates.  As was stated at the start of this piece, you must never put obstacles between legitimate users and paying for your software.  That is commercial suicide.

This is not to say that you should give your product away.

Protecting Your Software

Now that we’ve looked at what not to do, how on earth can we protect our software?  I really do believe in the serial number.  But a few sane coding practices can help you protect your software fairly easily.

At the simplest level, a serial key can be achieved using common Public-Private key encryption techniques.  Take some key data regarding your application (commonly something like registered user / organisation name, number of licenses granted, perhaps an email address) and encrypt it with a private key.  Your application has the public key embedded within it.  If that information decodes correctly, then the application is registered.  Simple.

But not fool proof.  I’d rather not mislead you by implying that that solution would just work perfectly.  If a cracker could isolate the portion of your code where you load the public key into memory, he could produce a cracked executable with a different public key encoded inside, and thus sign his own keys that would unlock the modified application.

The good news is that depending on your target audience, it’s almost certainly more work than your average user would bother with to steal your program (just don’t load a file from “approot\publicKey.key” and think you’re being diligent!)

The benefits of a simple solution?  Easy.

  1. It’s really really easy for users to register your software.  They pay you, they get a serial key.
  2. You need not store lots of user information for registered users, the key can be regenerated given the same inputs.  Therefore, low overhead on authentication servers as the user technically only need perform this operation once.
  3. Relatively secure, uses known cryptographic techniques.  Certainly beats some traditional “just multiply the username as bytes by some random number”.
  4. Low impact on the application as a whole.
  5. Authentication data can be changed between minor versions, breaking any key generators in the wild and making the software more inconvenient to crack a second time.

There are a few other tricks you can use.

  1. If your software is lucky enough to print out user data in some output, then you’re home free, people won’t share a serial number if their name is stamped on all the documents that the counterfeit copies produce.
  2. Don’t externalise your serial number checks in to an easily replaceable DLL / assembly.  It’s just too easy to isolate and replace.
  3. Don’t call the authentication method just once returning a boolean representing “is registered” or not, this is also easy to isolate and replace.
  4. If you use an interpreted language, user code obfuscating tools to stop simple decompilation.

Conclusion

Hopefully the above outlines have made the issue of small software piracy a little easier to understand along with explaining why obstructive software registration techniques won’t win you sales and instead often cost you both sales and development money.

Don’t fear software piracy, just attempt to give your legitimate users an experience that’ll make them want to act as your agents to their friends and associates.

You can’t pay for any marketing as effective as genuine goodwill.

Dear Google (Chrome)

September 3rd, 2008

What happened to “don’t be evil”? 

Why do you insist that people “posting or displaying the content you give Google a perpetual, irrevocable, worldwide, royalty-free, and non-exclusive license to reproduce, adapt, modify, translate, publish, publicly perform, publicly display and distribute any content which you submit, post or display on or through, the services”?

What made you think that the world needed another browser?

When you decided you wanted a browser, was the design brief “Opera, but use WebKit, and a new JavaScript implementation”?  That’s really all you produced.

JavaScript needs fixing, you’re right about that.  But if for a second you think the “correct” way to fix JavaScript is to ignore significant inroads made by other corporations and organisations in a massive “not invented here” haemorrhage then you’re very, very mistaken.

But most of all, what made you think that people won’t see this as the transparent attempt to force the hand of web standards that it is?  Seriously, let me get this straight;  When Microsoft do ActiveX and invent things like the XML RPC object, that’s evil and against standards and trying to lock everyone to Windows.  But when you create a browser and re-implement JavaScript in an attempt to force the other browsers to follow your lead in an further attempt to give Google Apps a stranglehold on the majority of “online applications” that’s just fine?

JavaScript really really needs fixing, and yes, a lot of people use GMail, but to try and suppose that the entire web is so dominated by Google Apps that a browser need be created to drive market share towards them is pure egotism, especially for a company with at most (and I’m being generous) four successful projects under it’s belt (Search, the killer app.  AdWords, the money.  Google Maps for a slick implementation and debatable GMail due to market share).  It’s lunacy to think that you’re fixing anything, rather just adding an extra layer of development and complexity on to the already arduous battle for web compatibility.

Your browser isn’t bad, it’s quite clean, it’s likely another eternal beta, but in the end, it’s just a stripped back version of Opera.  I’m sure you’ll do a good job of it, but in the end, will yet another minority browser really be worth it?  You need another hit, I really appreciate that, but try remember not to be evil on the way.

I just wish you’d put all this effort into existing technology.  One of Mozilla’s millions of prototypes (you are the sugardaddy after all) or even Opera (seeing as you like it so much) would be ideal, lets not repeat history again and again.

Geeking Out

September 3rd, 2008

There’s nothing more rewarding than programming on huge displays.  Say all you like about notebooks and pocket sized this and that, but if you really want to bed in and do some hardcore development, or graphics editing, or just a bit of browsing, whilst gaming, whilst listening to music, whilst watching videos, there’s nothing like masses of screen real estate.

For the past year and a half or so I’ve been enjoying two 19″ monitors (single monitor configurations feel very claustrophobic to me these days) and the experience has been “ok”.  However, finally the price points on reasonable 24″ monitors are right and I’ve invested in a little bit of an upgrade…

2008_3_desktop

That’s 19″ (1280×1024) - 24″ (1920×1200) - 19″ (1280×1024).  I’ve not added the numbers together to get an accurate calculation of desktop real estate, nor have I attempted to work out how much more productive the lack of task switching and windowing has made me.  But I’ll tell you what… it’s incredibly cool.  And yes, it does take up the entire length of a dining room sized table.  And no I don’t have a problem with that.

The graphics card powering the configuration is pretty simple.  People rave about the Quadro FX cards but I went with a wholly more LO-FI setup of my current-ish generation 3d card 7900GT in PCI-E x16 mode powering the 24″ in “Single display” 3d rendering mode (for gaming), along with an old (as in, in a box somewhere) 7300GT in PCI-E 2x mode (same family, easy compatibility, same driver…) powering the two 19″ displays.  Works a treat.  Finally I found a use for the fact I needlessly bought an SLI motherboard.

I can’t begin to explain how much benefit you get from dual displays (and other people have explained it far better than I could), but the third is pure luxury.  The ability to have documentation, masses of source code and a running app a glance away is priceless.

The new display is a Benq 2400.  It’s a TN panel, so graphics “enthusiasts” will probably deride its colour reproduction (TN panels can’t quite produce the same depth of colour as other panel types), however it’s well reviewed, has decent contrast ratio and response times and no dead pixels.  Looks and feels fantastic to my heathen eyes and I’d definitely recommend it (£257 inc vat.).



All contents ©David Whitney 1998-2008 unless otherwise stated.