Transformers: The Last Knight, the gargantuan and bombastic fifth entry in the lucrative Michael Bay helmed series of films based around Hasbro’s iconic toy line, marks a high point for the otherwise dubious franchise. One could probably make thirty films with the budget of Transformers: The Last Knight, and at two and a half hours it has enough superfluous plotting to feel like sitting through thirty different movies in a single sitting. Unevenness and occasional lapses into Bay’s trademarked bad-taste humour aside, each of these thirty films crammed into an ungainly single film sack are surprisingly entertaining and at times engaging. Engaging and entertaining aren’t words I would normally associate with the Transformers franchise, but The Last Knight manages moments where it’s both of those things, setting it head and shoulders above its loathsome predecessor (Age of Extinction) and the three other films that came before that.

Following the events of the preceding film, world governments have outlawed Transformers, setting up an anti-robot military force to take them out. Despite the deterrents in place, more and more “robots in disguise” keep coming to Earth at an alarming rate. Autobot leader Optimus Prime isn’t around to find out what’s going on, as he has travelled across the cosmos to return to the wreckage of his home planet, Cybertron, to meet his creator, the deceptive Quintessa (Gemma Chan). Prime is duped into believing that for Cybertron to rise again, he has to destroy the human race once and for all.

This is all tied to something a lot larger and harder to explain; something that will make me sound like a crazy person if I even attempt to get through it all. Apparently, Transformers have been a part of human existence since The Dark Ages, when a renegade good-guy ‘bot decided to help the wizard Merlin (Stanley Tucci, hamming it up as much as everyone else here) facilitate the rise of King Arthur and the Knights of the Round Table. Merlin’s fabled staff, which he was buried with in an underwater tomb, was a Transformer weapon powerful enough to resurrect Cybertron. Naturally, Optimus, now dubbed Nemesis Prime, wants the staff and the evil Decepticon leader Megatron wants it, too. The only human who can wield the staff has to come from Merlin’s direct bloodline and be a member of a long line of “Witwiccans.” I don’t know if a spelled that right, and I doubt Bay and company give a crap if I did or didn’t.

Enter Anthony Hopkins as a demented keeper of the Arthurian secrets and his Transformer assistants: Cogman (Jim Carter), a butler ‘bot with a sociopathic split personality, and Hot Rod (Omar Sy), a perpetually horny French sports car. Their job is to bring together Vivian Wembley (Laura Haddock, who I’m sure was hired because she looks uncannily like Megan Fox), the last remaining member of Merlin’s bloodline, and Cade Yeager (Mark Wahlberg), the protagonist from Age of Extinction, who is now a Transformer defender and fugitive in possession of a talisman that protects and guides the pair towards the staff.

Did you get all of that detail and exposition that has been packed into the screenplay courtesy of Ken Nolan, Art Marcum, and Matt Holloway? Don’t worry. You’ll either forget all of it seconds after it happens and focus on just how lovingly armageddon seems to be exploding from every frame or get annoyed by how often Bay wants to remind the audience that there’s actually a lot of plot going on in this film about enormous robots fighting over a tiny, mystical chunk of metal. I haven’t even mentioned the addition of Isabel Moner as a precocious, tough talking orphan or Jerrod Carmichael as Cade’s skittish assistant.

Transformers: The Last Knight is a lot of movie, and perhaps because Bay is so enamoured with the enormity of his enterprise, it’s too much for any single film to handle. It’s exhausting, but that’s by design, and Bay’s more than willing to poke fun at his own carpet bombing approach to blockbuster filmmaking. Unlike the other films in the franchise, there’s a welcome streak of self-reflexivity here that sets Transformers: The Last Knight apart from its equally delusional brethren. Bay and the new writing team have effectively found a way to turn the Transformers franchise into something closer in line with the Fast and the Furious series. It embraces the fact that it’s an shambling mess that’s spilling out all over the place with gorgeous pyrotechnics and a bottomless visual effects budget, but unlike most times when Bay has been given this much free reign over a production (Bad Boys 2, the second and fourth Transformers films), he genuinely has the paying audience’s best interests in mind. It’s relentlessly paced, never stays in one place longer than it needs to, and in every scene something has to be moved forward or backwards. It’s the rare case of an efficient mess that delivers exactly what it wants to give to the viewer.

This giddy joy of playing in a zillion dollar sandbox while hyped up on Lucky Charms extends to the cast, particularly Hopkins, who throws any sense of good taste and refinement off a cliff and portrays his loopy academic like a pitchman from a mid-’90s toy commercial. There are few moments in cinema this year more delightfully earnest and surreal than watching Hopkins admonish a perplexed Wahlberg by barking “YOU WANNA KNOW, DONTCHA DUUUUUUUUUUUDE?” To offset whatever the heck it is that Hopkins is channeling, Wahlberg and Haddock play off each other with droll, sarcastic aplomb that makes them a joy to watch together. It looks like Transformers: The Last Knight was a draining film to make, but everyone involved gets to have some fun and show a sense of purpose (save for Moner, who’s fine but feels like sequel baiting fodder for future installments).

I would be remiss if I didn’t remark that Transformers: The Last Knight is also, inexplicably and unevenly, Bay’s most politically progressive film. Yes, the film features a heroine in skimpy outfits, but she’s still portrayed as the only hope for mankind and her capabilities are never in question. The Transformers are painted out to be refugees that humans should be getting to know and understand before dismissing or fearing them. Cade constantly reminds everyone around him that humanity should be helping those in need and not pushing them away. Cade has aligned himself with protectors on a First Nations reservation, and surprisingly Bay refrains from making any racist jokes about it. A child who says his daddy tells him to “shoot first and ask questions later” is openly chastised for his belief, which is a bit weird in a film all about shooting things. A Decepticon police car has the words “to punish and enslave” on the side, and most scenes dealing with the government are of the anti-authoritarian variety. These are timely messages on the surface level of the usually right-leaning Bay’s film, and all of them are relegated to the background when it comes time to blow up half the world in the grand finale, but it adds just enough to make Transformers: The Last Knight the only film in the franchise that attempts to be about anything grander than watching the world burn.

And it should go without saying that the action set-pieces that arrive every two or three minutes are impeccable. Once Bay learned how to hold on a shot for more than five seconds at a time, the franchise improved on a visual level considerably, and Transformers: The Last Knight is the director’s most accomplished spectacle to date. It’s still too much to ask any single human being of any age to handle, but somehow Bay has found a way to make such an elaborate enterprise into a snappy, kinetic bit of lowbrow fun. It’s the kind of film that modern audiences see only because they want to watch explosions and have their eardrums rattled by a sound mix that’s been engineered to shock and awe the viewer into submission. By those standards and the low bar the franchise has set, Transformers: The Last Knight isn’t a great work of cinema, but it’s a pretty good time at the movies.