Skip to main content

rewards_envs

rewards-envs is the official repository for environment store, custom environment developement and integration. When it comes to reinforcement learning, we face a hard time creating custom environment and wraping under gymnasium's format. Hence introducing rewards_envs. With just few lines of code, Now you can create or convert your games (pygame) to cutsom environment for your agents.

Installation and getting started.

To install rewards-envs you just have to write the command

pip install rewards_envs 

This installs our latest version. Current version of rewards_envs provides a single default custom environment, called car_race. More custom environment and integration with gymnasium environments will be supported in the coming versions.

In order to build our custom environment, you have to simply write these few lines of code.

from rewards_envs import CarConfig, CarGame

# First create the configurations to create the environment 
# configurations helps to maintain multiple experiments 

env_config = CarConfig(
    render_mode = "rgb_array", 
    car_fps=30, screen_size = (1000, 700)
)

# create the game 
env = CarGame(
    mode = "evaluation", 
    track_num = 1, 
    reward_function = reward_function, 
    config = env_config
)

If you see when you are initializing the environment, there is a parameter called reward_function : Callable. This is a function that you have to define based on the given car's properties. Below is a sample reward function that works best for this environment.

def reward_function(props) -> int:
    reward = 0
    if props["is_alive"]:
        reward = 1
    obs = props["observation"]
    if obs[0] < obs[-1] and props["direction"] == -1:
        reward += 1
        if props["rotational_velocity"] == 7 or props["rotational_velocity"] == 10:
            reward += 1
    elif obs[0] > obs[-1] and props["direction"] == 1:
        reward += 1
        if props["rotational_velocity"] == 7 or props["rotational_velocity"] == 10:
            reward += 1
    else:
        reward += 0
        if props["rotational_velocity"] == 15:
            reward += 1
    return reward

The agent (here the car) has some following properties named under the dictionary props. Here the name and the explaination of all the properties.

  • is_alive : This states, whether the car is alive or not

  • observation : Observation is a array of 5 float values, which are the radars of the car.

  • direction : Direction provides the current action taken by the car.

  • rotational_velocity : The rotational velocity of the car.

The properties of the car are determined during the process of creation of the game. If you want to create a custom environment, then you can define your agent's properties there. The propeties must be those, which determines whether or how much an agent is gonna win/loose the game.

Roadmap

We want to make rewards as a general repository for RL research and RL education. Most of the RL research are heavily dependent on the environment. After environment creation, practicioners either face lot of issues wraping that environment around gymnasium 's custom environment wrapper or create everything of their own. We at rewards want to solve this issue. Through rewards-sdk and rewards_envs user must be able to create custom environment made using Pygame, Unity or any other engine and integrate it and start/organize RL research in no time.

Contributing

Both rewards and rewards_envs are undergoing through some heavy developement. Being a open source projects we are open for contributions. Write now due to lack of docs, we are unable to come down with some guidelines. We will be doing that very soon. Till then please star this project and play with our sdk. If you find some bugs or need a new feature, then please create a new issue under the issues tab.

Metadata

Release files for rewards-envs 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rewards-envs 0.1.3
File Size Uploaded Provenance Actions
rewards_envs-0.1.3.tar.gz 324.2 kB Without provenance Details for rewards_envs-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rewards-envs 0.1.3
File Interpreter ABI Platform Actions
rewards_envs-0.1.3-py3-none-any.whl Python 3 none any Details for rewards_envs-0.1.3-py3-none-any.whl

Total release size: 645.4 kB

Release files / rewards_envs-0.1.3.tar.gz

Download URL rewards_envs-0.1.3.tar.gz
Size 324.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f8ce32c3bea6493532eb5f4c050f52e3c25fa16de5d592f30981a484b9cffe79
BLAKE2b-256 checksum
How to use checksums
97bb8f962117d80d6c60035e4528eef56c523175613d0d8bb051f2334ed447e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.10.9 Linux/6.2.6-76060206-generic

Release files / rewards_envs-0.1.3-py3-none-any.whl

Download URL rewards_envs-0.1.3-py3-none-any.whl
Size 321.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2928795aeb08e519cc92a3488f83dcd8452a0fa935fa5f8572889507236e6cd
BLAKE2b-256 checksum
How to use checksums
bc677a8ba0f1066c6b2ce6f9638fb2f0ba71fb7db27b5f44da8903d6793e24ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.10.9 Linux/6.2.6-76060206-generic

Security for rewards-envs 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page