Saturday, April 30, 2011

Agile Game Development: Magicka

Update 2011.05.09: Arrowhead posted a reply to this post.

This post is a tribute to a company which, judging by the looks of it, is kicking ass, agile style.

"This sprint is really going down the drain" from the first scene
of Magicka in adventure mode.
What's this about
The company is called Arrowhead Game Studios, and they've made a game called Magicka.

Now, I'm not going to write so much about the game itself, but it's awesome. I used to play a lot of computer games growing up, all the way through my studies. Since then, it's been pretty sporadic. Until I tried out Magicka. I've been playing it for over 50 hours, which is pretty good value-for-money, considering it cost 10€ (plus DLC's, which are a point I'll come back to later).

How successful is it?
In the first 17 days it was for sale, it sold over 200.000 copies. At times it topped the stats for most-selling game on Steam, at one point selling 30.000 copies in 24 hours. Its gotten pretty good reviews all round, and some rather high ranking game reviewers have completely fallen for the game.

Take into account that this is an indie game which was/is developed by eight Swedish students turned game developers. The only other game I've heard of that comes close to this phenomenon is Minecraft.

Why is it agile?
They ship early and they ship often.

Early because they launched the game while it was still early alpha and crap-full of bugs. Often, cause after they went live on Steam they were patching on a daily basis (the Steam automatically upgrades the game, a bit like the Windows update). Since then they've eased down to more of a weekly release cycle.

Now for those of you who haven't been playing a lot of computer games lately, to me this is pretty radical. A big "Hollywood" game usually takes weeks to produce their first (well needed) patches, some times even months.

Lots of people have been complaining about the instability of the game and the bugs from early on. Then again, so do many big budget games. For a small company of eight developers, it's hard to keep coverage of all possible hardware drivers and configurations, so this is understandable. 

But they fix the problems continuously. These releases are pumped out so regularly that I hardly notice them anymore. They've gotten really good at not letting new bugs slip through. This is continuous delivery.

Humble, Open and Honest
The developers seem incredibly involved with their users. As an apology for the early buggy releases of the game, they released a new avatar in: The Mea Culpa Wizard (granted some new magical powers: summon bugs, and the spell Crash To Desktop). By now you can probably guess that there's a lot of geek humor in there.

They communicate frequently with the world through twitter and forums. They often take in suggestions from players into patches and new changes. They post release notes and weekly community updates.

They are honest, continuously maintaining a list of things they know are still buggy. They admit it when they mess up and they apologize. They say thanks when they get feedback.

Even though I've never met them, it feels like the developers are practically my buddies, eager to understand and help me have the best possible gaming experience.

I really had to smile when I saw the Scrum board from the first scene in the game (see screenshot in the top of this post). I mean, how many gamers out there know what Scrum is? That is clearly a wink to other devs out there :)

Pay per use
Its important for the developers to keep the players happy, and keeping them playing, also after that they bought the game. They've shipped some downloadable content, some of it is free, others cost a few euros.

I bought the game for 10€. I then bought the Vietnam extension for 5€, and then I *had* to get the latest level as well for a meager 2€. Later on they are going to release Player-vs-player mode (PvP) for free, due to heavy demand among the fans.

They are tip-toeing the fine line of keeping players paying for more, while not giving the impression that they are exploiting (like some other games have tried).

Courage
Arrowhead have really challenged a lot of the existing conventions in the gaming industry. They heavily under-priced (games are usually 30-50€). They launched the game without a 6 month QA period. They did no traditional marketing (apart from getting on Steam, which was probably a big part of the lift-off). They sit down to play and discuss the game, while streaming it online. It's a spelled-based game where there is no mana-bar, for crying out loud!

Rounding off..
The XP values are Communication, Feedback, Simplicity, Courage and Respect. I think these really ring through every time I have read on the forums. Just to paste some quotes from their change log announcements:

From early on:
Right now we've got so many players posting on the steam forums we're having a hard time keeping up answering posts. But we're reading all of them and are adding stuff to our "to-do"-list. [...] We'll monitor your response closely and keep patching the game as often as possible. Please let us know if the patch helped!
Later on:
We (devs and publisher) are still super committed to fix stuff that's broken and make sure you guys can have a great time with the game. Additionally we've also have a bunch of improvements planned and will be patched in as soon as the major issues are out of the way! These are based directly off your input.
Later:
As we've released new patches we're seeing much fewer reports of the game malfunctioning. More and more players are reporting that the game is working nicely for them. We're also noticing that the problems that exist are A) known and being worked on and B) centered around fewer different things. 
And then things are really becoming stable:
So the last patch squashed a lot of bugs and we're glad to report that we're getting fewer error reports and the reports we're getting are about a smaller number of problems.
So we're definitely getting where we want to go! BUT that doesn't mean we're done. We'll keep updating the game and improve it as we go along. We will also try to add additional features that you guys are requesting. 
And since then they've done another ten patches. This is agile straight out of the book (or into it, depending on how you look at it). Really inspiring to see how successful they are.

Update 2011.05.09: Arrowhead posted a reply to this post.

Saturday, April 23, 2011

Agile Lean Europe: Some thoughts

Just jotting down some thoughts..

A couple of weeks ago, I drove up to Düsseldorf to attend the Scrumtisch Rhein/Ruhr meeting, because the topic was this new Agile/Lean Europe (ALE) Network. Olaf Lewitz facilitated the discussion ( credits to CodeCentric for the free beverages/food).

I first heard about this network in this discussion in the Norwegian agile forum, initiated by Sergey Dmitriev and followed up on by Johannes Brodwall.

Olaf and Deborah Preuss were both involved in the Agile Coach Camp in Norway earlier this year, and I suspect that they already discussed some of these things there. This makes for a firm connection between the German and Norwegian agile scene, and I hope to be able to support this bridge somehow.

Now, why does this European interconnection matter anyway? 
I'll give you three reasons why it matters to me personally:

1) It's no fun doing it aloneAgile is deeply nested with social drive. While it's perfectly fine to drive on the social forces within a closed community (say, the German agile scene), it gets a lot more interesting if we know that this is an international effort. Knowing that other countries are interested adds motivation.

2) A mirror for our culture
We make changes based on feedback and inspection. For the sake of fresh perspectives, we often use externals (consultants, coaches) for gaining insight. Agile depends heavily on, and influences, culture. Ergo, for a fresh perspective, we might benefit from using externals from other cultures/countries.

(One thing is organizations of business, another thing is getting feedback on how our communities are operating.)

3) Synergy, or re-using knowledge and experience in other countries
If I spent hundreds of hours creating some crystallized knowledge on how to deal with some particular problem (like introducing agile in public sector), it would be an awful shame if it only came to the benefit of the few thousand potentially interested in my country. Letting other countries benefit from the same knowledge is win/win.

A few thoughts on Germany/Norway in particular

There are limits to how much we can absorb from American (and even British) experience reports. Germany and Norway are both social-security oriented economies, with conservative innovation habits, well on the way into privatizing a bunch of former national institutions (rail, telecom, post/logistics, health).

So we have a lot of things in common. And if I may say, people are very similar in regards to personality and behavior (the way we eat, drink, talk, politeness, etc.). But Norway is tiny and Germany is huge, which makes Norway a bit like a miniature test-lab for Germany. What works on in Norway could work in Germany on a larger scale.

To name one example: The traditional rejection of agile projects in Norway's public sector projects was overcome some few years ago by (among other things) the creation of an agile contract standard, the PS2000 agile. Since then, several successful projects have made use of this contract, both in public and private sector.

Is this a lesson we could port to Germany somehow?

Also check out Kurt Häusler's thoughts in this post and Olaf Lewitz's summary from the Düsseldorf meeting. Both of them, as well as Johannes Brodwall are attending the ALE Network events at the XP Madrid conference in a couple of weeks.

Sunday, April 03, 2011

The Dreaded Service Locator Pattern

Torbjørn Marø recently blogged about Dependency Injection, due to Mark Seeman visiting the Norwegian .Net User Group in Bergen. This triggered my thinking about the dreaded Service Locator.

I have worked with several teams that favored a home-made ServiceLocator class, a static component referencing a set of services, typically chunks of functionality that are singletons that interact with something external like database, filesystem, or web-service.

My beef with the Service Locator is that you can put it in, and use it from anywhere: It can be used to grab services in a controller/action component, inside a service, in a domain object, inside a for-loop, anywhere. This sounds pretty powerful, but ends up bringing in a lot of maintenance problems.

Now, in spite of my troublesome experiences with it, I keep finding myself being pretty lousy at explaining the disadvantages of a ServiceLocator to my peers.

I therefore hunted through Seeman's blog for some better explanations, and here's what I found:

He totally nails it in the first post:
Service Locator is a well-known pattern, and since it was described by Martin Fowler, it must be good, right?
No, it’s actually an anti-pattern and should be avoided.
Let’s examine why this is so. In short, the problem with Service Locator is that it hides a class’ dependencies, causing run-time errors instead of compile-time errors, as well as making the code more difficult to maintain because it becomes unclear when you would be introducing a breaking change.
Also have a look at the comments for some more discussion and affirmation.

Seeman has also written a book on the subject of DI, and Service Locator is discussed within. I haven't read it, but it sounds pretty good, especially if you work with .Net.

In case you got a little lost in his C# examples, here's my own take on it:

Let's say you want to test a CustomerRepository (an already initialized field in this test class):

@Test customerRepositoryHasCustomers {
  assertTrue(customerRepository.hasCustomers());
}

Bang! This explodes in a null-pointer because you haven't injected the proper services that are used inside the hasCustomers method (via ServiceLocator). So you try again:

@Test customerRepositoryHasCustomers {
  ServiceLocator.setRemoteCustomerService(new MockCustomerService());
  assertTrue(customerRepository.hasCustomers());
}
Bang again! This is because there is another service which is used inside the hasCustomers method a little later. 

As you can see, once you know what you need, the ServiceLocator is pretty straight forward to use.  And you don't notice this need during runtime, because the ServiceLocator is fully populated during startup.  

(This explains why the Service Locator being a perfectly fine pattern for those who don't enjoy writing tests.)

Then there's the maintenance issue: If you change the hasCustomers method to make use of even more services, you won't discover that the tests are broken until you run them again. Also the other way around: If you remove use of services in the method, you aren't reminded to remove this superflous setup from your tests.

In total, Service Locator removes a whole lot of compile-time verification that would be nice to have. Again, this doesn't matter much for those who don't write tests.

But, it does matter for the over all drive towards good code and architecture. Quoting Mark Seeman again (from the end of the third post):
Refactoring from Service Locator to Abstract Factories make it more painful to violate the SRP.
Using Service Locators breaks the window that usually stops you from giving a class too much responsibility. Usually, when you see the number of constructor, or method arguments are towering past a handful, you start thinking "refactor?". But with the Service Locator in use, you don't get this reaction.