Code Monkey home page Code Monkey logo

mrchriwo / vectorvelocity Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 47.22 MB

A space-themed OpenAI Gym environment designed for reinforcement learning. Users pilot a spaceship through an asteroid field while collecting coins. The environment increases in difficulty as the speed escalates, with asteroids and coins spawning randomly, providing dynamic challenges that are ideal for developing and refining Agents

Home Page: https://mrchriwo.github.io/VectorVelocity/

License: GNU General Public License v3.0

Python 100.00%
openai-gym openai-gym-environment pygame reinforcement-learning gym-environment python ai game-development rl

vectorvelocity's Introduction

VectorVelocity

VectorVelocity

Documentation Python Version PyPI version

Table of Contents

Introduction

VectorVelocity is a space-themed OpenAI Gym environment designed for reinforcement learning. Users pilot a spaceship through an asteroid field while collecting coins. The environment increases in difficulty as the speed escalates, with asteroids and coins spawning randomly, providing dynamic challenges that are ideal for developing and refining Agents

Enviornment Description

In VectorVelocity, the player controls a spaceship moving across three lanes. The objective is to collect as many coins as possible while avoiding collisions with asteroids that move from the top of the screen to the bottom. As the game progresses, the speed increases, making the game increasingly difficult.

Third Party Assets

This game was enriched significantly by incorporating various third-party assets. We are immensely grateful to the creators of these assets for making their work available and enhancing the gaming experience.

  1. Game Background: The thematic space background, enhancing the visual appeal of our game, was sourced from Vecteezy.
  2. Space Ship: The spaceship, which players navigate through asteroids, was created by FoozleCC as part of the Void Pack. Explore more of FoozleCC's creations here.
  3. Background Music: The atmospheric tunes from Goose Ninjas' Space Music Pack set the perfect mood for our adventures through space. Check out more of Goose Ninjas' music on their Itch.io page.

We extend a huge thanks to the mentioned authors for making their work freely available.

Getting Started

To install the Vector Velocity Environment, you can use pip. Simply run the following command in your terminal:

pip install vector-velocity-gym

After installing the environment, you may want to test the installation and explore how to build or use the environment effectively.

For comprehensive guides and examples, please visit our offical documentation

RL Agent

Problem Domain

The challenge for the RL agent in VectorVelocity is to learn optimal strategies for maximizing the score by skillfully collecting coins while avoiding asteroids. The agent is required to make decisions in real-time, adjusting to the game's increasing speed and the randomness of asteroid placements. Additionally, some coins spawn between asteroids in positions that may not always be reachable, adding a layer of decision-making complexity. This requires the player, and consequently the RL agent, to assess whether pursuing a coin is worth the risk of potential collision. This problem domain provides a rich and challenging environment for exploring and refining reinforcement learning techniques.

Agents

We have decided to use the Proximal Policy Optimization (PPO) algorithm to train an agent within our environment. PPO, a reinforcement learning algorithm developed by OpenAI, is known for its robustness and efficiency in learning policies for various types of environments.

Sample Agent Development

For those interested in seeing a practical implementation or experimenting with the agent development process, sample agent development can be found in the lab branch of this repository. This branch includes experimental features and developmental progress on new agent strategies.

To access and contribute to the ongoing agent development, switch to the lab branch:

Contributing

We welcome everyone to contribute to the project. Share your ideas, engage in discussions, and help us improve VectorVelocity. To get started, please check out the CONTRIBUTING.md file in the repo for detailed guidelines.

vectorvelocity's People

Contributors

mrchriwo avatar stevenschneider avatar

Watchers

Kostas Georgiou avatar  avatar  avatar

vectorvelocity's Issues

pygame.error: video system not initialized

While running the game in human mode, the game functions well overall. However, a non-critical error is occasionally encountered during shutdown: pygame.error: video system not initialized. This issue does not affect general gameplay but should be investigated when time permits to ensure a smoother exit process and enhance overall system stability in human mode.

Getting an error when using the gymnasium env checker

Describe the bug
It is not possible to use the gymnasium env_checker on the environment.

To Reproduce
Steps to reproduce the behavior:

`from gymnasium.utils.env_checker import check_env
from stable_baselines3.common.env_checker import check_env

env modifications if needed

GAMEOVER_PENALTY = 75
MISSED_COIN_PENALTY = 3

DODGED_OBSTACLE_REWARD = 1
COLLECTED_COIN_REWARD = 12

def create_env():
env = VectorVelocityEnv()
env.coin_missed_penalty = MISSED_COIN_PENALTY
env.game_over_penalty = GAMEOVER_PENALTY
env.dodged_obstacle_reward = DODGED_OBSTACLE_REWARD
env.coin_reward = COLLECTED_COIN_REWARD
return env

env = create_env()
check_env(env)`

Expected behavior
The code should run properly.

Desktop (please complete the following information):

  • OS: Windows 11
  • Python Version: 3.10.11
  • VectorVelocity Version: 0.1.0

Agent Training

Setup Notebook for actual training:

  • Define training
  • training logs & corresponding graphs
  • export trained agent
  • test agent (inside notebook or via test script)

Set up Docker Env

setting up enviornment for the project. using .devcontainer & dockerfile

Refactor Unittest

unittest can not be used for the refactored gym env and needs to be adjusted

Player Class

Player Class

Attributes:

  • Movement (Left, right)
  • x, y (Player Size)
  • LP
  • Image (maybe for later)

Obstacle Class

  • X, Y (Size)
  • position
  • Collision
  • Draw function
  • movement (speed)
  • is instant dead (optional)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.