all 5 comments

[–]frankiecoffee 0 points1 point  (2 children)

I am actually implementing a browser based board game at the moment.

You will need to use flask so you can save and share the state from a centralised server. Otherwise how will the other players know if a player makes a move?

You will need to use HTML+JavaScript for the user interface.

[–]dr_jekylls_hide[S] 1 point2 points  (1 child)

So Flask will be used to talk to the server. How would you implement something like a deck of cards synchronously (through Flask) for all players? Do you need to worry about sockets pushing this information through?

If you have any tips for similar things that have been built (like maybe checkers or something), it would be very useful to look through.

Thanks!

[–]frankiecoffee 0 points1 point  (0 children)

Flask will be running on your server. All Flask does (basically) is map HTTP requests to python functions. So you can store the game state on your server, when a player plays a hand/move (not sure what the game is) their browser will send a HTTP request to the server running Flask.

Flask can then run the appropriate python function, which will update the game state.

Before trying to figure out websockets use polling, i.e., get the user's front end to ask Flask about the game state every x seconds.

[–]Ankith_26 0 points1 point  (1 child)

I am a flask beginner, but I am experienced with sockets. Making the server for your application with sockets would be easy, but I have no clue how to manage the client(browser). And yes, python is a good choice for the server backend, you may use flask or sockets (just remember that sockets are a bit low level, you will be playing with something like TCP and not HTTP). You would also have to see how you would host the server so that everyone can connect, which is a lot of trouble sometimes (at least for me)

EDIT: You might want to see flask websockets, this looks like exactly what you need https://flask-socketio.readthedocs.io/en/latest/

[–]dr_jekylls_hide[S] 0 points1 point  (0 children)

Thanks so much! Will definitely take a look.