Skip to main content

Soccer Simulation Proxy

RoboCup is an international competition aimed at advancing autonomous robotics and AI through tasks like soccer and rescue. The RoboCup Soccer Simulation 2D league focuses on developing intelligent agents that play soccer in a simulated 2D environment. This league is ideal for testing and developing AI and ML algorithms, including reinforcement learning and multi-agent systems. more details

image

To run a game in the RoboCup Soccer Simulation 2D, you need to operate the rcssserver for hosting games, rcssmonitor to display them, and engage 12 agents (11 players and a coach) per team. Each cycle, agents receive data from the server and must execute actions such as dash and kick. Developing a team can be complex due to the environment's intricacy, typically necessitating C++ programming. However, our framework allows for other languages development, leveraging the helios-base features. By using SoccerSimulationProxy, you can develop a team in any language supported by gRPC, such as C#, C++, Dart, Go, Java, Kotlin, Node, Objective-C, PHP, Python, and Ruby. You just need to develop a gRPC server based on proto messages and gRPC services (protofile, check wiki to be more familier with messages and services) to receive data from the SoccerSimulationProxy and send actions back to it. This way, you can focus on developing your team's strategy and AI algorithms without worrying about the server's complexity. If you would like to develop a team or research in this area by using Python, C# or JavaScript you can check the following links:

image

To find more information about the framework, you can visit the CLSFramework Wiki Pages

Screenshot 2024-04-07 012226

This new base code is powered by Helios-Base code and gRPC to help researcher developing a soccer simulation 2D team or researching in this area by using any languages supported by gRPC:

How To Use it?

To use this framework, you need to run rcssserver to host a game, run SoccerSimulationProxy (Agents) to connect to the rcssserver to receive information and send actions, and run Playmaker-Server (gRPC-Server) to receive information from agents and send appropriate actions back. To watch the game, you can run rcssmonitor or SoccerWindow2.

To run the rcssserver and rcssmonitor, you can follow the instructions in the rcssserver and rcssmonitor.

To run the SoccerSimulationProxy, there are some different ways such as using Docker, building from source, or using AppImage.

Use AppImage (Linux, WSL)

Download

You can download the AppImage of the Soccer Simulation Proxy from the release page.

Or download the latest version by using the following command:

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")

Extract

tar -xvf soccer-simulation-proxy.tar.gz

Run

cd SoccerSimulationProxy
./start.sh

You can download the AppImage of the Soccer Simulation Proxy from the #### and run it.

Build from source, install, and run (Linux, WSL)

To build the soccer simulation proxy, you need to install the following dependencies:

LibRCSC

git clone git@github.com:helios-base/librcsc.git
cd librcsc
git checkout 19175f339dcb5c3f61b56a8c1bff5345109f22ef
mkdir build
cd build
cmake ..
make
make install

gRPC - follow the instructions provided in the repository

export MY_INSTALL_DIR=$HOME/.local
mkdir -p $MY_INSTALL_DIR
export PATH="$MY_INSTALL_DIR/bin:$PATH"
sudo apt install -y build-essential autoconf libtool pkg-config
git clone --recurse-submodules -b v1.62.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc
cd grpc/
mkdir -p cmake/build
pushd cmake/build
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR ../..
make -j 4
make install

then, add the following lines at the end of $HOME/.bashrc

export MY_INSTALL_DIR=$HOME/.local
export PATH="$MY_INSTALL_DIR/bin:$PATH"

then, run the following command

source $HOME/.bashrc

To test grpc, go to grpc directory (in this example it is in $HOME/grpc) and run the following commands:

cd examples/cpp/helloworld
mkdir -p cmake/build
cd cmake/build/
cmake -DCMAKE_PREFIX_PATH=$MY_INSTALL_DIR ../..
make
run ./greeter_server in one tab
run ./greeter_client in another tab

SoccerSimulationProxy

git clone git@github.com:CLSFramework/soccer-simulation-proxy.git
cd soccer-simulation-proxy
mkdir build
cd build
cmake ..
make

Troubleshooting

If you saw an error about the different version of GRpc You should delete src/grpc/service.pb.cc and src/grpc/service.pb.h Then, generate them again by going to the base root directory and

cd grpc/proto
protoc --proto_path=. --cpp_out=../../src/grpc/ --grpc_out=../../src/grpc/ --plugin=protoc-gen-grpc=$HOME/.local/bin/grpc_cpp_plugin service.proto

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)

cd build/bin
./start.sh

To run the Soccer Simulation Proxy in debug mode, you can use the following command:

cd build/bin
./start-debug.sh

To run the Soccer Simulation Proxy with different configuration, you can pass the following parameters to start.sh or start-debug.sh:

OptionDescriptionDefault Value
-h, --host HOSTSpecifies server hostlocalhost
-p, --port PORTSpecifies server port6000
-P, --coach-port PORTSpecifies server port for online coach6002
-t, --teamname TEAMNAMESpecifies team name-
-n, --number NUMBERSpecifies the number of players-
-u, --unum UNUMSpecifies the uniform number of players-
-C, --without-coachSpecifies not to run the coach-
-f, --formation DIRSpecifies the formation directory-
--team-graphic FILESpecifies the team graphic xpm file-
--offline-loggingWrites offline client logoff
--offline-client-modeStarts as an offline clientoff
--debugWrites debug logoff
--debug_DEBUG_CATEGORYWrites DEBUG_CATEGORY to debug log-
--debug-start-time TIMEThe start time for recording debug log-1
--debug-end-time TIMEThe end time for recording debug log99999999
--debug-server-connectConnects to the debug serveroff
--debug-server-host HOSTSpecifies debug server hostlocalhost
--debug-server-port PORTSpecifies debug server port6032
--debug-server-loggingWrites debug server logoff
--log-dir DIRECTORYSpecifies debug log directory/tmp
--debug-log-ext EXTENSIONSpecifies debug log file extension.log
--fullstate FULLSTATE_TYPESpecifies fullstate model handling-
--g-ip GRPC IPSpecifies grpc IPlocalhost
--g-port GRPC PORTSpecifies grpc port50051
--diff-g-portSpecifies different grpc port for each playerfalse
--gp20Add 20 to GRPC Port if team run on right sidefalse

Use Docker (Linux, WSL, Windows)