Skip to content

Commit 65d2862

Browse files
committed
Update README.md for clarity on running the game and agent setup; add instructions for separate RPC server execution and binary creation process; modify requirements.txt to include Nuitka; add sleep in start.py for improved timing
1 parent c9e4c8e commit 65d2862

File tree

3 files changed

+71
-9
lines changed

3 files changed

+71
-9
lines changed

README.md

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Finally, to watch the game, download the monitor from [the original repository](
5757

5858
### Running a game
5959

60-
This section assumes you have installed the server & proxy using the scripts (as mentioned above).
60+
This section assumes you have download (installed) the server & proxy using the scripts (as mentioned above).
6161

6262
To run a game, you must first run the RoboCup Soccer Server, then your team and opponent team, and finally the monitor.
6363

@@ -97,7 +97,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
9797

9898
### start.py Arguments
9999

100-
##### Team and Name Customization
100+
| Team and Name Customization
101101

102102
| Argument | Short | Description | Default Value |
103103
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -106,7 +106,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
106106

107107
---
108108

109-
##### RPC Server Configuration
109+
| RPC Server Configuration
110110

111111
| Argument | Short | Description | Default Value |
112112
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -117,7 +117,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
117117

118118
---
119119

120-
##### RoboCup Soccer Server Configuration
120+
| RoboCup Soccer Server Configuration
121121

122122
| Argument | Short | Description | Default Value |
123123
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -126,7 +126,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
126126

127127
---
128128

129-
##### Agent Proxies
129+
| Agent Proxies
130130

131131
| Argument | Short | Description | Default Value |
132132
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -137,7 +137,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
137137

138138
---
139139

140-
##### Debug and Logging Options
140+
| Debug and Logging Options
141141

142142
| Argument | Short | Description | Default Value |
143143
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -185,11 +185,70 @@ As seen in the figure, the proxy handles connecting to the server, receiving sen
185185

186186
## Other Solutions To Run The Base Code
187187

188-
TODO
188+
### Running the base code with different rpc port
189+
190+
In soccer simulation 2D games (official competitions), each agents (players and coach) should be run in a separate process. So, you need to connect each agent to a rpc server (each agent has a separate rpc server). In this case, you need to run the rpc server for each agent separately. You can use the following commands to run the rpc server for each agent for debugging purposes.
191+
192+
| Note: For official competitions, tournament script will run each player/coach with separate command, so it will be like the next section, but the result will be the same as this section because the rpc server will be run for each agent separately.
193+
194+
``` Bash
195+
python3 start.py --use-different-rpc-port
196+
// or
197+
./start.sh --use-different-rpc-port
198+
```
199+
200+
### Running each agent and server separately
201+
202+
In soccer simulation 2D games (official competitions), each agents (players and coach) should be run in a separate process. So, you need to connect each agent to a rpc server (each agent has a separate rpc server). You can use the following commands to run each agent and rpc server separately.
203+
204+
``` Bash
205+
python3 start.py --goalie
206+
python3 start.py --player (you need to run this command 11 times)
207+
python3 start.py --coach
208+
// or
209+
./start.sh --goalie
210+
./start.sh --player (you need to run this command 11 times)
211+
./start.sh --coach
212+
```
213+
214+
### Running the rpc server and proxy separately
215+
216+
To run the rpc server and proxy separately, you can use the following commands.
217+
218+
``` Bash
219+
python3 server.py
220+
cd scripts/proxy
221+
./start.sh --rpc-type=grpc
222+
```
189223

190224
## Create Binary
191225

192-
TODO
226+
As you know python is an interpreted language and it is slow in comparison to C++. In official tournaments, an agent should send actions to the server in less than 100ms. Also, python may not be installed on the tournament server. So, you need to create a binary from your python code. You can use the following commands to create a binary from your python code.
227+
228+
``` Bash
229+
cd scripts
230+
./create_binary.sh
231+
```
232+
233+
After creating the binary, you can find it in the `scripts/binary` directory. In this directory, you can find the following files and directories:
234+
235+
- `start.bin`: The binary file that behaves like the `start.py` script. So, by running this file, you can run one rpc server and 12 proxy agents (11 players and 1 coach).
236+
- `start`: The tournament script will run this file to run your team in the tournament. This file will run one agent and one rpc server on random port.
237+
- `startAll`: This script is available for testing purposes. By running this file, it will call the `start` file 12 times to run 12 agents and 12 rpc servers.
238+
- `scripts`: This directory contains the necessary files to run the proxy.
239+
- `src`: This directory contains the formations of your team.
240+
241+
## How to debug your team
242+
243+
There are three different solution for debugging your team:
244+
245+
### Logging
246+
247+
You can use the logging module to log the information in rpc server code. By default, the logs are stored in the `logs` directory. For example, `agentX_Y.log` is the log file for the agent with unum `X` and `Y` is the unique id of the agent in rpc server (This one is not important for you). `proxy.log` is the log file for the proxy for all agents. `start-team.log` is the log file for the `start.py` script.
248+
249+
### Debug Mode
250+
251+
If you enable the debug mode, the proxy agents will be run in debug mode, so you can check graphical logs in `soccerwindow2` application. You can use `message Log` or `message DebugClient` to send the debug information to the proxy and then proxy will save them in file or send them directly to the `soccerwindow2` application to show them in the graphical interface. For more information, you can check the [IDL section in the documentation](https://clsframework.github.io/docs/idl/protobuf).
193252

194253
## Test Performance by using AutoTest
195254

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
grpcio==1.65.4
22
grpcio-tools==1.65.4
33
scipy==1.14.1
4-
pyrusgeom==0.1.2
4+
pyrusgeom==0.1.2
5+
Nuitka==2.5

start.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from server import main
1111
import random
1212
import select
13+
import time
1314

1415

1516
# Set up logging
@@ -175,6 +176,7 @@ def signal_handler(sig, frame):
175176
args.player = False
176177
if i == 0:
177178
args.goalie = True
179+
time.sleep(1)
178180
elif i == 12:
179181
args.coach = True
180182
else:

0 commit comments

Comments
 (0)