This library is a C++ powered Python package for simulating playing areas according to the Eurobot rules. The aim is to provide simulated environment for testing your robots or training your agents.
This package also comes as a C++ library if you need to speed up your simulation even more.
warning This project is currently on development. A lot of features might be removed or changed without notice.
This library is not yet available on Pypi, but you can install it from source via Github.
pip3 install git+https://github.com/StarQTius/Arena
Fetch the project from Github (e.g. via FetchContent) with the method of your choice and link your project against the target(s) you need.
The basic element for using this library can be found in the arena
module (Arena
if you are using CMake).
Specific components for the different editions of the Eurobot contest can be found in their respective submodules (e.g. arena.the_cherry_on_the_cake
). Their corresponding CMake targets have similar names writtent in camel case (e.g. TheCherryOnTheCake
).
Arena is based on the ECS pattern which is implemented by frameworks and libraries like Unity and EnTT (in fact, Arena uses EnTT for its ECS implementation). Therefore, entities in your environment can be added new features by attaching components to them.
from arena import Environment, Bot, Host, Body, wait_next
import numpy as np
async def logic(body: Body):
a = 0
while True:
body.forward_velocity = 1000
body.angular_velocity = 5 * np.cos(a)
a += 5e-2
await wait_next()
env = Environment()
entity = env.create(Bot(x=-1000, y=0, mass=1))
env.attach(entity, Host(logic))
for _ in range(200):
env.step(1e-2)
Logics can be added to your entities as coroutines thanks to the Host
component. Arena will automatically fetch the requested components according to the parameter annotations of the async function.
You can advance the state of the environment by a given timestep with the Environment.step
method.