J.M. DeMatteis is flattered that Dr. Ashley Kafka — one of the supporting characters he created in the 1990s when he wrote the adventures of Marvel Comics’ Spider-Man — appears in the upcoming “Amazing Spider-Man 2” movie.

“I based her — very loosely — on a therapist that I know whose last name is actually Kafka. I mean, isn’t that a perfect name for a therapist … and a comic book character? Plus, I’m fascinated with the psychological worlds these characters inhabit and having a resident therapist in the Spider-verse seemed like a good way into those kinds of stories,” said DeMatteis, 60, of upstate New York, who’ll appear at the Motor City Comic Con in Novi May 16-18.

A staunch ally of Spider-Man, Kafka runs the Ravencroft Institute, an asylum for the criminally insane. In the movie opening May 3, Kafka’s role hasn’t changed, but she’s now a he (played by “Lord of the Rings” actor Marton Csokas) — something that baffles DeMatteis.

“Why they made her a man is a real head-scratcher,” he said. “I think we need more female characters in these universes, not less.”

However, DeMatteis has enjoyed seeing Spider-Man come to life on the big screen via the vision of Royal Oak native Sam Raimi in the first “Spider-Man” trilogy, particularly 2004’s “Spider-Man 2.” In those movies, Tobey Maguire played Spider-Man and his alter-ego, Peter Parker. He also likes director Marc Webb’s spin, with Andrew Garfield taking over from Maguire.

“I thought Raimi’s second Spidey film was one of the best superhero movies ever. Not to say that I haven’t enjoyed the rest, (it was) just on another plane entirely,” DeMatteis said. “Maguire really brought Peter to life for me. … Garfield and Emma Stone (who plays love interest Gwen Stacy) together are just magical in the new movies. They raise the whole thing up to another level.”

In fact, DeMatteis said it’s Peter Parker — not Spider-Man — that gives the character such staying power after 51 years.

“Peter is, perhaps, the most psychologically real protagonist in mainstream comics. I believe in him, I relate to him,” DeMatteis said. “That’s what makes him such a dream to write. He’s everyman. He’s us.”

DeMatteis’ most famous Spider-Man story is 1987’s “Kraven’s Last Hunt.” In this dark psychological tale, the villainous Kraven buries Spider-Man alive.

“I was going through a tough time personally when I wrote it and I pretty much bled onto those pages. Poured all my pain and grief and hope into the story,” he recalled. “I think, when people read it, they feel that honesty — that emotional truthfulness — and respond to it.”

Originally a rejected Batman story, DeMatteis says it’s a better fit for Spider-Man.

“I’ve learned, over the years, that stories have lives of their own,” explained DeMatteis. “They know, far better than I do, when they’re ready to go out into the world and in what form. It’s frustrating sometimes, but I’ve learned to respect the process and let the story have its way with me. But in the end it’s impossible to say why some stories resonate in the public consciousness and others don’t. It’s a mystery!”

About one-third of what he signs at conventions is “Last Hunt” — something he’ll no doubt be signing in Novi.

“I’ve never been to the Detroit area and I’m very much looking forward to it,” said DeMatteis. “Should be great.”