Search code examples
androidpythontwistedmultiplayer

Python: successful multiplayer web app, server overload, and timing issue


I'm building an android multiplayer web app for a class project, using Python.

All that happens is that buttons appear on the screen at random locations. The first player to click on the button gets a point. The button disappears once it's clicked. Whoever has the most points after 30 seconds wins. Up to 4 players can play on the same game.

I've read about a lot of different multiplayer approaches online and it just made me even more confused. I've read about Twisted, Django, PodSixNet, PyGame and others. But I don't know if these come included with multiplayer functionality or if I need to establish these connections myself - like create servers, sockets, http connections...

  1. For the four-player connection, do you recommend me using a framework like Twisted or Django for this project or should I use something more basic like the PodSixNet library? Or is there some special Python To Android framework that does this? Or is there another approach you recommend?

  2. Also will I be able to know who clicks on the button first using Twisted, Django, or PodSixNet or do I need to do something else? I assume there is some sort of timestamp method that can gets sent to the server once the button is clicked.

I hope you'll be able to answer these questions

Thanks in advance


Solution

  • I would suggest using something else entirely: autobahn. It runs on top of Twisted, using websockets. It has decent android support, should you choose to write a native android app. Make sure to check out the BeatBox demo with multiple browser sessions - it looks very similar to what you are doing (multiplayer with realtime updates).