The Imitation Game is about many things - genius, unsung heroism, homophobia, the terrible cost of war.

But as the secret story of mathematician Alan Turing gets more and more traction, the film before us also seems to be about fame.

Turing broke the German's enigma code, ending the Second World War by two years and saving millions of lives in the process. He is also regarded as the father of modern computing. Yet he was totally unknown in his lifetime, his war contribution concealed by the Official Secrets Act. In contrast, the man playing him on screen has shot to a dizzying degree of global celebrity - for being an entertainer.

Benedict Cumberbatch would appreciate the absurdity of that himself. Thankfully, he's a good enough actor to deflect our growing awareness of him as the object of seriously batty fandom, to continue to convey characters with total persuasiveness. His Turing is every bit the brilliant, infuriating, lonely, ultimately wounded individual he needs to be.

The film is an adaptation of Andrew Hodges's book Alan Turing: The Enigma. Surprisingly, given the subject is so very British, the script is by the American writer Graham Moore and the director is the Norwegian Morten Tyldum, best known for his excellent thriller Headhunters. But the pair nail the milieu, in particular the class and gender tensions that were so pronounced in the 1940s and 1950s.

The story moves back and forth in time: during the war, when Turing and a team of maths wizards, linguists and chess players at Bletchley Park attempt to crack the code - generated through the Enigma machine - that the Germans use in all their communications; forward to 1952, when the gay Turing is arrested for gross indecency in Manchester, resulting in the cruelty and humiliation that end with his death; and back to his school days, when he discovered his love for both his own sex and cryptology.

The race to break the code provides the main impetus, with tensions within the group exacerbated by the fact that Turing is no team player. Cumberbatch offers the intelligence, arrogance and hauteur that we've seen in Sherlock, Julian Assange and many other of his characters, but adds here a lack of humour and social awkwardness that suggest not simply genius, but autism.

While he alienates Bletchley's commander (Charles Dance) and his fellow codebreakers, he also has allies, notably the head of MI6 (Mark Strong, oozing spy charisma from the wings) and the one woman in the team, the talented mathematician Joan Clarke (Keira Knightley), the closet homosexual feeling kinship with the person who's brighter than most of them but isn't allowed to work in the same building. With thousands dying daily, the team is sceptical about Turing's work on a code-breaking machine.

Even though we know the outcome, there is a wonderful thrill in their eureka moment, followed by pathos at what it means - and can't mean - for the war effort. What then comes for Turing is simply a tragedy.

This isn't the first film to be made about Bletchley Park. But Enigma in 2001, based on the Robert Harris novel, avoided the real characters - its brilliant codebreaker was, laughably, a heterosexual called Thomas Jericho.

This makes even more baffling the criticism that The Imitation Game skirts around Turin's homosexuality. It couldn't be any plainer. If there had been overt sexual content the film would have a different certificate, and a different life, which in turn would have defeated the object of bringing a great man not just out of the closet, but out of the shadows.