This isn't meant to happen

Tonight I actually considered quitting my job because of violence in a computer game. And no, I don't work in the games industry. Nobody tell Jack Thompson. He'll get upset that he's wrong.

The writers strike and internet usage

So american TV is dead at the moment because of the strike... Does that mean that internet usage numbers are down because there's nothing to download? Isn't that what is said? Why do I suspect there's not been much of a blip at all?

Moq, doing mock objects right?

Reading Scott Hanselman's blog I came across a link to Moq, which is a mock object that uses the new C# language features in order to do it's goodness. It looks like a pretty amazingly easy to use mock framework for your unit tests that allows you to set return values from your mock objects by setting conditions through Linq. For example (shamelessly taken from their examples):

// ShouldExpectCallWithArgument
var mock = new Mock<IFoo>();

mock.Expect(x => x.DoInt(1)).Returns(11);
mock.Expect(x => x.DoInt(2)).Returns(22);

Assert.AreEqual(11, mock.Instance.DoInt(1));
Assert.AreEqual(22, mock.Instance.DoInt(2));

Which is all that is needed to create a function that returns specific values based on the input, and there's a lot more power locked away when you start getting creative with that Linq syntax.

I think try this on a real project, it'll be interesting to see how far it can be pushed before you have to try a more complex solution. I suspect it'll cover most things unless you get too crazy.

Scene it

It's another games post I'm afraid, but I do actually have some rants on technology coming up. Sorry if you're on the WPF team I have a few bad comments coming even though I think it's the best thing ever.

Anyway... So, there's a demo on Xbox live marketplace for Scene It. Basically it's the same as the DVD based quiz, but on the right medium (DVD sucks for that kind of quiz, a console is perfect) and, well, I consider myself to be a movie buff. You can play the demo without the special controllers, which are basically just a bunch of buttons used by the game and no complicated things like sticks, so I decided to give it a go. Of course it's the perfect game for after the pub so that's what I tried although I played it on my own, thus making sure I'd win.

Now I"ve tried the DVD based version before and it's pretty fun, but this new version smooths out all the rough edges. It's a game that is crying out for consoles and it works so much better when you have the support that gives you. The controllers are going to be perfect, what with their grand total of five buttons (they may not be useful for many other games) and if you can organise any room of people into 2 to 4 teams who watch movies it's going to be fun to play.

What it comes down to is that this is a grown up party game (far too many of my friends don't accept Mario Kart as the ultimate party game. It's shocking and sad.) that you can play with non-gamers and I'm going to buy it off the back of the demo just so that I can go visit my friends who own an xbox to play it with them. Yes, that is a commitment to visit you :) You know who you are. This could be a big game, I can't think of any other console games that have quite the same ease of access, and it's another step towards games being mainstream. Format wars aside, this is just the kind of game consoles need to be better accepted.

Mind you, I say games being mainstream but my mum, who retires at the end of the year, told me she's ordered Zelda for the DS. When did Nintendo become that mainstream anyway? Now that's a whole new rant...

There's two Es in Judgement you know

There's a new PS3 game that actually does something new. Eye of Judgment (now I'm all for humouring Americans, but you really do need the E there guys or the word has to be said differently. It's how language works folks) is one of those card games that Wizards of the Coast make, but this time it's a really quite clever mix of cards, the Playstation Eye (a webcam) and image recognition. This type of card game is basically about selling cards to players as you get a random mix of cards in each booster pack. Although there's only 100 cards at the moment there will be inevitable expansions that add more and more over time, and you'll need to keep buying these in order to remain competitive in multiplayer. There's a slight problem though, the cards can be copied. Now this is going to be easy to detect in local multiplayer, and just hurts card sales for the single player the real problem is that it ruins multiplayer. Everybody can have the killer cards, you don't need to pay loads of money to be effective (which, if we're honest, is what most of these games come down to). That's the pickup multiplayer potentially ruined unless they can fix this.

The really best bit is on the second video on the sony site, which says "next generation technology of the Playstation Eye". Um, it's a webcam and they've been around for a while. That's what happens when you let marketing get near stuff I guess, they tend to exaggerate.

The videos also show local multiplayer, and although I think the idea is good I watched the video and the first thing that struck me was they really don't look like the need the console to play, they could have been playing any card game with some game running in the background.

I'm not sure if this game has a future, but I can see something like Magic getting online play this way in the future if they can fix the card copying issue.

.NET source code?

Yeah, sure we all just use reflector anyway, but according to Scott Guthrie we'll be able to step into the source code of certain parts of the .NET framework with VS.NET 2008.

"We'll begin by offering the source code (with source file comments included) for the .NET Base Class Libraries (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc), ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows).  We'll then be adding more libraries in the months ahead (including WCF, Workflow, and LINQ).  The source code will be released under the Microsoft Reference License (MS-RL)."

I can't even begin to describe how useful this is going to be for me.

WPF Binding to RichTextBox.Document

I was getting some nice crashes on startup while trying to do some data binding to the Document property on RichTextBox under WPF and so I hit the net and found out that it's not possible. I quickly came up with the following code, which seems to work:

class BindableRichTextBox : RichTextBox
{
    public static readonly DependencyProperty DocumentProperty =
DependencyProperty.Register("Document", typeof(FlowDocument), typeof(BindableRichTextBox), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnDocumentChanged)));

    public new FlowDocument Document
    {
        get { return (FlowDocument)GetValue(DocumentProperty); }
        set { SetValue(DocumentProperty, value); }
    }

    static void OnDocumentChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
    {
        RichTextBox rtb = (RichTextBox)obj;
        rtb.Document = (FlowDocument)args.NewValue;
    }

}

Now the problem I have is that I don't know why the framework doesn't do this itself and if it's going to cause me massive problems further down the road.

Shifting technology

By day I've been a Winforms programmer for the last few years, but over the last few weeks I've found myself branching out. The first was to do a project with WPF, and there's going to be a slight problem going back to winforms now because WPF is so much better. Time to rewrite the main app I think (kidding!).

The second thing I've been doing is coding a website using ASP.NET. It's not something I've done much of before, and it's meant a lot of database work as well which is something I haven't really done for years but it's been quite the education. It's been nice going from writing desktop applications with horrific performance requirements that mainly stem from having gigabytes of data that needs processing as fast as possible and customers who want annoying things like supporting half a dozen synchronised videos playing back with overlays, graphics and things at the same time. In many ways that's a continuation of where I started programming, in embedded systems but all this web page stuff is a nice refreshing change. Scaling to lots of users is pretty much the same thing, but I've developed a paranoia about the database side. I'm constantly doubting myself and asking if that query is taking up too much resources, or if I'm making too many queries when I can merge some together cleverly in order to reduce load a bit more. The daft thing is that I have no performance problems and what I have so far scales way beyond the projected number of users but it doesn't stop the paranoia.

The other strange part to the site is that I've had to deal with browser caps. There's a very limited web browser that isn't based on the mainstream ones that needs to connect and it's been quite interesting seeing how ASP.NET can support strange new browsers through it's capabilities features. It just drives home the pain that having differing rendering engines look at your site brings. It's a bit of a joke that it's not all a bit more standard nowadays, even though it's better than it used to be. It doesn't help with how oddball this new browser really is, and how little chance I have of getting any rendering bugs in it fixed.

Still the site is almost ready for prime time but asp.net is looking a bit primitive nowadays, what with all the HTML and all. I could AJAX it up a bit, but I've got a feature coming up that needs a very rich API. Now if only there was some way for me to use WPF on the web... Silverlight here I come.

Hardware reliability

The Good:

Currently I'm playing lots of Heavenly Sword. It looks great (except the shadows, but shadows look awful on all consoles) and it's a lot of fun to play. I can feel the story running out though. The most amazing thing? It's got good acting and mocap in it! And some bad acting too, but I'll gloss over that.

The Bad:

It's made the triangle button on my controller break! I've not exactly used that controller much you know...

The Better:

Sometimes things happen for a reason?

http://www.gamasutra.com/php-bin/news_index.php?story=15564

The biggest problem with it according to some sites? It's heavier. Brilliant, I think it's too light now so that's going to be a big improvement for me.

Shame I have to wait for spring for it.

Warhawk is still amazing fun, but I feel like moaning about the PS3 store

I've been playing far too much warhawk recently than's healthy and it's great fun. I thought I'd get the pro PS3 bit out before I lay into another aspect... The PS3 store.

Is it just me or is the store really awful? It may be that I'm in a backwater of the world (the UK) and so we don't deserve content, but it's not the content that bugs me really. It's the UI.

You see the problem I have with it is that the UI is so obviously designed for a mouse because it's just a web browser behind the scenes (with red x icon for missing graphics when it's running slow). Now using HTML isn't bad in itself, but in order to use a controller to use the store it's easiest to move the pointer using the analogue stick much like a mouse and then to click to select. The problem is that the first click actually selects the control by centering the pointer on the control. The NEXT click activates the button, which is really strange.

The other problem I have is bandwidth. It feels like a web page from the late 90s sometimes with graphics coming down so slowly that you're bored before they turn up.

There's also things like the o button (which is "b" and back on the 360, and marked as back on the PS3 remote) actually quits the store when you're meant to hit the "prev" button using the pointer/moving the focus. Or the fact that downloading in the background feels tacked on.

It's not that Microsoft do such a better job really, it's that Sony is doing such a bad one. Online distribution is the future and Sony really aren't doing themselves any favours here. How many people didn't even realise that Warhawk was available through the store because there's no advertising unless you go into the store and check? Even then it's pretty hidden.

Now if you'll excuse me there's a 32 player dogfight awaiting my participation in warhawk.