Alan Tudyk is no stranger to playing robots.

The Texas-born actor, who lived in New York City for about a decade, played Sonny in the 2004 sci-fi flick “I, Robot,” and now he’s back in mechanical form for “Rogue One: A Star Wars Story” as the sassy droid K-2SO, a rebel character pivotal in stealing the plans for the Death Star.

“One of the main defining things about him [is] he’s formerly of the Empire,” Tudyk says. “He was the Imperial droid, the enforcer droid, that has been reprogrammed, [but] it made him a little frank in way that isn’t always appreciated and he’s very willful. He does a bit of what he wants versus what he’s told.”

amNewYork spoke with Tudyk about the film.

What is your history with “Star Wars.” Were you a big fan growing up?

Yeah, I had seen the original one in the theater. I was just a young lad of 6 years old. But I saw it with my older brother. And I was pretty young. I was blown away by it and definitely by “Empire Strikes Back.” I was a full-blown fan. But there’s the toys. I always remember the toys: the lightsabers, the action figures that we had. You kept the movie going because you were playing “Star Wars” in between [movies]. So, it became part of my childhood — everybody’s childhood that I knew.

The droids are some of the most memorable characters in “Star Wars.” How do you think K-2SO fits in with that group?

I think he’s going to be a fun, new addition in that he’s less subservient than others. I always liked R2-D2. One of my favorite traits about him is he was devoted to his mission. He was, I guess, in that way, subservient. But he wouldn’t listen to C-3PO. ... I always liked that about him. He had his own mission that he was on. And K-2SO is sort of the same. He had his own values and his own priorities.

I know that you did motion capture for this. How was it filming? I heard you had a fun suit. Was it a Ping-Pong ball suit?

There were no Ping-Pong balls! Because it’s ILM. It was a Ping-Pong free suit. It was just interesting. I’d never seen one before. It has a bizarre pattern on it that they can sync the digital film to. ... So I just acted wearing that suit. Also some stilts. I was 7-foot-one. That was the other difference. But basically, I just got to act with everybody and they did all the hard stuff once we were done [laughs].

Did you fall? What it hard to get acclimated?

It wasn’t. I had done a little clown play in Manhattan — Off-Off-Broadway called “That Beautiful Laugh” where I wore some really crappily-made stilts and these were made of Industrial Light & Magic. [laughs] They were really, really easy. I had trained on Off-Off-Broadway stilts, doing salsa in them. So this was pretty much, I’d say, a walk in the park. [laughs] But that seems silly.

So this isn’t the first time you played a robot. What do you think makes for a good robot voice?

Well, for K-2SO we went with an English accent because he was formerly an Imperial droid and there was a lot of history with English-accented Imperial officers. Even C-3PO is English. ... When I did Sonny in “I, Robot,” the thought behind his voice was that he spoke every word the correct way because he was a droid. So you said every word, or I would say every word correctly, which is called mid-Atlantic speech. It’s basically the voice and speech training that I got at drama school in New York. ... But luckily in “Star Wars,” the droids have much more personality, so they can be a little bit more relaxed with their delivery.

Tell me about your time in New York. How long were you here?

I went to Juilliard and started there in 1993. And went there for three years and got my first job Off-Broadway in a play called ”Bunny Bunny” that was at the Lucille Lortel Theater. And that started me having a stage career. I did a Roundabout show and was doing all of the Long Wharf, Yale Rep and all the Manhattan Theater Club and all that stuff. Did a couple of Broadway shows. And I was just sort of being pulled out to go do television and movies. It ended when I went off to do “Firefly” for Joss Whedon in 2001, 2002. But, yeah, I lived there for 10 years. I loved it. I lived on the West Side. I lived in what was then Hell’s Kitchen but now it’s fancy Clinton. The names have changed. It all looks different. It’s new. It should almost be in the name of the city.

Do you ever have the desire to come back to Broadway?

Oh, my god, yes! The last thing I did was at the Roundabout — it was “Prelude to a Kiss.” So that was 2008, 2009. So it’s been so long. I used to be able to do it every three years. I would love to. I think I would love to do that more than anything. If I could just set what my next job is, I would go to Broadway or Off-Broadway — whatever, a play. And there’s no better place to do it than New York City. Truly.

Speaking of next jobs. I know the new season of “Con Man” is coming out. Can you talk about what’s coming up?

We did a season last year and just put it on Vimeo. We had crowdfunded it and raised $3.2 million or something to make the show and made a game called “Con Man: The Game.” It’s an app. It’s about building your own Comic Con Convention and you fight aliens also. But we made the show and Lionsgate asked to make more and gave us money to make more, so we did. [laughs] There’s no one who writes and directs that doesn’t love to hear somebody say, “Can we give you money to make more of the show you like writing?” So we did a second season and it’s all about my character, he’s at the center of it. He’s someone who has some similarities to my own career in that he was on a sci-fi show that was canceled too soon, just like I was on “Firefly” — the Joss Whedon show. Except his career sort of peters out; he made some bad career choices and he is now stuck going to comic conventions to make money. And he’s waiting for his career to take off and it doesn’t look like it’s ever going to. His best friend — played by Nathan Fillion — who is the spaceship captain on the same show that was canceled too soon, has gone on to be like Matt Damon famous. And so a lot of time we’re at comic conventions and sometimes we’re just following [my character] Wray trying to make it in Hollywood. This season we have a musical, which is great, with Lou Ferrigno. I can’t wait for people to see that, doing “Of Mice and Men” with Lou Ferrigno. And I met him at a convention and he said, “Let’s do that play together.” I was like, “That’s a brilliant idea and I have a way to that, that’s kind of doing that play.” And we did it [laughs]. We did it! We’ve got like five songs; we made it into a musical. It’s really funny. I set out to write a show for people who know that comic cons exist, but haven’t been to them. Either they love them or they are curious about them. And it’s a way to look in on that world and see it in a comedy that can appeal to really anyone who likes ridiculous situations and silly people.

How about “Powerless,” coming to NBC in February?

“Powerless” we’re shooting right now. It’s a lot of fun. It’s the DC universe, so again it’s back in the comic book world. It’s set in a fictional city called Harmony, which is kind of like Detroit. Gotham is the New York City and then we’re sort of Detroit. And we have superheroes there that fight and blow things up in the city and it just makes life really hard. If somebody comes and freezes the city ... you get stuck at work. The furnace goes out. ... We work at a security company. I play a distant relative of Bruce Wayne named Van Wayne. It’s great. Vanessa Hudgens and Danny Pudi are in it. It’s a great group of people. We’re having a blast.