I'm trying to develop a team-based Asteroids game. It's going well except for the "multiple user inputs to a single machine" part. Can anyone recommend a method for getting and updating 6 players using a single computer? Is it even possible? At the moment I'm working with a couple of old XBox controllers and a keyboard and it's almost working...

Is it possible to add additional keyboards? And would you arrange the code into one big get events function or is there a better way to check for user inputs at this scale?


1 Answer 1


I'm pretty sure you'll find it impossible to support multiple keyboards. This thread about multiple keyboards support for SDL indicated it was impossible, and pygame is at heart a python wrapper for SDL. Furthermore I believe it uses SDL 1.x not SDL 2.x, so it hasn't been actively developed for a long time. I'm not aware of any limits to the number of joysticks or game pads though, and a single usb bus can support theoretically 127 devices though you're likely to hit problems with power or bandwidth before that.

Regarding code architecture for handling many inputs gracefully, its hard to give advice to a problem that generalized. I think you'll find basic programming best practices helpful. You can use one big event loop as long as you 'Don't Repeat Yourself' in your implementation. You're welcome to read or use my solution.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .