Coding and elegance · Feb 2, 10:53 PM

I was very pleased to see that the headline feature in this weekend’s FT Life & Arts section was devoted to the idea of artistic elegance in code – something familiar to those of us who do this for a living, but perhaps not to those who don’t practice.

I’m not sure coding can lay claim to this alone; all engineers I think are looking for elegance in their solutions. But I think the metrics by which elegance is measured is probably hard to comprehend outside each discipline, what is elegant takes domain knowledge to spot that elegance. I imagine most people who see a modern Ducati motorbike don’t see that the engine is actually also a load bearing part of the structure, reducing the need for an explicit frame, saving materials and thus weight and cost, and this is an elegant engineering solution. They just see a motorbike that looks like most others. And if they can’t see the elegance in physical engineering what hope have we that they’ll see it in something as abstract as code? To the lay person one screen of gobbledy gook is as weird looking as another.

A good example from another engineering discipline might be the Millau Viaduct, where the bridge is visually arresting due to the engineering, not because it was engineered to be so. In coding we’re always looking for a solution that functions perfectly, but is at the same time free of fat, complexity, corner cases. Programmers are famously lazy people, and as such we seek elegance as it makes our lives easier in the long term, whilst providing a satisfying intellectual challenge in the short term.

As computing enters more and more walks of life, it pleases me to have an article try and capture some of the more aesthetic sides of what I do for a living. The only time I’ve seen this done better is by the fictional Richard McDuff in Douglas Adam’s “Dirk Gently’s Holistic Detective Agency”, and that was probably only read by the kind of people who understood the argument in the first place. It’d be nice to think articles like this make computing a bit easier to relate to for those who’s lives are ruled by code but don’t understand how it comes to be.

Comment

I Like Trials · Jan 12, 09:49 PM

When we got the Xbox One I thought that that was it for new games for the Xbox 360, I’d play the existing games on the 360, but all new games would be on the Xbox One. And I was kinda right. I’ve not bought any new games for the Xbox 360, but I have got hooked on an old classic, Trials Evolution, which you can see demonstrated here by the chaps at Hat Films:

The premise is quite simple – you ride a dirt bike across a range of obstacles, trying not to fall off and do so as quickly as you can. The controls are very simple: you can go faster or slower, and you can shift your weight back and forward. That all there is to it, so it’s very easy to pick up and get started, but quite tricky to master to perfection; which sums up this game quite well.

I recall playing the demo for the precursor to this instalment, Trials HD, and being deeply unimpressed with it, due to it being very frustrating from the get go. This is why I avoided Trials Evolution until last week, but the new version gets it very right. It’s easy to pick up and play and have some fun; the basic bikes and tracks are easy to get to grips with, so you can have fun without frustration, blasting through the countryside on your dirt bike within moments of starting the game up. But, at the same time, there’s always the challenge to go one better and be a perfectionist on each track, so it can also be played as a very technical game. RedLynx did a good job of catering to both mindsets in a single game.

To add to the draw, if your friends have played at all, you get to see their ghosts as you play, so even though I’ve just been playing it single player, it’s got a competitive edge to it as I want to try and beat my friends. No doubt my friends are more hip than me and got the game when it was first released almost two years ago, but it matters not in this digital time shifted era – I can have fun challenging them even though I’m years late to the party.

It’s quite cheap as games go, and there’s hours of fun to be had here, so I do recommend it if you’ve not picked it up yet. Great pick up and play action.

Comment

Baby steps · Jan 3, 01:38 PM

The joke is that joining a hackspace is like joining a gym: you sign up, full of good intentions, then never go. I promised myself I’d do at least something at Makespace over the holidays, and I got it in just before the wire:

It’s not much, but I did the design and fabrication of this little cube here. For me the important thing wasn’t the cube, but that I sorted out a workflow that I was happy with; otherwise when I think of things I might build I tend to put them off as I don’t know how to get there, even if I have access to the equipment required.

One of the main bits I wanted to sort out was some CAD software that I didn’t despise. Most people I’ve talked to at Makespace tend to use Inkscape to do 2D designs for the laser cutter, but I detest Inkscape with a fashion. Although it runs on the Mac, it is not a native OS X application, so there’s a large amount of mental friction when using the tool for anything, which usually leads me to giving up.

I’ve tried various alternatives to Inkscape without much luck, but the one that I had success with this time round was ViaCAD. This has an OS X version, which still doesn’t really behave like a Mac application, but is less jarring to use than Inkscape. It doesn’t suit my mental model particularly, but I was able to easily design my cube on paper, draft it in ViaCAD with the correct dimensions for the wood I was using (finally an application of my technical drawing O-level), and export it in the right format for Makespace’s laser cutter. ViaCAD is not free, but it’s quite cheap for the 2D version, which is all I currently need.

Comment

Modern riding · Jan 1, 11:02 AM

I’ve been looking for a new motorbike for a little while now. Whilst I love my Buell Ulyssess, it’s starting to show its age, and as a technologist I’m keen to see what’s new out there. The Ulysses was a shining example of different engineering thinking when I got it, so what’s the modern equivalent?

For a while I looked the latest Ducati Multistrada, which on at the face of it is a perfect replacement for the Ulysses: similar adventure tourer design, but with all the latest bells and whistles, such as active suspension, multiple engine maps, and so forth. Unfortunately, trying to get a test drive from the nearest dealer proved a bit of a labour (I still haven’t had one) and then on learning of a four month wait (during which I’d not have a bike due to part exchange), I gave up and resigned myself to another year on the Ulysses.


However, although the Multistrada has all the technology I could want, it’s still a fairly conventional bike, in that it burns petrol. In the first half of 2013 I test drove a Zero S, which is a small 125cc equivalent electric motorbike. For 80% of my riding, the Zero S is too underpowered (for reference, the Ulysses is a 1200cc bike), but it did make me see that the petrol engine is really quite a stupid solution to the problem compared to electric motors. After the test ride I was trying to make my way across Cambridge in the Ulysses, and got stuck in traffic. The Ulysses doesn’t like this – it’s noisy at the best of times, and then the fans come on loud as the engine’s getting too hot, it really isn’t happy. But the Zero S simply isn’t on when you’re not moving, so it doesn’t care about these conditions. And yet when you’re going it’s fine.

The only thing that let the Zero down was the capacity equivalence. Being a 125cc equivalent it’s only really useful to me as a commuter, yet it cost more than my Ulysses. Given I typically peddle bike to work most days, and want a bike for fun trips out into the countryside two up, this didn’t make much sense.

What I really want is for electric bikes to get better so I can have something that’s going to be fun on the B roads as well as on the commute. Such bikes exist, just not yet in the UK, and given I know that you don’t buy a bike without riding it first, this put a bit of a stop to the electric bike dream.


Given all this, I was very fortunate when a couple of weeks ago, I happened to find myself test driving one of these electric bikes around San Francisco, courtesy of Scuderia Motorbikes:

This is the Brammo Empulse R, which is somewhat of a 650cc equivalent sports naked bike. I’d only stopped by to look at one, but on hearing my story Paul at Scuderia immediately recommended I take the bike out on the streets of San Francisco for a ride to understand what the bike was like (Ducati dealers take note).

This made me very happy, for two reason. Firstly, I was going to get to test drive a bike I’d been interested in ever since it launched, yet had remained tantalisingly out of reach. Secondly, this would be my first chance to ride a motorbike in the US, and I got to do it in a city full of iconic streets (thanks Bullitt). To say xmas had arrived early is an understatement.

Let’s start with the externals: the Empulse is a nice looking bike. It’s made a design feature out of it not having a conventional engine, and thanks to batteries being more easy to shape than engines, it’s actually more slim that the petrol equivalent bike would be. The older Brammo Enertia and the Zero S both look slightly odd to the eye, as we’ve become accustomed to motorbikes having certain shapes, but the Empulse manages to be both at once and look lovely as a result.

To sit on it was much more comfortable than I expected. I’m used to adventure touring bikes, where you sit up quite straight, and sports bikes as a rule tend to have you lent forward; this is great for B roads, but a real pain for anything else. But to my surprise the Empulse actually has quite a nice upright seating posture, albeit slightly lower to the ground than you’d find on an adventure bike. But this is a bike you could happily put miles on without crippling your wrists. It was also well balanced – I’ve been spoiled by the Buell, which are exceptionally well balanced bikes, and although I didn’t attempt a slow speed manoeuvres, the Empulse seemed to carry the weight from the batteries well.

Externals aside though, how the bike moves is the real make or break for a bike. If you’ve not driven motorbikes, it’s probably not apparent how much difference the engine makes to the character of a bike, much more so than with a car, as you have a much more direct relationship with it. I’ve rejected bikes that otherwise seemed perfect on paper for this reason. For instance, I love V-Twin based bikes, which tend to have high torque at low revs, so pull away well, but are less refined than say an inline-four, which will be much smoother across the power band. My Dad loved his VFR-800, which was of the later type, but I really found it dull to ride. This is what makes bikes interesting; it’d be boring if we all liked the same thing.

But this was the main reason I wanted to test drive the bike – would it’s character suit me, or would I just be disappointed when I got on the bike? You can’t tell this from specs or youtube videos, you need to ride it yourself.

Thankfully, the Empulse R’s character was right up my street. Electric engines are known for having their torque available at all speeds, but this actually needs to be limited if the bike is to be usable at low speeds, thus why I was worried. But no, as I zipped up and down the Mission district of San Francisco, the bike put a big smile on my face. Pulling away at traffic lights it was prompt with a pull that made you think if this was the open road I’d be a mile away by now.

Unusually for an electric bike it has a gearbox. Theoretically you don’t need this on an electric vehicle, but I find it makes sense (even if it’s just simulated through software, though the Empulse has the real deal); the advantage of a gear box is that it rations how much power you get for a full turn of the accelerator. In first gear, because top speed is only, say, 30 mph, you can have much more more nuanced control of the bike than if you only had one gear. This leads to a vehicle that’s equally as usable in town as on the open road. The other advantage is the Empulse felt much more natural to ride than it might otherwise, making it easier to quickly acclimate to.

So when going, it felt great, and yet when stopped it just shutdown and awaited the next burst of speed silently, just what I wanted. Speaking of silence, the bike is not silent when moving – it sounds a little like a space ship from an 80s movie. It’s not loud like my V-Twin, but it did mean I didn’t need to worry about pedestrians missing me (any more than I would normally).

Downsides? It’s not perfect – the pillion seat is adequate but not awesome, the dial cluster a little archaic compared to the ones Ducati puts out these days, and if you misjudge pulling away you get a bit of a jerk as the engine kicks in. But these are the kinds of complaints I’d level at any bike. The main thing is that when riding the Empulse R you just think of it as a bike, not a special beast to be categorised differently, which is great.

It’s also not ideal for me, it suits about 80% of what I use the Ulysses for. Due to range, there’s no way I’d be able to ride this up to Scotland for the week. But for that 20% of riding I can easily hire an adventure bike; for the bulk of things I used a bike for, the Empulse R would be fine.


So, that’s the review, but there’s still the issue of how do I get my hands on one over in the UK? If Scuderia had been UK based they’d have had an impulse buy there and then, but unfortunately it’s not that easy – Brammo have no official UK dealership, and even if I could import one I need to work out if it’d be road legal here.

Thankfully, all the spamming I did of Brammo in the last two weeks (apologies to Brammo, but I really do want one :) has yielded positive news – they plan on announcing a UK distributer for Brammo bikes in the next few weeks, with bikes available once compliance testing has finished, which they hope will be end of Q1.

So, I still have to wait for my next bike it seems, but here I have the satisfaction of knowing I’m waiting for something truly innovative that’ll both satisfy the biker and the geek in me. Now I just need to pick a colour…

Comment

Back in the saddle · Nov 29, 05:02 PM

I’ll rant more later about it if I remember, but I finally got time to sit down and enjoy the new Forza Motorsport 5, and it’s lovely. Lovely physics, lovely sound, lovely graphics, and some lovely cars, including now open wheeled cars, so I can finally charge around Laguna Seca in a KTM X-box like this:

And despite being sad that my lovely Fanatec wheel doesn’t work with the Xbox one, the force feedback triggers on the new controllers actually make it much easier to get a feel for. Loving it.

Comment

Lotus Driving Academy · Jul 20, 10:17 AM

After my PhD viva I swore to myself I’d never sit another exam again. Clearly a fib, but then at the time I didn’t think they’d be as fun as driving small cars around fast corners fast in deepest Norfolk…

Yesterday Laura and I took a day out from our hectic work schedules to do part one of Lotus’s driving school, over at their factory and test track location in Hethel, just outside Norwich. I love playing Forza Motorsport, and wanted to see what it was like for real, but in a way that was unlikely to get me in to trouble – so a day’s basic track tuition in a car that is famed for handling seemed just the trick.

The level one course is just your basics of car control on a track – no technical trickery, just getting used to handling a car at speed around a twisty track. And it’s the corners that are the things that terrify you at first. Anyone can go fast in a straight line – it’s carrying that speed through corners, or shedding that speed so that you can come out of corners fast, that is the trick, and this is where the real learning for the day was.

As a motorcyclist, you might expect that this is something I’d be used to. I’ve done the advanced motorcycling test, and a lot of that focussed on flowing your corners to maintain speed, but a bike behaves so differently in corners to a car you just can’t compare the two.

On a car I have (or rather, had) no understanding of how far you can push a car around a corner, and as such was quite apprehensive. It’s hard to articulate, but fundamentally it’s about a level of faith that what you’re doing will work before you do it. The idea of doing a tight hairpin at 50 mph is not something I trusted a car to do. But thanks to a safe space in which to learn and an expert to guide me, I now know better.

The north loop of the Hethel track superficially looks quite dull, but when you’re flat out in a car the 1.3 miles vanish quite quickly and you’re left with a series of quite tight turns: a twisty chicane, a wide hairpin, and a series of flowing corners at Clark that all need to flow well for you to take the incredibly tight Windsock.

The day was split into three sessions. Session one was mostly getting used to the car and the track, and the idea of travelling quickly through these bends. For the last six years I’ve mostly drive a semi-automatic car, so I was also getting used to using a manual shifter again: I have nothing but the deepest of sympathies for a little Elise with plate LDA 2 having to suffer my mangled shifting. I should probably send it a card or something.

But by the end of that first session I felt quite good. I’d even squealed the tyres in some corners. I was learning new things about the limits of how you can push a car in these circumstances (albeit in one that was designed for exactly these circumstances!). I was still struggling though with that trust in the car thing – at the speeds you’re going and the way you have to react you don’t have time to look at the dial before every corner to set your speed, you have to just feel how fast you’re doing. I know for a fact that the Elise dashboard has lights telling you the optimal time to shift, but that’s only because I’d read it before; never once did I see those lights on the track as I was too busy watching the road for my break/corner markers and reacting – I entered some weird tunnel vision where all my brain took in was the track.

Session two was very ragged. My gear changes were just all over the places, and I was messing up the very tight Windsock turn by going from 3rd to 4th rather than 3rd to 2nd, over and over. Terrible. The problem is everything happens so fast at that point – you need to turn, break, change, turn all within seconds, all with someone shouting advice at you at the same time. 3rd to 2nd for the chicane was not a problem, as there I had more space to think.

In session three I discovered part of my problem in session two was that having got used to a fast exit on Rindt, I was getting up to 5th rather than 4th on the long straight that followed, and this to me felt like progress. But actually, although there’s three corners between the end of that straight and my nemesis Windsock, the extra cognitive load of coming down that extra gear set me up badly mentally for that series of corners, leaving me feeling rushed all the way through to the end, and causing me to fluff it. By making a more relaxed entrance to that series of turns meant that at the end of it I was nailing Windsock every time, flying out of the tiny hairpin with a squeal of tyres and a big grin.

At no point in the day did I get a perfect lap, far from it. But by the end of the day I’d managed to get to a point where each part of the course I could do well several times over, and I was starting to be able to understand where coming on power early or late was upsetting my next state of the course. After three sessions, thanks to my instructor Tony, I’d gone from abject terror to only mild terror at flying up to Rindt hairpin.

But alas session three was the end of the day. We had one last lap though, this time with our instructors showing us how they took the lap. There the terror was back, though I had every faith in Tony not to leave us in a field of potatoes, but he was halving the breaking distances I’d used quite easily, and generally tearing up the track a lot faster – even with a similar top speed. Clearly I still have a lot to learn :)

The day as a whole was greatly educational, and greatly entertaining. Those little Lotus Elises may only have 134 bhp, but they let you wring their necks quite well, and dynamically they were wonderful. Now to work out where in our busy lives we can fit in the next two levels!

Comment [1]

A branding exercise · May 26, 07:48 AM

Being a somewhat consistent person, my personal and work laptops are the same, Apple’s MacBook Air. Add to that, Laura has the same laptop. As you can imagine, this leads to occasional confusion. Now, I can tell my two laptops apart, as one has a slight chip in the lid where you go to open it, but that means I’m now reduced to fondling them all before I can work out which is which, and leaving the issue in that state is just going to lead to me getting a worse reputation for technology love than I already do.

Previously, I solved this with the application of a macslap, wonderful vinyl cuts for adorning the top of your MacBook, but that is now sadly a defunct endevour. And although there’s a thousand copies of the original macslaps out there, I decided I wanted something more personal, and given I’m trying to hire people, something that would cause geeks to enquire.

Thankfully, I’m a fully paid up member of Cambridge’s Makespace, so I have access to the appropriate tools for making my own vinyl cuts, so I took the Bromium logo artwork and made my Bromium laptop stand out amongst the stack of identikit Macs that surround it at the office, at home, and just about any conference I go to:

Making a custom vinyl was surprisingly easy (if a little fiddly if your company brand guidelines insist on the ® symbol), so I do recommend it. I’ve already had people ask me where to get copies, both inside Bromium and out, so I take that as somewhat of a success.

I did learn one thing though that I’ll need to note for my next startup design – you can’t size the Bromium hexagon such that it covers the Apple light on the lid, and at the same time have the “Br” part stay within the glowing section. Logo designers take note!

Comment

Radiolab · May 25, 09:24 AM

Like a lot of commuters, I listen to podcasts on my way to and from the office, and I’m always on the look out for something new and interesting. I though I’d share a new one, Radiolab, to which I was introduced by my good friend Dan.

I often feel I don’t know enough about the world – I listen to some of my friends talk and realise that although I know a lot about technology, there’s lots of other things out there that I know nothing about. Radiolab helps fill that gap, at least on a general science front, covering three related topics in each hour long show.

Some particular good episodes I can recommend include: speed, which covers topics from human reaction times to slowing down light to 15 mph; and colors, which talks about how different animals perceive colour, and why Homer’s Iliad doesn’t talk about blue.

Comment [1]

Simulating that which can't easily be simulated in driving games · Nov 11, 04:11 PM

In which I explain why motorcycling video games are, and always will be, rubbish.

I’d never been particularly interested in cars, until a friend of mine showed me how fun driving simulation games can be when you remove all the driver assists. Modern driving games, such as Forza Motorsport or Gran Turismo have wonderfully accurate physics simulations in them, and so become suitably challenging when you expose the underlying car. At that point I saw the joy of the challenge of driving well. It’s a skill that I find rewarding on a motorbike, that hitherto I’d not seen in cars. I’m still not interested in cars as objects in themselves, but I am now interested in them as a tool to enable me to drive.

Add to the game’s physics modelling a force feedback wheel and simple pedal inputs, you suddenly have a very interesting simulator. The inputs are like those of a real car; indeed, the inputs on the Microsoft Force Feedback Wheel I started with match those of the Smart Roadster I regularly drive pretty much exactly. One of the things I find very fascinating about these wheels is not that they provide feedback of say, the road texture, but rather how they convey a sense of weight of the car.

I’ve never really thought deeply about the steering wheel as a output device before, only of an input, but I guess that’s because on real roads I drive at a suitably sedate pace, such that the G-forces on my body in cornering tell me what I need to know about my cornering. In driving a video game simulation of driving, they can’t provide that feedback so readily in my living room. Instead they convey it through the steering wheel, and it works remarkably well. You can feel as you throw your car around a tight corner it stringing at the limits of grip (if it’s a nimble car like a Lotus) or it giving up an wallowing off the road in disgust (if it’s a Mustang). I’m not sure if they’re modelling a real feedback loop I’ve just never noticed before, or a synthetic feedback loop that happens to convey the right sensations, but either way it works remarkably well.

What’s interesting here is they’ve found an alternative output mechanism to make up for something they couldn’t otherwise recreate.

This works for other outputs too. Typically if you get a set of pedals for such games, there’s no feedback via the pedals – they’re just input devices. For some of the pedals at your feet they take care of the feedback loop visually – you can see who quickly your car is accelerating on the screen when you press the rightmost pedal. It should be the same for the reverse process, breaking, but it isn’t. Yes, you can see your car slowing, but if you press a break too hard it’ll lock up, and normally you get feedback on a real car by feeling when the break starts to bite between your foot and G-force changes, and with dumb pedals you can’t feel that, and the result is you often lock the breaks more than you would otherwise.

On the Fanatec wheel set up I have today, they’ve solved that by simulating the ABS shudder via the force feedback in the wheel. So if I press the break too hard, the wheel starts to have a subtle shudder, and this tells me I’ve pressed too far. Over time this enables me to learn how far in the break pedal needs to be pressed before I lock up. Again, one output is made to substitute for another output that they couldn’t recreate.

However, not all senses are so easily catered for.

When approaching a corner you (or at least I) rely on the rate of change of depth to tell you how much speed you’re carrying, and more importantly, how much speed you need to lose. Most games (and gamers) don’t yet support 3D televisions, so you have to make do by default with a sort of rate of change of scaling on the screen – how much bigger the corner appears as you approach it – but that doesn’t work nearly so well. In an attempt at being a simulation purist I’ve tried relying only on this, and it does doesn’t work. You get a lot less information than you need, or at least than you’re used to driving in the real world, so the simulation falls down.

In Forza Motorsport there is a stop gap solution. As part of trying to make the game easier for people, Forza will enable you to turn on the racing line, showing you where you should be driving, and that line changes colour between green and red, depending on whether you should be speeding up or slowing down. It also has the option only to show the red bits, aka breaking line.

The breaking line is then something that helps make up for the lack of depth perception, but isn’t quite perfect. For one, it tells you where you should be racing, which is more than I want to know; I’d like to learn the lines on my own terms thank you very much. But also it doesn’t tell you when you should be breaking for your current line, only the ideal line. But, it’s close enough that you can use it as a reasonable indicator as to when to start breaking (unless the car in front of you obscures it, but then if you’re that close to the car in front you’ll find out you’re in the breaking zone soon enough as your bonnet goes into the rear of their car).

At first, using the breaking line felt like cheating, having the game tell me when I should be breaking. And ideally I’d not use it. But the fact is that unless you use this, you’re missing out on an important sense in driving that you’d not otherwise get from the simulated experience. Ideally they’d make some slightly purer visual feedback just to overcome this limitation decoupling it from showing the racing line.

Thanks to all these alternative input methods, be they on screen or via the force feedback motors, you get pretty close to driving a car, and it’ll enable you to safely and cheaply enjoy driving perfomant vehicles in your own living room.

All of which leads me to why motorbike based games generally are about as fun as something that’s not much fun. I love motorcycling, but games that try to recreate it without fail leave me cold. And it has to do with this using other outputs to make up for things your video game console can’t do – on a car that gap is sufficiently narrow you can make it up mostly, but with a motorbike that gap is a gaping chasm.

In a car you start with an unfair advantage – you’re usually sat down when you play driving games, and most cars expect you to be the same. Your typically isolated from the elements in both situations. Both the car and your living room typical remain on the same plane. On a bike, you have none of these similarities. A high amount of riding a bike is how you place your body, not just what you do with your hands and feet. And that movement is in reaction to the environment of the bike. The way you lean your bike and place your body is relative to the speed and corner radius, but there is no “right answer” – they’re four variables that you constantly tweak, almost subconsciously at times, through the corner. Neither input nor output on games console or PC gets close to recreating this.

So you’re not simulating motorcycling – you’re simulating a very bad car that you need to slow down on the corners for and will mostly fall off of. For the bike games that do let you adjust the angle of lean – you have no haptic feedback mechanism to convey to you how much you should lean by and what effect that lean is having in your dynamics. So motorcycling, which should be this raw, exciting, thrilling experience, feels limp by comparison to simulated driving, where we can provide the sort of feedback you expect.

Kevin Schwantz, former motorcycling world champion and now car racer once said that car racing is 80% car, 20% driver, and motorcycling is 80% rider, 20% motorbike. This feels like the right analogy for why car games work and bike games don’t – convey the 20% of senses required to engage with a car is far more achievable (and still have it be fun) than the 80% required for motorcycling.

But it’s okay, as we can get very close with cars, which is hugely fun for those days I can’t get out on the bike, and means I don’t need to save up for a Lamborghini.

Comment

Previous Next