Monday, 30 November 2009

TextField.text can't be set to a number or object, only a String (unlike trace() for example, which will toString() anything you throw at it). There is no logical reason for this that I can see, and makes for some ugly code with String() casts everywhere. You can't really get around it by extending TextField either, if you want a designer to be able to manually move the textfield on the stage in Flash, which I always do.

You can't tell if a key is down. I don't agree that this is a security threat, and it's a pain when you're doing games.

No access to stage before addedToStage. I can't really see the reason why this is the case, and it can make code a lot more verbose, as you can't use stage in your constructors, leading to an extra layer of listeners and complexity. And it's worse if you're not actually extending DisplayObject. In my view, stage is a natural Singleton, and generally I treat it as such nowadays by keeping a static reference in one of my classes.

Events and all those string constants. I always thought there was something fishy about ActionScript events (like how many custom ones you need), and the brilliant example set by Robert Penner's Signals has proved it to me. I've been using Signals on my latest project and filing bug reports (and the odd fix), which Rob pretty much always implements within a day. This is an awesome open source project that gets better by the day - you will never want to use Events again!

You can't tell if the mouse is hidden. Why have a Mouse.hide() without Mouse.isHidden? It makes no sense, and if you call Mouse.hide() repeatedly it makes the cursor flicker, which again I can't understand as Flash should know not to hide it if it's already hidden. I have created a simple MouseManager class to get round this, but again, why should I have to. Also, I think there is a potential issue around right-clicking showing a hidden mouse without notifying you. While we're on the subject of the mouse, for games you really want to be able to set the cursor position, as you can I think in Unity3D, and have a truly custom right-click, as you can in Silverlight 4.

The video API is just wrong. Do you know your netstream from your netconnection? None of these things make sense. It should just be videoPlayer.play("video.flv") right?

The timeline can't destroy movieclips, only remove them from the stage, and if they have any listeners they can't be garbage collected, so playing timelines is a memory leak minefield.

There are no convenience functions for anything, anywhere. Thanks guys.

Thursday, 12 November 2009

Github is all the rage for source control / hosting OpenSource projects right now - which is a great thing, because for end-users who just want to grab a .zip file of the code or report an issue, it's really easy to use. If you want to check your code in to Git though, and you're on Windows, it can be hard to know where to start. I just went through the process of setting it up, so I thought others might find this useful. Here's the steps I took:

Download and install "msysgit" from http://code.google.com/p/msysgit/ (from "featured downloads" on the right of the screen). This provides the core command-line Git functionality.

To make life easier, download and install Tortoise Git from http://code.google.com/p/tortoisegit/ which is just like Tortoise SVN, which I use for SVN, and works great. It's completely visual and feels like native part of Windows.

In "Account Settings" on GitHub, click on "SSH Public Keys" and add a new key. The title should be your email address. To generate the key itself, use PuttyGen, which you downloaded earlier, and copy-paste it in.

Right click in the folder which you want to check-in to Git. Select Git Create repository here. Create it.

Right click in the folder again. From the right-click menu, select Tortoise Git - Settings.

In Git - Remote, select Add New. Add the private key from Putty that you generated earlier. The private key is a file rather than something you copy-paste. Get the URL and name from the "Source" or "Admin" tabs of your repo on the github website.

Select all the files you want to check-in, right-click and select Tortoise Git - Add...

Right click again and select Tortoise Git - Commit -> Master.

Hopefully it should all upload and you're done!

Don't ask me any difficult questions, because I'm surprised I got this working myself, but good luck! I'm liking Git so far.

Wednesday, 11 November 2009

Like most things, RPGs were better in the 1980s. Take Bloodwych; I re-read the review of this game in ST Format about a hundred times because I didn't believe anything could be so brilliant. I bought it "mail-order": this meant that for no good reason it took 28 days to turn up, and you couldn't even complain about it on Twitter because it hadn't been invented.

Two people could play it at once, which was revolutionary at the time, and stopped my brother just punching me until I gave him the joystick. 2-player RPGs are brilliant (my wife and I had a blast playing through Balder's Gate Dark Alliance - certainly more fun than watching me ride my horse around Oblivion for hours at a time).

This is the bit where you choose your characters. My brother, of course, took the cool looking knight guy, the cool hooded wizard guy, the hot blonde chick and the cool looking ninja guy. That left me with a blue hermaphrodite thing, Sinbad, a smurf and a f***ing lizard. I didn't care though - this was the coolest thing I'd ever seen!

You can scoff at the graphics all you want, but most people were still playing 8 colour C64 games, so this is basically the f***ing Matrix. My brother soon found that he could threaten to beat me up inside the game unless I gave him all the best loot: basically he invented cyber-bullying 10 years before there was a word for it. I specifically remember one of my guys having to fight with a chicken drum stick.

We played Bloodwych every day and within a few months we had completely worn out the disk and both of the Atari's notorious joystick ports, so we never got to see the cool looking monster on the cover art, which probably wasn't even in the game because cover art was just lies back then.

Of course, because it's dead old you can play it free now by finding a ROM and an Amiga emulator. Enjoy!