RLBot Python bindings for the Rust crate rl_ball_sym

Overview

RLBot Python bindings for rl_ball_sym 0.6

Prerequisites:

Steps to build the Python bindings

  1. Download this repository
  2. Run cargo_build_release.bat
  3. A new file, called rl_ball_sym.pyd, will appear
  4. Copy rl_ball_sym.pyd to your Python project's source folder
  5. import rl_ball_sym in your Python file

Basic usage in an RLBot script to render the path prediction

See script.cfg and script.py for a pre-made script that renders the framework's ball path prediction in green and the rl_ball_sym's ball path prediction in red.

from traceback import print_exc

from rlbot.agents.base_script import BaseScript
from rlbot.utils.structures.game_data_struct import GameTickPacket

import rl_ball_sym as rlbs


class rl_ball_sym(BaseScript):
    def __init__(self):
        super().__init__("rl_ball_sym")

    def main(self):
        rlbs.load_soccar()

        while 1:
            try:
                self.packet: GameTickPacket = self.wait_game_tick_packet()
                current_location = self.packet.game_ball.physics.location
                current_velocity = self.packet.game_ball.physics.velocity
                current_angular_velocity = self.packet.game_ball.physics.angular_velocity

                rlbs.set_ball({
                    "time": self.packet.game_info.seconds_elapsed,
                    "location": [current_location.x, current_location.y, current_location.z],
                    "velocity": [current_velocity.x, current_velocity.y, current_velocity.z],
                    "angular_velocity": [current_angular_velocity.x, current_angular_velocity.y, current_angular_velocity.z],
                })

                path_prediction = rlbs.get_ball_prediction_struct()

                self.renderer.begin_rendering()
                self.renderer.draw_polyline_3d(tuple((path_prediction["slices"][i]["location"][0], path_prediction["slices"][i]["location"][1], path_prediction["slices"][i]["location"][2]) for i in range(0, path_prediction["num_slices"], 4)), self.renderer.red())
                self.renderer.end_rendering()
            except Exception:
                print_exc()


if __name__ == "__main__":
    rl_ball_sym = rl_ball_sym()
    rl_ball_sym.main()

Example ball prediction struct

Normal

[
    {
        "time": 0.008333,
        "location": [
            -2283.9,
            1683.8,
            323.4,
        ],
        "velocity": [
            1273.4,
            -39.7,
            757.6,
        ]
    },
    {
        "time": 0.025,
        "location": [
            -2262.6,
            1683.1,
            335.9,
        ],
        "velocity": [
            1272.7,
            -39.7,
            746.4,
        ]
    }
    ...
]

Full

[
    {
        "time": 0.008333,
        "location": [
            -2283.9,
            1683.8,
            323.4,
        ],
        "velocity": [
            1273.4,
            -39.7,
            757.6,
        ]
        "angular_velocity": [
            2.3,
            -0.8,
            3.8,
        }
    },
    {
        "time": 0.016666,
        "location": [
            -2273.3,
            1683.4,
            329.7,
        ],
        "velocity": [
            1273.1,
            -39.7,
            752.0,
        ],
        "angular_velocity": [
            2.3,
            -0.8,
            3.8
        ]
    }
    ...
]

__doc__

Returns the string rl_ball_sym is a Rust implementation of ball path prediction for Rocket League; Inspired by Samuel (Chip) P. Mish's C++ utils called RLUtilities

load_soccar

Loads in the field for a standard soccar game.

load_dropshot

Loads in the field for a standard dropshot game.

load_hoops

Loads in the field for a standard hoops game.

set_ball

Sets information related to the ball. Accepts a Python dictionary. You don't have to set everything - you can exclude keys at will.

time

The seconds that the game has elapsed for.

location

The ball's location, in an array in the format [x, y, z].

velocity

The ball's velocity, in an array in the format [x, y, z].

angular_velocity

The ball's angular velocity, in an array in the format [x, y, z].

radius

The ball's radius.

Defaults:

  • Soccar - 91.25
  • Dropshot - 100.45
  • Hoops - 91.25

collision_radius

The ball's collision radius.

Defaults:

  • Soccar - 93.15
  • Dropshot - 103.6
  • Hoops - 93.15

set_gravity

Sets information about game's gravity.

Accepts an array in the format [x, y, z].

step_ball

Steps the ball by 1/120 seconds into the future every time it's called.

For convience, also returns the new information about the ball.

Example:

{
    "time": 0.008333,
    "location": [
        -2283.9,
        1683.8,
        323.4,
    ],
    "velocity": [
        1273.4,
        -39.7,
        757.6,
    ]
    "angular_velocity": [
        2.3,
        -0.8,
        3.8,
    }
}

get_ball_prediction_struct

Equivalent to calling step_ball() 720 times (6 seconds).

Returns a normal-type ball prediction struct.

get_ball_prediction_struct takes 0.3ms to execute

get_ball_prediction_struct_full

Equivalent to calling step_ball() 720 times (6 seconds).

Returns a full-type ball prediction struct.

get_ball_prediction_struct_full takes 0.54ms to execute

get_ball_prediction_struct_for_time

Equivalent to calling step_ball() 120 * time times.

Returns a normal-type ball prediction struct.

time

The seconds into the future that the ball path prediction should be generated.

get_ball_prediction_struct_full_for_time

Equivalent to calling step_ball() 120 * time times.

Returns a full-type ball prediction struct.

time

The seconds into the future that the ball path prediction should be generated.

You might also like...
Crab is a flexible, fast recommender engine for Python that integrates classic information filtering recommendation algorithms in the world of scientific Python packages (numpy, scipy, matplotlib).

Crab - A Recommendation Engine library for Python Crab is a flexible, fast recommender engine for Python that integrates classic information filtering r

Python scripts to detect faces in Python with the BlazeFace Tensorflow Lite models
Python scripts to detect faces in Python with the BlazeFace Tensorflow Lite models

Python scripts to detect faces using Python with the BlazeFace Tensorflow Lite models. Tested on Windows 10, Tensorflow 2.4.0 (Python 3.8).

A fast python implementation of Ray Tracing in One Weekend using python and Taichi
A fast python implementation of Ray Tracing in One Weekend using python and Taichi

ray-tracing-one-weekend-taichi A fast python implementation of Ray Tracing in One Weekend using python and Taichi. Taichi is a simple "Domain specific

Technical Indicators implemented in Python only using Numpy-Pandas as Magic  - Very Very Fast! Very tiny!  Stock Market Financial Technical Analysis Python library .  Quant Trading automation or cryptocoin exchange
Technical Indicators implemented in Python only using Numpy-Pandas as Magic - Very Very Fast! Very tiny! Stock Market Financial Technical Analysis Python library . Quant Trading automation or cryptocoin exchange

MyTT Technical Indicators implemented in Python only using Numpy-Pandas as Magic - Very Very Fast! to Stock Market Financial Technical Analysis Python

This is an open source python repository for various python tests

Welcome to Py-tests This is an open source python repository for various python tests. This is in response to the hacktoberfest2021 challenge. It is a

Composable transformations of Python+NumPy programsComposable transformations of Python+NumPy programs

Chex Chex is a library of utilities for helping to write reliable JAX code. This includes utils to help: Instrument your code (e.g. assertions) Debug

Automatic self-diagnosis program (python required)Automatic self-diagnosis program (python required)

auto-self-checker 자동으로 자가진단 해주는 프로그램(python 필요) 중요 이 프로그램이 실행될때에는 절대로 마우스포인터를 움직이거나 키보드를 건드리면 안된다(화면인식, 마우스포인터로 직접 클릭) 사용법 프로그램을 구동할 폴더 내의 cmd창에서 pip

POPPY (Physical Optics Propagation in Python) is a Python package that simulates physical optical propagation including diffraction
POPPY (Physical Optics Propagation in Python) is a Python package that simulates physical optical propagation including diffraction

POPPY: Physical Optics Propagation in Python POPPY (Physical Optics Propagation in Python) is a Python package that simulates physical optical propaga

Space-invaders - Simple Game created using Python & PyGame, as my Beginner Python Project
Space-invaders - Simple Game created using Python & PyGame, as my Beginner Python Project

Space Invaders This is a simple SPACE INVADER game create using PYGAME whihc hav

Releases(v1.0.0)
Owner
Eric Veilleux
I know HTML/CSS/JS, Java, Python, C, and Rust.
Eric Veilleux
FastFCN: Rethinking Dilated Convolution in the Backbone for Semantic Segmentation.

FastFCN: Rethinking Dilated Convolution in the Backbone for Semantic Segmentation [Project] [Paper] [arXiv] [Home] Official implementation of FastFCN:

Wu Huikai 815 Dec 29, 2022
Neuron Merging: Compensating for Pruned Neurons (NeurIPS 2020)

Neuron Merging: Compensating for Pruned Neurons Pytorch implementation of Neuron Merging: Compensating for Pruned Neurons, accepted at 34th Conference

Woojeong Kim 33 Dec 30, 2022
A copy of Ares that costs 30 fucking dollars.

Finalement, j'ai décidé d'abandonner cette idée, je me suis comporté comme un enfant qui été en colère. Comme m'ont dit certaines personnes j'ai des c

Bleu 24 Apr 14, 2022
Code and data for the paper "Hearing What You Cannot See"

Hearing What You Cannot See: Acoustic Vehicle Detection Around Corners Public repository of the paper "Hearing What You Cannot See: Acoustic Vehicle D

TU Delft Intelligent Vehicles 26 Jul 13, 2022
PyTorch Code for "Generalization in Dexterous Manipulation via Geometry-Aware Multi-Task Learning"

Generalization in Dexterous Manipulation via Geometry-Aware Multi-Task Learning [Project Page] [Paper] Wenlong Huang1, Igor Mordatch2, Pieter Abbeel1,

Wenlong Huang 40 Nov 22, 2022
Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices

Intro Real-time object detection and classification. Paper: version 1, version 2. Read more about YOLO (in darknet) and download weight files here. In

Trieu 6.1k Dec 30, 2022
A PyTorch Implementation of "Watch Your Step: Learning Node Embeddings via Graph Attention" (NeurIPS 2018).

Attention Walk ⠀⠀ A PyTorch Implementation of Watch Your Step: Learning Node Embeddings via Graph Attention (NIPS 2018). Abstract Graph embedding meth

Benedek Rozemberczki 303 Dec 09, 2022
Learnable Motion Coherence for Correspondence Pruning

Learnable Motion Coherence for Correspondence Pruning Yuan Liu, Lingjie Liu, Cheng Lin, Zhen Dong, Wenping Wang Project Page Any questions or discussi

liuyuan 41 Nov 30, 2022
AirCode: A Robust Object Encoding Method

AirCode This repo contains source codes for the arXiv preprint "AirCode: A Robust Object Encoding Method" Demo Object matching comparison when the obj

Chen Wang 30 Dec 09, 2022
Predicting Auction Sale Price using the kaggle bulldozer auction sales data: Modeling with Ensembles vs Neural Network

Predicting Auction Sale Price using the kaggle bulldozer auction sales data: Modeling with Ensembles vs Neural Network The performances of tree ensemb

Mustapha Unubi Momoh 2 Sep 13, 2022
Repositório criado para abrigar os notebooks com a listas de exercícios propostos pelo professor Gustavo Guanabara do canal Curso em Vídeo do YouTube durante o Curso de Python 3

Curso em Vídeo - Exercícios de Python 3 Sobre o repositório Este repositório contém os notebooks com a listas de exercícios propostos pelo professor G

João Pedro Pereira 9 Oct 15, 2022
The code for "Deep Level Set for Box-supervised Instance Segmentation in Aerial Images".

Deep Levelset for Box-supervised Instance Segmentation in Aerial Images Wentong Li, Yijie Chen, Wenyu Liu, Jianke Zhu* This code is based on MMdetecti

sunshine.lwt 112 Jan 05, 2023
This repository contains all code and data for the Inside Out Visual Place Recognition task

Inside Out Visual Place Recognition This repository contains code and instructions to reproduce the results for the Inside Out Visual Place Recognitio

15 May 21, 2022
Code for our CVPR 2021 Paper "Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes".

Rethinking Style Transfer: From Pixels to Parameterized Brushstrokes (CVPR 2021) Project page | Paper | Colab | Colab for Drawing App Rethinking Style

CompVis Heidelberg 153 Jan 04, 2023
This repository contains the PyTorch implementation of the paper STaCK: Sentence Ordering with Temporal Commonsense Knowledge appearing at EMNLP 2021.

STaCK: Sentence Ordering with Temporal Commonsense Knowledge This repository contains the pytorch implementation of the paper STaCK: Sentence Ordering

Deep Cognition and Language Research (DeCLaRe) Lab 23 Dec 16, 2022
Model-based reinforcement learning in TensorFlow

Bellman Website | Twitter | Documentation (latest) What does Bellman do? Bellman is a package for model-based reinforcement learning (MBRL) in Python,

46 Nov 09, 2022
Deep Q-network learning to play flappybird.

AI Plays Flappy Bird I've trained a DQN that learns to play flappy bird on it's own. Try the pre-trained model First install the pip requirements and

Anish Shrestha 3 Mar 01, 2022
FS-Mol: A Few-Shot Learning Dataset of Molecules

FS-Mol is A Few-Shot Learning Dataset of Molecules, containing molecular compounds with measurements of activity against a variety of protein targets. The dataset is presented with a model evaluation

Microsoft 114 Dec 15, 2022
Reinforcement learning models in ViZDoom environment

DoomNet DoomNet is a ViZDoom agent trained by reinforcement learning. The agent is a neural network that outputs a probability of actions given only p

Andrey Kolishchak 126 Dec 09, 2022
Time-Optimal Planning for Quadrotor Waypoint Flight

Time-Optimal Planning for Quadrotor Waypoint Flight This is an example implementation of the paper "Time-Optimal Planning for Quadrotor Waypoint Fligh

Robotics and Perception Group 38 Dec 02, 2022