|
| 1 | +--- |
| 2 | +sidebar_position: 4 |
| 3 | +title: Soccer Simulation Proxy |
| 4 | +--- |
| 5 | +# Soccer Simulation Proxy |
| 6 | +[](https://github.com/helios-base/helios-base/blob/master/LISENCE) |
| 7 | + |
| 8 | +Developing a team can be complex due to the environment's intricacy, typically necessitating C++ programming. However, our framework allows for development in other languages by leveraging the [helios-base](https://github.com/helios-base/helios-base) features. By using **SoccerSimulationProxy**, you can develop a team in any language supported by **gRPC** or **Thrift**, such as **C#, C++, Dart, Go, Java, Kotlin, Node.js, Objective-C, PHP, Python, and Ruby**. |
| 9 | + |
| 10 | +To use **gRPC**, you can check out our [gRPC server](../../2-sampleserver/0-sample-python-base-code-gRPC/index.md), which is based on proto messages and gRPC services. This server provides a helpful base to get more familiar with the gRPC implementation. |
| 11 | + |
| 12 | +To use **Thrift**, you can check out our [thrift server](../../2-sampleserver/1-sample-python-base-code-thrift/index.md), which is based on proto messages and thrift services. This server provides a helpful base to get more familiar with the thrift implementation. |
| 13 | + |
| 14 | +This allows you to focus on developing your team's strategy and AI algorithms without worrying about the server's underlying complexity. |
| 15 | + |
| 16 | +```mermaid |
| 17 | +sequenceDiagram |
| 18 | + participant SS as SoccerSimulationServer |
| 19 | + participant SP as SoccerSimulationProxy |
| 20 | + participant PM as PlayMakerServer |
| 21 | + Note over SS,PM: Run |
| 22 | + SP->>SS: Connect |
| 23 | + SS->>SP: OK, Unum |
| 24 | + SP->>PM: Register |
| 25 | + PM->>SP: OK, ClientID |
| 26 | + SS->>SP: Observation |
| 27 | + Note over SP: Convert observation to State |
| 28 | + SP->>PM: State |
| 29 | + PM->>SP: Actions |
| 30 | + Note over SP: Convert Actions to Low-Level Commands |
| 31 | + SP->>SS: Commands |
| 32 | +``` |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | +If you would like to develop a team or conduct research using **Python**, **C#**, or **JavaScript**, you can check the following links: |
| 37 | + |
| 38 | +- [Playmaker-Server-Python-grpc](../../2-sampleserver/0-sample-python-base-code-gRPC/index.md) |
| 39 | +- [Playmaker-Server-Python-thrift](../../2-sampleserver/1-sample-python-base-code-thrift/index.md) |
| 40 | +- [Playmaker-Server-CSharp](https://github.com/CLSFramework/playmaker-server-csharp) |
| 41 | +- [Playmaker-Server-NodeJs](https://github.com/CLSFramework/playmaker-server-nodejs) |
| 42 | + |
| 43 | +This new base code is powered by Helios-Base and gRPC, designed to assist researchers in developing a Soccer Simulation 2D team or conducting research in this area. It supports development in any language compatible with gRPC. |
| 44 | +## How To Use it? |
| 45 | + |
| 46 | +To use this framework, follow the steps below in order: |
| 47 | + |
| 48 | +### 1 - Start the **rcssserver** |
| 49 | +The **rcssserver** hosts the game. You can follow the instructions for setting it up in the [soccersimulation server](./../5-soccersimulation/0-server/index.md). |
| 50 | + |
| 51 | +### 2 - Run the **Playmaker-Server** |
| 52 | +Next, run one of the sample Playmaker Servers, such as this [gRPC Server](../../2-sampleserver/0-sample-python-base-code-gRPC/index.md), to receive information from the agents and send appropriate actions back to the game. |
| 53 | + |
| 54 | +### 3 - Set up the **Soccer Simulation Proxy** |
| 55 | +Now, run the **Soccer Simulation Proxy** to connect to the **rcssserver** and handle information exchange between agents and the server. You can do this using AppImage, Docker, or by building from source. |
| 56 | + |
| 57 | +Here, we’ll explain how to run the Soccer Simulation Proxy using AppImage and build from the source. |
| 58 | + |
| 59 | +### 4.1 - Use **AppImage** |
| 60 | + |
| 61 | +#### 1. Download the AppImage |
| 62 | + You can download the AppImage from the [release page](https://github.com/CLSFramework/soccer-simulation-proxy/releases) or use the following command to download the latest version: |
| 63 | + ```bash |
| 64 | + wget $(curl -s "https://api.github.com/repos/clsframework/soccer-simulation-proxy/releases/latest" | grep -oP '"browser_download_url": "\K[^"]*' | grep "soccer-simulation-proxy.tar.gz") |
| 65 | + ``` |
| 66 | +#### 2. Extract the AppImage |
| 67 | +After downloading, extract the tar.gz file: |
| 68 | +```bash |
| 69 | +tar -xvf soccer-simulation-proxy.tar.gz |
| 70 | +``` |
| 71 | +#### 3. Run the Proxy |
| 72 | +After downloading, you can run the proxy: |
| 73 | +```bash |
| 74 | +cd SoccerSimulationProxy |
| 75 | +./start.sh |
| 76 | +``` |
| 77 | +If you want to connect the proxy to a grpc server change this parameter to `grpc` in start.sh file. |
| 78 | +```bash |
| 79 | +rpc_type="thrift" |
| 80 | +``` |
| 81 | +#### 4. Watch the Game |
| 82 | +To watch the game, you can use either of the following: |
| 83 | + |
| 84 | +- **[rcssmonitor](https://github.com/rcsoccersim/rcssmonitor)**: A tool to visualize the game. |
| 85 | +- **[SoccerWindow2](https://github.com/helios-base/soccerwindow2)**: Another visualization tool for RoboCup Soccer Simulation. |
| 86 | + |
| 87 | +For instructions on how to run **rcssmonitor**, check the [rcssmonitor](../../5-soccersimulation/1-monitor/index.md) or [soccer window 2](../../5-soccersimulation/2-soccerwindow/index.md). |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +### 4.2 - Build from **source, install, and run (Linux, WSL)** |
| 92 | + |
| 93 | +To build the soccer simulation proxy, you need to install the following dependencies: |
| 94 | + |
| 95 | +#### 1. LibRCSC |
| 96 | + |
| 97 | +```bash |
| 98 | +git clone git@github.com:helios-base/librcsc.git |
| 99 | +cd librcsc |
| 100 | +git checkout 19175f339dcb5c3f61b56a8c1bff5345109f22ef |
| 101 | +mkdir build |
| 102 | +cd build |
| 103 | +cmake .. |
| 104 | +make |
| 105 | +make install |
| 106 | +``` |
| 107 | + |
| 108 | +#### 2. gRPC - follow the instructions provided in the [repository](https://grpc.io/docs/languages/cpp/quickstart/) |
| 109 | + |
| 110 | +```bash |
| 111 | +export MY_INSTALL_DIR=$HOME/.local |
| 112 | +mkdir -p $MY_INSTALL_DIR |
| 113 | +export PATH="$MY_INSTALL_DIR/bin:$PATH" |
| 114 | +sudo apt install -y build-essential autoconf libtool pkg-config |
| 115 | +git clone --recurse-submodules -b v1.62.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc |
| 116 | +cd grpc/ |
| 117 | +mkdir -p cmake/build |
| 118 | +pushd cmake/build |
| 119 | +cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR ../.. |
| 120 | +make -j 4 |
| 121 | +make install |
| 122 | +``` |
| 123 | + |
| 124 | +then, add the following lines at the end of $HOME/.bashrc |
| 125 | + |
| 126 | +```bash |
| 127 | +export MY_INSTALL_DIR=$HOME/.local |
| 128 | +export PATH="$MY_INSTALL_DIR/bin:$PATH" |
| 129 | +``` |
| 130 | + |
| 131 | +then, run the following command |
| 132 | + |
| 133 | +```bash |
| 134 | +source $HOME/.bashrc |
| 135 | +``` |
| 136 | + |
| 137 | +To test grpc, go to grpc directory (in this example it is in $HOME/grpc) and run the following commands: |
| 138 | + |
| 139 | +```bash |
| 140 | +cd examples/cpp/helloworld |
| 141 | +mkdir -p cmake/build |
| 142 | +cd cmake/build/ |
| 143 | +cmake -DCMAKE_PREFIX_PATH=$MY_INSTALL_DIR ../.. |
| 144 | +make |
| 145 | +run ./greeter_server in one tab |
| 146 | +run ./greeter_client in another tab |
| 147 | +``` |
| 148 | + |
| 149 | +#### 3. SoccerSimulationProxy |
| 150 | + |
| 151 | +```bash |
| 152 | +git clone git@github.com:CLSFramework/soccer-simulation-proxy.git |
| 153 | +cd soccer-simulation-proxy |
| 154 | +mkdir build |
| 155 | +cd build |
| 156 | +cmake .. |
| 157 | +make |
| 158 | +``` |
| 159 | + |
| 160 | + |
| 161 | +#### 4. Run Soccer Simulation Proxy |
| 162 | + |
| 163 | +To run the Soccer Simulation Proxy, you can use the following command: (You should run the Soccer Simulation Server and a PlayMaker Server before running the Soccer Simulation Proxy) |
| 164 | + |
| 165 | +```bash |
| 166 | +cd build/bin |
| 167 | +./start.sh |
| 168 | +``` |
| 169 | + |
| 170 | +To run the Soccer Simulation Proxy in debug mode, you can use the following command: |
| 171 | + |
| 172 | +```bash |
| 173 | +cd build/bin |
| 174 | +./start-debug.sh |
| 175 | +``` |
| 176 | + |
| 177 | +#### 5. Watch the Game |
| 178 | +To watch the game, you can use either of the following: |
| 179 | + |
| 180 | +- **[rcssmonitor](https://github.com/rcsoccersim/rcssmonitor)**: A tool to visualize the game. |
| 181 | +- **[SoccerWindow2](https://github.com/helios-base/soccerwindow2)**: Another visualization tool for RoboCup Soccer Simulation. |
| 182 | + |
| 183 | +For instructions on how to run **rcssmonitor**, check the [rcssmonitor](../../5-soccersimulation/1-monitor/index.md) or [soccer window 2](../../5-soccersimulation/2-soccerwindow/index.md). |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | +## References |
| 189 | + |
| 190 | +The paper about HELIOS Base: |
| 191 | +- Hidehisa Akiyama, Tomoharu Nakashima, HELIOS Base: An Open Source |
| 192 | +Package for the RoboCup Soccer 2D Simulation, In Sven Behnke, Manuela |
| 193 | +Veloso, Arnoud Visser, and Rong Xiong editors, RoboCup2013: Robot |
| 194 | +World XVII, Lecture Notes in Artificial Intelligence, Springer Verlag, |
| 195 | +Berlin, 2014. http://dx.doi.org/10.1007/978-3-662-44468-9_46 |
| 196 | + |
| 197 | +# Citation |
| 198 | + |
| 199 | +- [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621) |
| 200 | +- Zare, N., Sayareh, A., Sadraii, A., Firouzkouhi, A. and Soares, A., 2024. Cross Language Soccer Framework: An Open Source Framework for the RoboCup 2D Soccer Simulation. arXiv preprint arXiv:2406.05621. |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
0 commit comments