My first VIM script

I’ve switched over to vim for quite a while now (over a year now, I think), after being a die-hard gedit user. My productivity has gone way up since, but there’s always been something that’s bugged me: When you press , it always goes to the start of the line. Really, I want it to go to the first non-whitespace character, and if it’s already there, go to the start of the line (same behaviour as most modern graphical editors). After an unsuccessful twitter appeal, I decided to write my first ever VIM script to do this:

Putting that script in your ~/.vim/plugin directory, and then mapping it with

gives me my desired behaviour 🙂 It’s a pretty naive script, but it does the job.

]]>

30 Years of Pac-Man

Today (well, tomorrow my time, today in Japan) is Pac-Man’s 30th anniversary. Google have celebrated by putting a Google-themed Pac-Man game on their home-page, and in this spirit (and after the encouragement of my colleagues), I’m writing a small blog post on one of my pet projects:

Note, this is a completely original game, influenced by the classic Pac-Man (but not copying it. Seriously). This is not Pac-Man. Hopefully this will demonstrate some of the capabilities of Clutter and Mx. I plan on finishing and demoing this, and perhaps other games, as part of the talk that Damien, Neil and I will be doing at Guadec. Please leave any other quick game-ideas you’d like to see in the comments!

Pac-Man is one of my favourite games, mostly because of the amazing concept and gameplay when you consider the time it was released and other games of the time. I like to think of Pac-Man being the earliest example of emergent behaviour giving the illusion of complex AI in a computer game. There’s an excellent ‘summary’ of Pac-Man behaviour here. It’s hard to believe when playing it that it’s completely deterministic!

Here’s to another 30 years of awesome video-games!

]]>

HTC Desire review

Unfortunately I can’t really blog about what I’m working on at the moment (suffice to say though, it’s really cool and you’ll hopefully get to know about it in the near future). But I can blog about the new phone I got and there seems to be a lot of interest in this handset at the moment too, so maybe this will help some people make decisions.

I’ve been an android user for quite a while (about 18 months), I’ve owned an iPod touch and had a fair bit of hands-on with the Nexus One and the iPhone. I’m writing this from the perspective of someone who wants (needs?) a smart-phone and is wavering between the various choices there are at the moment.

Just a brief mention about the hardware – this is a massive step up from my old Vodafone HTC Magic. Three times the RAM (576mb) and a more powerful 1Ghz processor, amongst other things, make this an experience that is much more comparable to the iPhone experience. If you’re married to android already, your current choice would definitely be between this and the Nexus One. In terms of hardware, the Desire does feel very nice – a nice rubberised back, decent hard-keys, the touch-pad works better than I’d expected and it just has a very refined feel. It isn’t quite as nice as the Nexus One, but I’m happy sacrificing some small amount of build quality for hard-keys (not to mention the Nexus One would’ve cost me ~£200 extra). The touch-screen doesn’t feel as nice as the iPhone’s, but just about everything else is a lot better in my opinion. The iPhone is due a bit of a revamp (and going on the iPhone 4G leak, Apple agree).

The Desire’s software is a surprising feature. I expected to enjoy some of it, but mostly hate it when compared to stock Android, and I was very wrong on a lot of levels here. HTC have done an excellent job with their bundled applications and their integration with the system. So much so that if I were recommending a phone to someone I consider ‘normal’, I may actually recommend the Desire (I usually recommend the iPhone – as much as it doesn’t suit me, I can see that it would suit a lot of other people). HTC’s input method has definitely progressed since its first offering, and using it on capable hardware makes it feel a lot more like what I imagine they intended it to. I would say that it may even better the iPhone keyboard, though it’s a very close call. There aren’t many other modifications to core android system components, though their changes to the default android theme are a little hit-and-miss.

Someone at HTC definitely understands the direction phones are heading, as the Desire has web service integration right at the forefront. When you turn it on, the usual Android welcome is augmented with the ability to also enter your Twitter, Facebook and Flickr accounts (a perfect choice for me, these are the three social networks I actively use). Once it’s done this, it will synchronise and automatically link your contacts between all of these services (though it isn’t too brave and will often leave something unlinked and suggest the link to you, rather than assuming it). I expected to hate HTC’s contacts application, but I would say now that it’s actually one of the better features of the phone. I much prefer it to the stock Android contacts application.

Other stand-out features include the HTC widget selection, the FriendFeed application and the music-playing application. The home-screen on a stock android phone felt rather lame by default. Your selection of widgets isn’t particularly numerous, and what you do have often doesn’t fit that well together. With my HTC Magic (not running the HTC Sense UI), it almost felt like a DIY home-screen because they couldn’t be bothered to provide you with one. The iPhone’s home-screen was much better in my opinion. Less flexible perhaps, but I don’t really want to spend ages setting up what inevitably ends up being just shortcuts to all my apps (because a scrolling list is much slower to navigate than a pager). HTC have totally changed my mind on this though. The Desire comes with a selection of really fantastic widgets that finally fulfil the promise of what a configurable and pluggable home-screen should be. Yes, there are a lot of clocks, but it comes with excellent twitter, FriendFeed, weather, news, music, mailing, texting and calling widgets, none (well, except for the mediocre news/weather widget) of which come with stock android. These widgets are so featureful that I can see myself running full applications a lot less (a good thing). Couple the excellent widget selection with the ability to save home-screen layouts, and you have what Google really should be copying in their next revision.

FriendFeed isn’t something I expected to like at all. It’s an app that aggregates all the information from your social web services (Twitter, Facebook and Flickr). It works much better than expected. I have a lot of friends that are on Facebook and not on Twitter and this cuts down on having to check both. Not to mention that I would never normally check Flickr (not because I don’t want to, but it’s usually far less convenient than the former two), so this is a nice added bonus. Selecting any of the entries in FriendFeed will lead you to an expanded page for that entry (letting you reply/retweet with twitter, like/comment on facebook, look at pictures on flickr/facebook, etc.). You can also long-press and reply/retweet directly from that list. It all works rather nicely, and the app doesn’t feel slow, like a lot of other Android twitter clients do. Coupled with the excellent home-screen widget that lets your browse the latest updates and post updates without launching the application, this is unexpectedly pleasant.

The music application isn’t the best music-playing application in the world, but it’s definitely much closer to what such an app should be on a phone, when compared to Google’s own rendition. The interface is structurally very similar, though it feels quicker to navigate on the Desire. The main change is some much-needed visual polish and some excellent system integration. Like the rest of the bundled applications, this comes with a selection of home-screen widgets to control playback, but more awesomely, integrates with the lock-screen, allowing you to play/pause/skip previous/next without fully unlocking your phone. Perversely, I’d say Android (either stock or HTC Sense) is much better at music playback than the iPhone or iPod Touch. An interesting note for the Desire (and this probably applies for the N1 too) is that sound quality is noticeably better, and louder, than on the HTC Magic.

So that leaves the bad. A general criticism I have of all existing Android phones, is that they really lack polish. I think this lack of polish is also down to some architectural design choices. The iPhone ‘feels’ much faster, even in the cases where you can’t actually get your task done as quickly as you can on Android, and this is totally down to appearance. Apple, correctly, value the visual consistency of their UI; and that’s not just the graphics I’m talking about, but the animations, responsiveness and frame-rate too. There are a lot of rough areas in Android, where scrolling a list will jerk as new items are loaded in while you scroll. This is something you’ll never see on iPhone – Even network I/O is paused while your finger is on the screen. A great example is scrolling the applications list in the market. On the iPhone, this will always be (almost) perfectly smooth. New entries will only be loaded when your finger is off the screen and the list has come to a halt, and the same is true for the application thumbnails. On Android, no such thing happens, so if you scroll towards the end of the list, or a lot of images are downloaded while you’re scrolling, you’ll get a nasty judder in animation. This is much better on the Desire and N1, but it really should just be unacceptable that it isn’t always smooth.

Another thing about Android that I thought I’d like with the Desire/N1, but really don’t, is the new live wallpaper feature. The live wallpapers do look great (and especially the HTC Sense one, which is fantastic), but it very obviously and negatively affects the performance of switching screens. I’d love to use a live wallpaper, but why would I purposefully degrade my user experience for the sake of a little pointless eye-candy? Either it should have been implemented differently (for example, pausing the animation during screen-switching to maintain performance), or it shouldn’t be there at all. Live wallpapers are basically equivalent of having a check-box with the option ‘Use more battery life and make my home screen slow’. The novelty soons wears off, but the impact on user experience remains.

Finally, HTC’s changes haven’t all been for the better. They’ve replaced the stock android theme with a darker theme that I guess better suits the look of their hardware. I’m not disagreeable to this, however, the newer theme lacks contrast in some places where there really ought to be contrast, the selection colour (a neon green) sometimes looks out of place, and the new icon set is definitely just not as good as the stock android icon set. This doesn’t tend to affect the bundled HTC applications, but does have a slightly negative affect on some 3rd party applications. They’ve also made some changes to the animations, which I can’t quite fathom. The animation that would normally accompany switching or moving away from the home-screen (a nice, iPhone-style zoom) is totally gone. There is no animation here, and having gotten used to this on my HTC Magic, this is a little jarring. As great as all their apps are too, I’m undecided on whether their news app is as good as Google’s integrated news/weather app (though the associated widgets are superior).

All in all, I’d have no problem recommending this phone to anyone that wanted to try a smart-phone. Unusually for an android phone, it comes with enough pre-installed (and good) software, that you could quite easily get on without exploring the marketplace at all, and HTC’s added extras definitely put it a notch above the average Android phone. On the other hand, whether I’d recommend it above an iPhone or a Nexus One would depend entirely on the person. With a Nexus One, you don’t get as nice a UI and you don’t get HTC’s great customisation, but you do get a more future-proof phone that will get all updates first, you do get a slightly higher build-quality, you do get a great (optional) docking station and you do get a more developer-friendly phone. With the iPhone, you miss out on a lot of the fantastic web-service integration you get on Android (which I couldn’t go without now that I’m used to it), but you do get a far more polished experience. If you want an iPhone though, likelihood is your mind’s already made. Enjoy being Steve Jobs’ bitch.

]]>