Written and directed by Greg Harrison

It has taken moviemakers and, more crucially, foot-dragging movie investors almost a decade to catch up with rave culture -- the heady mix of secret warehouses, electronic music, designer drugs and ecstatic dancing that has come to define the yearning and the restlessness of a generation. But now, the 5 a.m. faithful and curious onlookers alike are getting two cinematic glimpses into the rave scene. Justin Kerrigan's Human Traffic parties hard in Cardiff, Wales, the 25-year-old director's hometown, whereas American Greg Harrison, a senior citizen at 31, spends one long, eventful night on the San Francisco rave circuit in Groove. It's striking how many things these two movies, conceived 8,000 miles apart, in vastly different atmospheres, have in common -- not just in their pounding techno beats but in the spirit of discovery and the collective joy they portray. Clearly both filmmakers believe in the liberating effects of staying up till dawn with members of your tribe, barely one step ahead of the cops.

First-time director Harrison, who served a 10-year stretch as a Hollywood film editor, has modeled his picture, more or less, on a pair of previous hits. Like George Lucas' landmark comedy American Graffiti, it seeks to capture the hopes and dreams of coming-of-age by throwing a diverse group of young characters into a search for self-knowledge. Like Richard Linklater's more recent Dazed and Confused, it reminds us that getting that knowledge has never been easy -- especially when hormones are raging, dope is plentiful and your head is stuffed full of ill-formed ideas.

The sweetness in Groove -- its seekers are neither tragically hip nor fashionably nihilistic -- arises, in part, from Harrison's reluctance to approach the dangerous edges of the rave life. "I wanted to show the essential delight of the music and the catharsis of the dance floor," he told me in a recent interview. "I wanted to put a human face on a marginalized youth subculture and make order of what many people see as chaos."

To that end, he's conjured up a group of thoroughly likable characters, children of the night occasionally beleaguered by self-doubt and bad party directions but never by the slightest hint of meanness, stupidity or violence. They include free-spirited Colin (Denny Kirkwood), who's an old hand at raving; his reserved brother David (Hamish Linklater), who's the obligatory baffled newcomer; and Colin's girlfriend, Harmony (Mackenzie Firgens), who, with her fresh face and pigtails, looks more like a sixth-grader than what she becomes here, which is a woman engaged to be married. Harrison has also thrown in a slick New York import named Leyla (Lola Glaudini), who wears $500 leather pants and talks the talk like a pro but who's just as confused and rudderless beneath her veneer as everybody else. Viewers shopping for a mantra to suit an entire generation needn't look any farther than Leyla's heartfelt lament: "I just wanna commit to something -- without any fear."

Four insomniacs do not a party make, of course, so the moviemaker has surrounded his principals with a winning collection of minor players, among them a thirtysomething grad student who doubles as the ravers' friendly local pharmacologist; a pair of gay lovers who spend the whole movie wandering around the city in their Volkswagen bug, searching in vain for the secret party site; a vivid assortment of DJs and scores of dancers recruited from the real-life San Francisco scene, who jump and gyrate to a lovingly assembled soundtrack athrob with all manner of progressive electronica, from the Hardkiss Brothers to Jondi and Spesh to Symbiosis to Bandwidth. We also meet the supercool rave organizer Ernie, who has well-honed gifts for unearthing a killer space, getting the word out by way of the Internet, hooking up electricity and steering the police away. Ernie's main reward is something he calls "the Nod" -- the silent acknowledgment by a fellow raver that his tireless exertions have transformed and enriched yet another life. On the morning after the night Groove takes place, it is the formerly uptight David who has been forever changed and who delivers the Nod. David has discovered not only ecstasy and Leyla but something about his own true nature. In the end, everyone goes home happy.

This is not exactly what potential investors wanted to hear when Harrison went looking for money three years ago in Los Angeles. When they learned no one in Groove would overdose or get stabbed, he reports, they promptly slammed their wallets shut. The director eventually got his financing -- a scant million dollars or so -- mainly from young San Francisco-area Internet entrepreneurs who hit the rave circuit themselves once in a while. One 23-year-old backer with blue hair, Harrison reports, rode up on a skateboard and promptly wrote a check for $75,000.

If Groove looks and feels, in many places, like a rather idealized vision of the rave scene, it's also an exceptionally energetic and observant one. Harrison started going to San Francisco raves back in 1993, and he's brought what he's seen and felt straight to this high-spirited, good-natured movie. There are blissed-out kids lying in puppy-dog piles in the "chill room"; would-be writers earnestly discussing their forebears in social experiment, guys like Burroughs and Kerouac; and scores of enraptured dancers losing (and maybe finding) themselves in a rumble of techno, gaggles of ravers who've found their Woodstock in a warehouse and understand right down to their cores that they are among friends. As a musical feast, Groove works well. As a celebration of tribal ritual, it's even better.

Opens July 14 at the Tivoli.