Great movies often feel as though they are in conversation with other movies. Beach Rats, the second feature film from Eliza Hittman, is not quite a great movie, but it aspires to be one.

A tone poem about a young man struggling with his attraction to other men, Beach Rats recalls Saturday Night Fever, another film about frustrated masculinity set in blue-collar Brooklyn. Frankie, played by the electric Harris Dickinson, is a spiritual successor to Tony Manero. Both characters struggle to find themselves in an environment that doesn’t appear to have many options for the men they want to be. Beach Rats is the rare movie to feel like a descendant of both Kenneth Anger and Harmony Korine. Anger festishizes masculinity, whereas Korine explores the consequences when manhood isn’t fully realized.

Viewers expecting a traditional coming-of-age story, in which Frankie embraces his identity, will likely leave disappointed. Beach Rats is too wise and intelligent about human nature to offer conventional answers.

Hittman’s film is set against the electric fireworks of Brighton Beach, the predominantly Russian neighborhood surrounding Coney Island. Frankie and his teenage friends spend their idle evenings playing carnival games and searching for purpose, even if they don’t know that yet. Right now, they’d just like to score some good pot. The urban mise-en-scene, as filmed by cinematographer Hélène Louvart (The Beaches of Agnès), is simultaneously bleak and idylliclike a Katy Perry video filmed by the Dardenne brothers.

During their nighttime excursions, Frankie meets a young woman, Simone (Madeline Weinstein), whose apparent interest helps hide his secret: He could never like her back.

When Frankie is home alone, he browses a webcam site where gay men in Brooklyn chat with other men to meet up with. The fictional platform is half-Chatroulette, half-Tinder. He’s too afraid at first to do anything but long for the things he cannot have, but Frankie’s yearning leads to a series of furtive encounters. He believes that his mother (Kate Hodge) doesn’t know about where he goes late at night, but anyone who has ever been a parentor been parentedunderstands that she knows more than she says.

Frankie’s terror at being outed, expressed powerfully by Dickinson’s wordless slouch, is real. When he dips his toes into the water by asking his pals whether they would ever be friends with a gay person, they react with a revulsion that could turn violent under the wrong circumstances.

That powder keg nearly ignites one evening after Frankie convinces them to terrorize one of his hookups. In Beach Rats’ most grueling and sickeningly thrilling scene, Frankie almost confesses to his double life. But instead he tells his friends that his chatroom dalliances are just part of a con: Frankie says that he merely pretends to be gay so he can bait guys into meeting up and then smoke all their weed. Both intrigued and repulsed by this idea, the boys lure a shy city boy, Jeremy (Harrison Sheehan), to the docks of Coney Island in order to make good on Frankie’s implied promise. The plot quickly turns to chaos and then violence.

But Beach Rats isn’t a noir morality talein which grievous sins are committed, punished, and atoned for. The film is about the guilt and shame that never finds release. Throughout the movie, the fluid camera captures Frankie gazing at both heterosexual and same-sex couples holding hands. In Beach Rats, the closet is the real prison, and it keeps those locked inside from being truly human.

Pittman’s portrait of a man trapped between two worlds isn’t perfect. The film’s minimalistic touches work terrifically from a visual perspective, but less so from a story one. Frankie’s home life isn’t as fleshed out as it could be; the texture of his relationships have to be inferred, rather than being observed.

But Beach Ratswhich is very, very goodwouldn’t work as smashingly as it does without a truly compelling performance at its center. Dickinson is a real find. A 20-year-old British actor, he always knows the right emotional tone to play Frankie’s wounded machismo. Dickinson shows hints of vulnerability, particularly during a scene where he rejects Simone’s sexual advances by lashing out at her, but he never gives too much away. If Beach Rats gets the audience it deserves, it could be a star-making role for the young up-and-comer.

This summer has been criticized as one of the worst for the movies in recent years, littered with bloated tentpoles that collapsed under their own weight. But amidst those doldrums, Beach Rats emerges as a reminder of what cinema can do: If boys like Frankie cannot open the door themselves, Beach Rats helps us dream of a world in which they are free.