Facing expulsion, three city youths are offered an ultimatum: complete their Duke of Edinburgh Award in the Scottish Highlands and retain their places at school. While their teacher (Jonathan Aris) takes the minibus to the first night’s campsite, Dean (Rian Gordon), Duncan (Lewis Gribben) and DJ Beetroot (Viraj Juneja) are left to their own devices — or rather, to those of Ian (Samuel Bottomley), the only member of the troupe who actually volunteered to be there or who is prepared accordingly. Just miles into the journey however, the boys find themselves off piste and at the mercy of a pair of masked psychopaths — one of them disguised as the Duke of Edinburgh himself.

Part Slaughterhouse Rulez, part Scouts Guide to the Zombie Apocalypse, Boyz in the Wood pits millennial snowflakes against the monsters of yesteryear in what might reasonably be described as this year’s Anna and the Apocalypse, another Scottish genre mashup to play at Edinburgh International Film Festival. First-time director Ninian Doff, who cut his teeth on surreal music videos and a seminal short film called Cool Unicorn Bruv, brings his visual style, millennial sympathies and comic sensibilities to bear on one of the slickest and smartest entries in this nascent subgenre. As writer he also possesses a real eye for detail and an ear for pubescent gangster rap.

It is never revealed which school the teenagers actually attend, but Bash Street would be a safe enough bet. There is something pleasingly Scottish about Boyz in the Wood, a film that feels as steeped in comic strip hi-jinks as it does in any cinematic tradition. The three troublemakers are particularly well-drawn, recogniseable even — whether it’s Dean’s feet wrapped in plastic bags or DJ Beetroot reluctance to compromise on his image — and while the characters themselves may feel fairly two dimensional many of their characteristics have the ring of truth to them. The adults, meanwhile, are clearly having a ball: police officers Kate Dickie and Kevin Guthrie pursue a local bread thief with fittingly cartoonish glee; while farmer James Cosmo redefines the “high-lands” with a bag of hallucinogenic rabbit droppings.

As much fun as Boyz in the Wood is, however, there are a couple of niggles. The second act struggles to reconcile the plot’s many strands, exacerbating the situation by separating its lead quartet and awkwardly inter-cutting a tense chase with a bawdy rave, undermining both the tension and the comic relief. What’s more, while the third act largely succeeds in restoring tonal balance a last-minute attempt at social commentary feels remarkably lackluster and ill-conceived — though admittedly a more articulate or thoughtful treatise on inter-generational privilege and entitlement might have seemed a little out of character for a tearaway teen. Nevertheless, Noff’s asking a little much for an audience to care about his protagonists’ futures when he can’t truly make you fear for their lives.

While not without the odd stumble Boyz in the Wood more often than not finds itself on reassuringly solid ground. The path may be well worn but there are plenty of surprises along the way, from characters who subvert their stereotypes to running gags that pay off in the most unexpected of ways — the relationship between Juneja’s rapper and Cosmo’s farmer being the perfect case in point, as an early culture clash gives way to an unexpected meeting of minds. Like Ian, Noff’s really going for gold with this one.