Skip to content

Commit 202cac7

Browse files
committed
Update py2d documentation from README
1 parent 64500a1 commit 202cac7

File tree

1 file changed

+91
-8
lines changed

1 file changed

+91
-8
lines changed

docs/6-basecode/py2d/index.md

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,30 @@ You can find more information about the services and messages in the [IDL sectio
2020

2121
there are many different ways to run the base code, in the next section, we will explain the easiest way to run the base code.
2222

23+
## Results
24+
25+
### .vs Helios Base
26+
27+
| Summary Statistics
28+
29+
- **Game Count**: 100
30+
- **Goals**: 234 : 143 (diff: 91)
31+
- **Points**: 212 : 71 (diff: 141)
32+
- **Average Goals**: 2.34 : 1.43 (diff: 0.91)
33+
- **Average Points**: 2.12 : 0.71 (diff: 1.41)
34+
- **Win**: 65, **Draw**: 17, **Lost**: 18
35+
- **Win Rate**: 65.00%
36+
- **Expected Win Rate**: 78.31%
37+
- **95% Confidence Interval**: [55.65%, 74.35%]
38+
39+
| Goals Distribution
40+
41+
```mermaid
42+
xychart-beta
43+
title "Diff Goals Distribution"
44+
x-axis [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
45+
y-axis "Percentage"
46+
bar [4,2,5,7,17,27,19,13,4,2]
2347
## Quick start
2448
2549
### Preparation
@@ -61,7 +85,7 @@ Finally, to watch the game, download the monitor from [the original repository](
6185

6286
### Running a game
6387

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

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

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

102126
### start.py Arguments
103127

104-
##### Team and Name Customization
128+
| Team and Name Customization
105129

106130
| Argument | Short | Description | Default Value |
107131
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -110,7 +134,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
110134

111135
---
112136

113-
##### RPC Server Configuration
137+
| RPC Server Configuration
114138

115139
| Argument | Short | Description | Default Value |
116140
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -121,7 +145,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
121145

122146
---
123147

124-
##### RoboCup Soccer Server Configuration
148+
| RoboCup Soccer Server Configuration
125149

126150
| Argument | Short | Description | Default Value |
127151
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -130,7 +154,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
130154

131155
---
132156

133-
##### Agent Proxies
157+
| Agent Proxies
134158

135159
| Argument | Short | Description | Default Value |
136160
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -141,7 +165,7 @@ To watch the game, you must run the rcssmonitor or soccerwindow2. press <kbd>Ctr
141165

142166
---
143167

144-
##### Debug and Logging Options
168+
| Debug and Logging Options
145169

146170
| Argument | Short | Description | Default Value |
147171
|---------------------------|-------|------------------------------------------------------------------|-----------------|
@@ -189,11 +213,70 @@ As seen in the figure, the proxy handles connecting to the server, receiving sen
189213

190214
## Other Solutions To Run The Base Code
191215

192-
TODO
216+
### Running the base code with different rpc port
217+
218+
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.
219+
220+
| 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.
221+
222+
``` Bash
223+
python3 start.py --use-different-rpc-port
224+
// or
225+
./start.sh --use-different-rpc-port
226+
```
227+
228+
### Running each agent and server separately
229+
230+
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.
231+
232+
``` Bash
233+
python3 start.py --goalie
234+
python3 start.py --player (you need to run this command 11 times)
235+
python3 start.py --coach
236+
// or
237+
./start.sh --goalie
238+
./start.sh --player (you need to run this command 11 times)
239+
./start.sh --coach
240+
```
241+
242+
### Running the rpc server and proxy separately
243+
244+
To run the rpc server and proxy separately, you can use the following commands.
245+
246+
``` Bash
247+
python3 server.py
248+
cd scripts/proxy
249+
./start.sh --rpc-type=grpc
250+
```
193251

194252
## Create Binary
195253

196-
TODO
254+
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.
255+
256+
``` Bash
257+
cd scripts
258+
./create_binary.sh
259+
```
260+
261+
After creating the binary, you can find it in the `scripts/binary` directory. In this directory, you can find the following files and directories:
262+
263+
- `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).
264+
- `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.
265+
- `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.
266+
- `scripts`: This directory contains the necessary files to run the proxy.
267+
- `src`: This directory contains the formations of your team.
268+
269+
## How to debug your team
270+
271+
There are three different solution for debugging your team:
272+
273+
### Logging
274+
275+
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.
276+
277+
### Debug Mode
278+
279+
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).
197280

198281
## Test Performance by using AutoTest
199282

0 commit comments

Comments
 (0)