- Python 100%
| api.py | ||
| client.py | ||
| config.json | ||
| handler.py | ||
| LICENSE | ||
| README.md | ||
| server.py | ||
Dani's Race Multiplayer
The server / client stack for Dani's Race.
Installation / Testing
To install this you need clone the repository:
git clone https://forg.madiator.cloud/BlenderDumbass/DanisRace_Multiplayer
It will download the folder DanisRace_Multiplayer to your computer.
So now you can navigate to said folder:
cd DanisRace_Multiplayer
And launch the server software:
python3 server.py
You may want to setup port forwarding to have your server visible from the global network.
To test that everything works, you can use client.py script.
Part of the client.py file:
hostname = "95.216.112.32"
port = 7860
As you can see it wants to connect to 95.216.112.32 port 7860 by default. At one point that was a server we used for development on Dani's Race Multiplayer. You may want to change the code to your server's IP and Port to make it connect.
Methods
Those are the methods you can type in the client.py program to make it do things.
When connecting to the server via Dani's Race, this is the interface that is used
for the game.
START GAME
Starts a new game on the server
Request
{"new_game":"Game"}
Response if the game isn't yet created:
{"new_game":"Game"}
Response if the game is already created:
{"new_game":"Game_2"}
LIST GAMES
Lists all games currently on the server
Request:
{"games":null}
Response:
{"games":["Game", "Game_2"]}
JOIN GAME
Join a game on a server.
Request:
{"join":"Game"}
Response if game is found:
{"join":"Game"}
LIST USERS
Lists all users on the server
Request:
{"players":null}
Response:
{"players":["Player_1", "Player_2"]}
GET USERNAME
Gets your current username
Request:
{"username":null}
Response if the name is not taken:
{"username":"BlenderDumbass"}
CHANGE USERNAME
Request:
{"username":"BlenderDumbass"}
Response if the name is not taken:
{"username":"BlenderDumbass"}
Response if the name is taken:
{"username":"BlenderDumbass_2"}
ALLOCATE IDS
Request from the server to give proper IDs that can be used for object's netIds in the game.
Request ( int for the number of IDs ):
{"ids":3}
Response ( list of the ids ):
{"ids":["hy4g","is8j", "5yg4"]}