|
| 1 | +# Soccer Simulation Proxy |
| 2 | +[](https://github.com/helios-base/helios-base/blob/master/LISENCE) |
| 3 | + |
| 4 | +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**. |
| 5 | + |
| 6 | +To use **gRPC**, you can check out our [gRPC server](https://github.com/CLSFramework/sample-playmaker-server-python-grpc), which is based on proto messages and gRPC services. This server provides a helpful base to get more familiar with the gRPC implementation. |
| 7 | + |
| 8 | +To use **Thrift**, you can check out our [thrift server](https://github.com/CLSFramework/sample-playmaker-server-python-thrift), which is based on proto messages and thrift services. This server provides a helpful base to get more familiar with the thrift implementation. |
| 9 | + |
| 10 | +This allows you to focus on developing your team's strategy and AI algorithms without worrying about the server's underlying complexity. |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +If you would like to develop a team or conduct research using **Python**, **C#**, or **JavaScript**, you can check the following links: |
| 16 | + |
| 17 | +- [Playmaker-Server-Python-grpc](https://github.com/CLSFramework/sample-playmaker-server-python-grpc) |
| 18 | +- [Playmaker-Server-Python-thrift](https://github.com/CLSFramework/sample-playmaker-server-python-thrift) |
| 19 | +- [Playmaker-Server-CSharp](https://github.com/CLSFramework/playmaker-server-csharp) |
| 20 | +- [Playmaker-Server-NodeJs](https://github.com/CLSFramework/playmaker-server-nodejs) |
| 21 | + |
| 22 | +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. |
| 23 | +## How To Use it? |
| 24 | + |
| 25 | +To use this framework, follow the steps below in order: |
| 26 | + |
| 27 | +### 1. Start the **rcssserver** |
| 28 | +The **rcssserver** hosts the game. You can follow the instructions for setting it up in the [soccersimulation server](./../5-soccersimulation/0-server/index.md). |
| 29 | + |
| 30 | +### 2. Run the **Playmaker-Server** |
| 31 | +Next, run one of the sample Playmaker Servers, such as this [gRPC Server](https://github.com/CLSFramework/sample-playmaker-server-python-grpc), to receive information from the agents and send appropriate actions back to the game. |
| 32 | + |
| 33 | +### 3. Set up the **Soccer Simulation Proxy** |
| 34 | +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. |
| 35 | + |
| 36 | +Here, we’ll explain how to run the Soccer Simulation Proxy using AppImage and build from the source. |
| 37 | + |
| 38 | +### 1 - AppImage |
| 39 | + |
| 40 | +#### 1. Download the AppImage |
| 41 | + 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: |
| 42 | + ```bash |
| 43 | + 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") |
| 44 | + ``` |
| 45 | +#### 2. Extract the AppImage |
| 46 | +After downloading, extract the tar.gz file: |
| 47 | +```bash |
| 48 | +tar -xvf soccer-simulation-proxy.tar.gz |
| 49 | +``` |
| 50 | +#### 3. Run the Proxy |
| 51 | +After downloading, you can run the proxy: |
| 52 | +```bash |
| 53 | +cd SoccerSimulationProxy |
| 54 | +./start.sh |
| 55 | +``` |
| 56 | +If you want to connect the proxy to a grpc server change this parameter to `grpc` in start.sh file. |
| 57 | +```bash |
| 58 | +rpc_type="thrift" |
| 59 | +``` |
| 60 | +#### 4. Watch the Game |
| 61 | +To watch the game, you can use either of the following: |
| 62 | + |
| 63 | +- **[rcssmonitor](https://github.com/rcsoccersim/rcssmonitor)**: A tool to visualize the game. |
| 64 | +- **[SoccerWindow2](https://github.com/helios-base/soccerwindow2)**: Another visualization tool for RoboCup Soccer Simulation. |
| 65 | + |
| 66 | +For instructions on how to run **rcssmonitor**, check the [Soccer Simulation Monitor Wiki](https://github.com/CLSFramework/cross-language-soccer-framework/wiki/Soccer-Simulation-Monitor). |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +### 2 - Build from source, install, and run (Linux, WSL) |
| 73 | + |
| 74 | +To build the soccer simulation proxy, you need to install the following dependencies: |
| 75 | + |
| 76 | +#### 1. LibRCSC |
| 77 | + |
| 78 | +```bash |
| 79 | +git clone git@github.com:helios-base/librcsc.git |
| 80 | +cd librcsc |
| 81 | +git checkout 19175f339dcb5c3f61b56a8c1bff5345109f22ef |
| 82 | +mkdir build |
| 83 | +cd build |
| 84 | +cmake .. |
| 85 | +make |
| 86 | +make install |
| 87 | +``` |
| 88 | + |
| 89 | +#### 2. gRPC - follow the instructions provided in the [repository](https://grpc.io/docs/languages/cpp/quickstart/) |
| 90 | + |
| 91 | +```bash |
| 92 | +export MY_INSTALL_DIR=$HOME/.local |
| 93 | +mkdir -p $MY_INSTALL_DIR |
| 94 | +export PATH="$MY_INSTALL_DIR/bin:$PATH" |
| 95 | +sudo apt install -y build-essential autoconf libtool pkg-config |
| 96 | +git clone --recurse-submodules -b v1.62.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc |
| 97 | +cd grpc/ |
| 98 | +mkdir -p cmake/build |
| 99 | +pushd cmake/build |
| 100 | +cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR ../.. |
| 101 | +make -j 4 |
| 102 | +make install |
| 103 | +``` |
| 104 | + |
| 105 | +then, add the following lines at the end of $HOME/.bashrc |
| 106 | + |
| 107 | +```bash |
| 108 | +export MY_INSTALL_DIR=$HOME/.local |
| 109 | +export PATH="$MY_INSTALL_DIR/bin:$PATH" |
| 110 | +``` |
| 111 | + |
| 112 | +then, run the following command |
| 113 | + |
| 114 | +```bash |
| 115 | +source $HOME/.bashrc |
| 116 | +``` |
| 117 | + |
| 118 | +To test grpc, go to grpc directory (in this example it is in $HOME/grpc) and run the following commands: |
| 119 | + |
| 120 | +```bash |
| 121 | +cd examples/cpp/helloworld |
| 122 | +mkdir -p cmake/build |
| 123 | +cd cmake/build/ |
| 124 | +cmake -DCMAKE_PREFIX_PATH=$MY_INSTALL_DIR ../.. |
| 125 | +make |
| 126 | +run ./greeter_server in one tab |
| 127 | +run ./greeter_client in another tab |
| 128 | +``` |
| 129 | + |
| 130 | +#### 3. SoccerSimulationProxy |
| 131 | + |
| 132 | +```bash |
| 133 | +git clone git@github.com:CLSFramework/soccer-simulation-proxy.git |
| 134 | +cd soccer-simulation-proxy |
| 135 | +mkdir build |
| 136 | +cd build |
| 137 | +cmake .. |
| 138 | +make |
| 139 | +``` |
| 140 | + |
| 141 | + |
| 142 | +#### 4. Run Soccer Simulation Proxy |
| 143 | + |
| 144 | +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) |
| 145 | + |
| 146 | +```bash |
| 147 | +cd build/bin |
| 148 | +./start.sh |
| 149 | +``` |
| 150 | + |
| 151 | +To run the Soccer Simulation Proxy in debug mode, you can use the following command: |
| 152 | + |
| 153 | +```bash |
| 154 | +cd build/bin |
| 155 | +./start-debug.sh |
| 156 | +``` |
| 157 | + |
| 158 | +#### 5. Watch the Game |
| 159 | +To watch the game, you can use either of the following: |
| 160 | + |
| 161 | +- **[rcssmonitor](https://github.com/rcsoccersim/rcssmonitor)**: A tool to visualize the game. |
| 162 | +- **[SoccerWindow2](https://github.com/helios-base/soccerwindow2)**: Another visualization tool for RoboCup Soccer Simulation. |
| 163 | + |
| 164 | +For instructions on how to run **rcssmonitor**, check the [rcssmonitor](/docs/5-soccersimulation/1-monitor/index.md) or [soccer window 2](/docs/5-soccersimulation/2-soccerwindow/index.md). |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | +## References |
| 172 | + |
| 173 | +The paper about HELIOS Base: |
| 174 | +- Hidehisa Akiyama, Tomoharu Nakashima, HELIOS Base: An Open Source |
| 175 | +Package for the RoboCup Soccer 2D Simulation, In Sven Behnke, Manuela |
| 176 | +Veloso, Arnoud Visser, and Rong Xiong editors, RoboCup2013: Robot |
| 177 | +World XVII, Lecture Notes in Artificial Intelligence, Springer Verlag, |
| 178 | +Berlin, 2014. http://dx.doi.org/10.1007/978-3-662-44468-9_46 |
| 179 | + |
| 180 | +# Citation |
| 181 | + |
| 182 | +- [Cross Language Soccer Framework](https://arxiv.org/pdf/2406.05621) |
| 183 | +- 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. |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
0 commit comments