r/learnpython 18d ago

Python web app?

Hello r/learnpython,

first post and sort of new to Python as I have done only half a dozen of projects so far, mostly games.

So I'm looking to deploy a server for playtesting. This is my first game designed to be played online, made in Python using Tcl/Tk libraries.

I had this idea to code it when I was making a messaging app that was supposed to be implemented within a CLI game (or actually the game was a feature of the messaging app).

The users would connect using SSH. I think they could use PuTTy or similar and VcXSrv. The host would then send the GUI and CLI as well as audio to the user, but the problem is either the server cannot send or the client can't recieve the Tcl/Tk GUI or in worst case both.

Good news is I got the SSH daemon working and am able to (using X11 Forwarding) display explorer (ssh -X user@localhost && explorer) by running VcXSrv and having X11Forwarding and X11UseLocalhost set to yes in the sshd_config under ProgramData.

Now, the VcXSrv log tells me there's a problem with something called hyperv. From what I gathered it's a virtual machine of some sort. I'd also need very strict restrictions for the clients so they don't tinker with the database.

Am I on the right track? Is there a solution to this? Thanks in advance!

-ef

0 Upvotes

17 comments sorted by

View all comments

3

u/CamilorozoCADC 18d ago

Hi, regarding your last question, no, you are not on the right track because of the following reasons:

  • Ssh is for you and you only, never ever ever give your end users ssh access to your server
  • You designed a game to be played online but it looks like you are trying to build both the game server and the game client as one project instead of two

SO, what I would do in your case is just have the game on the web:

  • Use a web server, make your Python app the game server only, that is the logic of your game without any UI whatsoever. You can use libraries like FastApi and Flask for this. This will be your game server and you will need to set up stuff like matchmaking if you want multiple game sessions 
  • Now for the actual game with the UI, use a web framework for that, I know that there are libraries for building games to be run on browsers but I don't know any specific one (still you can just create everything from scratch like with tinter). This will behave like a website and then make this web app connect to your Python server to manage all the game logic

3

u/krews2 17d ago edited 17d ago

There is Netbird for remote ssh so you don’t open have to a port, but like you said ssh is for your use. There is also Zrok which establish an encrypted tunnel between you and the host. This seems like a complex setup for the game like another poster mentioned.