Running PyGame?

I want to be able to run PyGame on Anvil and use sockets to be able to connect multiple players to a game. I’m very new to Anvil so I’m not sure what it’s limitations and capabilities are yet, so if anyone has tried it out I’d like to hear back!

Pygame will not run under Anvil. The only Python packages you can run on the client side are ones that will run under Skulpt, the Javascript interpreter that runs Python code in the client. Pygame by default isn’t one of those (there is an attempt to get Pygame to run under Skulpt, but I don’t think you want to mess with shoehorning a partial port into Anvil).

What you want for the multiplayer game is to write the game as normal under Pygame, and write the server in Anvil using HTTP endpoints. The Pygame game will make calls out to the server and the Anvil app will coordinate the multiplayer aspects.

1 Like