my biggest project. combining all my knowledge of python together: flask, websocket, classes, exceptions, interfaces, ...
your account is saved in a database.
(currently not a hshed password.)
you can add accounts to be your friends.
friends also being saved in a database.
you can send messages during games but they are not saved in a database.
you can move with the arrows during games.
just the server is moving the players, not the front-end.
if you stand on someone's avatar and press space you "eat" the player and his avatar returns to position 0, 0.
every time you "eat" someone you get 10 xp (experience points).
the xp is saved in a database.
id int (pk, ai) | username varchar(255) | pass varchar(255) | xp int
friend int (fk: users(id)) | f_of int (fk: users(id))
- mysql workbench database (add the tables detailed above)
open terminal and run :
>>>git clone https://github.com/erri4/websocket.git
>>>cd websocket
>>>pip install -r requirements.txt
then:
- add a file named
.env - inside, write your DB credentials in these enviroment variables:
DB_PASS
DB_HOST
DB_USER
DB_DB
DB_PORT>>>flask run
the server is now running on your local net at your ip address.