1- from typing import List
2-
31import numpy as np
42
53from rlbot import flat
119class GameState :
1210 blue_score : int = 0
1311 orange_score : int = 0
14- players : List [PlayerData ] = []
12+ players : list [PlayerData ] = []
1513 ball = PhysicsObject ()
1614 inverted_ball = PhysicsObject ()
1715
1816 _on_ground_ticks = np .zeros (64 , dtype = np .float32 )
19- _air_time = np .zeros (64 , dtype = np .float32 )
17+ _air_time_since_jump = np .zeros (64 , dtype = np .float32 )
18+ _has_jumped : list [bool ] = [False ] * 64
2019
2120 def __init__ (self , game_info : flat .FieldInfo ):
2221 # List of "booleans" (1 or 0)
@@ -57,19 +56,21 @@ def _decode_player(
5756
5857 if player_info .air_state == flat .AirState .OnGround :
5958 self ._on_ground_ticks [index ] = 0
60- self ._air_time [index ] = 0
59+ self ._air_time_since_jump [index ] = 0
60+ self ._has_jumped [index ] = False
6161 else :
6262 self ._on_ground_ticks [index ] += ticks_elapsed
6363
6464 if player_info .air_state == flat .AirState .Jumping :
65- self ._air_time [index ] = 0
65+ self ._air_time_since_jump [index ] = 0
66+ self ._has_jumped [index ] = True
6667 elif player_info .air_state in {
6768 flat .AirState .DoubleJumping ,
6869 flat .AirState .Dodging ,
6970 }:
70- self ._air_time [index ] = 150
71+ self ._air_time_since_jump [index ] = 150
7172 else :
72- self ._air_time [index ] += ticks_elapsed
73+ self ._air_time_since_jump [index ] += ticks_elapsed
7374
7475 player_data .car_id = index
7576 player_data .team_num = player_info .team
@@ -79,9 +80,9 @@ def _decode_player(
7980 or self ._on_ground_ticks [index ] <= 6
8081 )
8182 player_data .ball_touched = False
82- player_data .has_jump = player_info . air_state == flat . AirState . OnGround
83+ player_data .has_jump = not self . _has_jumped [ index ]
8384 # RLGym does consider the timer/unlimited flip, but i'm to lazy to track that in rlbot
84- player_data .has_flip = self ._air_time [index ] < 150
85+ player_data .has_flip = self ._air_time_since_jump [index ] < 150
8586 player_data .boost_amount = player_info .boost / 100
8687
8788 return player_data
0 commit comments