<Game Title>
is a 2D directional game written in Python. It uses websockets.io to allow for multiple client connections and asyncio to handle concurrent functionality.
The game showcases the use of websockets to transmit information back and forth via a client <--> server <--> client
interaction.
Example output:
Websocket server running.
No active connections.
Connection from 0b5f1b13-5bca-418a-8712-8314d85d0796 received.
Active connections: 1
{15115325313996918011285746583835838358: {'x': 1735, 'y': 5697, 'health': 100, 'ping': 250}}
{15115325313996918011285746583835838358: {'x': 1735, 'y': 5697, 'health': 100, 'ping': 250}}
{15115325313996918011285746583835838358: {'x': 1735, 'y': 5697, 'health': 100, 'ping': 250}}
{15115325313996918011285746583835838358: {'x': 1735, 'y': 5697, 'health': 100, 'ping': 250}}
{15115325313996918011285746583835838358: {'x': 1735, 'y': 5697, 'health': 100, 'ping': 250}}
...
...
...
All snippets have to run from within project root directory.
-
Run
pipenv install -r dev.requirement.txt
to install dependencies. -
To activate the virtual environment, run
pipenv shell
. -
Run the following to start the server:
python ./server/server_handler.py
. -
Once the server starts, run the following to start a client:
python main.py
. -
You will be presented with an option to change the ip address of the server. This defaults to
port 8765
on127.0.0.1
/localhost
-
You can use your directional keys to control movement and see data getting transmitted through the active websocket connection.
-
Enjoy!
Krishy Fishy | MyApaulogies | rami.alloush | Pixler | gvsa123
As part of the challenge, we wanted to focus on getting the functionality of the required technologies working before implementing more advanced game-related functionality and features. Below is an outline of what we would like to continue working on:
- Use ping attacks to slow the movement of another player allowing others to fire more aggressive weapons.
- Multiplayer LAN functionality