-
Notifications
You must be signed in to change notification settings - Fork 4
Agent
Default: False
Use: If you're putting your bot in the botpack, or submitting to a tournament, set this value to True
Note: You MUST set this value by hand before you launch you bot.
Default: True
Use: Make False
to enable hot reloading, at the cost of the debugging GUI
Note: You MUST set this value by hand before you launch you bot.
This is your bot's "true name" - Basically, if you're bot's name is "ABot" but there's more than one of your bot in the game, this value will always be just "ABot"
Note: This value isn't meant to be modified by your bot.
The current gravitational acceleration represented by a Vector
, based on the current mutator settings.
Note: This value isn't meant to be modified by your bot.
The current boost acceleration represented by a number, based on the current mutator settings.
Note: This value isn't meant to be modified by your bot.
One of 5 strings: "default", "unlimited", "slow recharge", "fast recharge", or "no boost" - based on the current mutator settings.
Note: This value isn't meant to be modified by your bot.
One of 6 strings: "Soccer", "Hoops", "Dropshot", "Hockey", "Rumble", or "Heatseeker" - based on the current mutator settings.
Note: This value isn't meant to be modified by your bot.
The radius of the ball - based on the current mutator settings.
Note: This value isn't meant to be modified by your bot.
A list of the bot's teammates. Each bot is represented by a car_object
.
Note: This value isn't meant to be modified by your bot.
A list of the bot's foes. Each bot is represented by a car_object
.
Note: This value isn't meant to be modified by your bot.
This is the bot represented by a car_object
.
Note: This value isn't meant to be modified by your bot.
The distance from the ball to the bot's goal.
Note: This value isn't meant to be modified by your bot.
This is the ball, as represented by a ball_object
.
Note: This value isn't meant to be modified by your bot.
This is miscellaneous game information, as represented by a game_object
.
Note: This value isn't meant to be modified by your bot.
A list of the field's boost pads. Each boost pad is represented by a boost_object
.
Note: This value isn't meant to be modified by your bot.
Your bot's goal, as represented by a goal_object
.
Note: This value isn't meant to be modified by your bot.
The enemy team's goal, as represented by a goal_object
.
Note: This value isn't meant to be modified by your bot.
This is a list of routines that the bot is to run. The last routine in this list is ran (it's a "first in, last out" system).
Note: Use push(self, routine)
and pop(self)
to modify this value.
The amount of time the game has been running for.
Note: This value isn't meant to be modified by your bot. It's a shortcut for game.time
.
This is the controls that are to be returned from the bot. Everything is defaulted to either 0
or False
every tick.
Whether or not the kickoff routine is done. If this is False
and the stack is clear (use is_clear(self)
), then you should push a kickoff routine to the stack using push(self, routine)
.
Example:
if self.kickoff_done:
pass # Run the main code here
elif not self.is_clear():
self.push(routines.generic_kickoff()) # Push a kickoff routine to the stack
# Don't change anything
Note: This value isn't meant to be modified by your bot.
Whether or not the bot is shooting the ball.
Note: This value isn't meant to be modified by your bot.
This can be 0
, 1
, 2
, or 3
. Use this for things that don't have to be called every tick.
Example:
# This is ran at 30 tps
if self.odd_tick == 0:
pass
# This is ran at 60 tps
if self.odd_tick % 2 == 0:
pass
Note: This value isn't meant to be modified by your bot.
The time that's passed between the last tick and the current tick.
Note: This value isn't meant to be modified by your bot.
Earliest that the enemy can be at the ball. Default 180.
Note: This value won't change unless your bot changes it.
Earliest that the bot itself can be at the ball. Default 180.
Note: This value won't change unless your bot changes it.
This is the ball prediction struct. There's 60 slices per second, and the struct goes 6 seconds into the future.
Note: This value isn't meant to be modified by your bot.
Pushes (adds) a routine to the end of the stack, where it will be executed.
-
routine
- A routine fromutil/routines.py
Pops (removes) the last routine in stack
.
Draws a line from start
to end
, with a color as defined by color
.
-
start
- AVector
that represents the starting point of the line. -
end
- AVector
that represents the ending point of the line. -
color
- A list, tuple, or pre-made color (see this wiki page) - if you don't define a color, it will default to grey.
Draws a line with multiple points as defined by vectors
, with a color as defined by color
-
vectors
- A list or tuple ofVector
s that represents each of the points in the line. -
color
- A list, tuple, or pre-made color (see this wiki page) - if you don't define a color, it will default to grey.
Draws 7 lines that vaguely resemble a sphere at location
with a length of radius
.
-
location
- AVector
that represents the location of the middle of the sphere. -
radius
- A number.
Prints item
to the console, along with the name of the bot and which team the bot is on.
-
item
- Any value that can be converted to a string.
Shows item
in-game, at the bot's location.
-
item
- Any value that can be converted to a string.
Shows item
in-game, on the user's screen.
-
item
- Any value that can be converted to a string.
Clears the stack.
Returns if the stack is empty or not.
This is a method that your bot must implement if it wants the built-in VirxERLU TMCP handler to not send out -1
with the TMCP action READY
.
Example:
def get_minimum_game_time_to_ball(self):
shot = tools.find_any_shot(self)
return -1 if shot is None else shot.intercept_time
Gets called any time there's a new TMCP packet.
By default, it set's the corresponding bot's tmcp_action
property to the action
key in the packet.
You may extend this if you wish to customize it.
Example:
def handle_tmcp_packet(self, packet):
super().handle_tmcp_packet(packet)
# do stuff with packet
if packet.get('action').upper() == "BOOST":
self.print(f"{packet['index']} is going to try and demo {packet['action']['target']}!")
Converts the current state of the bot into a TMCP packet.
You may override this if you wish to customize it.
The bot's in-game name.
Note: This value isn't meant to be modified by your bot.
The bot's "true name" - Basically, if the bot's name is "ABot" but there's more than one of the bot in the game, this value will always be just "ABot"
Note: This value isn't meant to be modified by your bot.
The team that the bot is on - either 0 or 1.
Note: This value isn't meant to be modified by your bot.
The car's location, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
The car's orientation, represented by a Matrix3
.
Note: This value isn't meant to be modified by your bot.
The car's velocity, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
The car's angular velocity, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
Whether or not the car is demolished.
Note: This value isn't meant to be modified by your bot.
Whether or not the car is airborne.
Note: This value isn't meant to be modified by your bot.
Whether or not the car is supersonic.
Note: This value isn't meant to be modified by your bot.
Whether or not the car has jumped.
Note: This value isn't meant to be modified by your bot.
Whether or not car has double jumped.
Note: This value isn't meant to be modified by your bot.
The amount of boost the car has, from 0 to 100.
Note: This value isn't meant to be modified by your bot.
The index of the car.
Note: This value isn't meant to be modified by your bot.
The time that the car landed on the ground.
Note: This value isn't meant to be modified by your bot.
The hitbox of the car, represented by a hitbox_object
.
Note: This value isn't meant to be modified by your bot.
A normalized Vector
pointing forwards relative to the cars orientation and location.
Note: This value isn't meant to be modified by your bot. This is also an alias of orientation.forward
.
A normalized Vector
pointing right relative to the cars orientation and location.
Note: This value isn't meant to be modified by your bot. This is also an alias of orientation.right
.
A normalized Vector
pointing up relative to the cars orientation and location.
Note: This value isn't meant to be modified by your bot. This is also an alias of orientation.up
.
A tuple
of the car's orientation in the format (forward, right, up)
.
Note: This value isn't meant to be modified by your bot. This is also an alias of orientation.rotation
.
A number representing the pitch of the car. Goes from -PI
to PI
.
Note: This value isn't meant to be modified by your bot. This is also an alias of orientation.pitch
.
A number representing the yaw of the car. Goes from -PI
to PI
. This is also an alias of orientation.yaw
.
Note: This value isn't meant to be modified by your bot.
A number representing the roll of the car. Goes from -PI
to PI
. This is also an alias of orientation.roll
.
Note: This value isn't meant to be modified by your bot.
Localizes a value according to the car's orientation. Returns a Vector
. Don't use this unless you know what you're doing - you should look into local_velocity(self, velocity=None)
and local_location(self, location)
.
-
value
- A value rooted in the center of the field to be localized.
Note: The opposite of this function is global_
Globalizes a local value according to the car's orientation. Returns a Vector
. Don't use this unless you know what you're doing - you should look into global_location(self, location)
.
-
value
- A value rooted in the car's orientation to be globalized.
Note: The opposite of this function is local
Localizes a velocity according to the car's orientation. Returns a Vector
.
-
x is the velocity forwards (+) or backwards (-) relative to the car.
-
y is the velocity to the right (+) or left (-) relative to the car.
-
z if the velocity upwards (+) or downwards (-) relative to the car.
-
velocity
- A velocityVector
. If a value isn't passed, it will default to the car's own velocity.
Localizes a location according to the car's orientation. Returns a Vector
.
-
x is how far the location is forwards (+) or backwards (-) relative to the car.
-
y is the velocity to the right (+) or left (-) relative to the car.
-
z is how far the location is upwards (+) or downwards (-) relative to the car.
-
location
- A locationVector
.
Note: The opposite of this function is global_location
Globalizes a local location according to the car's orientation. Returns a Vector
.
-
location
- A local locationVector
.
Note: The opposite of this function is local_location
Locally flattens a global value according to the car's orientation.
-
value
- A value rooted in the center of the field to be locally flattened.
Locally flattens a global location according to the car's orientation.
-
location
- A location rooted in the center of the field to be locally flattened.
Returns all of the data in car_object
but with only lists, tuples, ints, and floats
-
agent
- An instance of VirxERLU. If you're running this from an instance of VirxERLU, pass inself
. -
force_on_ground
- Forces airborne to be 0 in the data. DefaultFalse
.
The length of the hitbox.
Note: This value isn't meant to be modified by your bot.
The width of the hitbox.
Note: This value isn't meant to be modified by your bot.
The height of the hitbox.
Note: This value isn't meant to be modified by your bot.
The hitbox offset.
Note: This value isn't meant to be modified by your bot.
The diameter of the hitbox.
Note: This value isn't meant to be modified by your bot.
The height of the hitbox.
Note: This value isn't meant to be modified by your bot.
The diameter of the hitbox.
Note: This value isn't meant to be modified by your bot.
The location of the last touch, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
Which direction the ball was hit from, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
The time that the ball was last touched
Note: This value isn't meant to be modified by your bot.
The bot that last touched the ball, represented by a car_object
.
Note: This value isn't meant to be modified by your bot.
A number that's 0
for a cube/cuboid, 1
for a sphere, and 2
for a cylinder.
Cubes/cuboids are represented by a hitbox_object
.
Spheres are represented by a hitbox_sphere
.
Cylinder are represented by a hitbox_cylinder
.
The location of the ball, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
The velocity of the ball, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
Information about the last ball touch, represented by a last_touch
Information about the ball's hitbox, represented by a ball_shape
Returns all of the data in ball_object
but with only lists, tuples, ints, and floats
-
agent
- An instance of VirxERLU. If you're running this from an instance of VirxERLU, pass inself
.
The index of the boost pad.
Note: This value isn't meant to be modified by your bot.
The location of the boost pad, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
Whether or not the boost pad is active, and a bot can pick it up.
Note: This value isn't meant to be modified by your bot.
Whether or not the boost pad is large.
Note: This value isn't meant to be modified by your bot.
The center of the goal, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
The center of the left post, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
The center of the right post, represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
The current gravitational acceleration represented by a Vector
.
Note: This value isn't meant to be modified by your bot.
The seconds elapsed since the game started.
Note: This value isn't meant to be modified by your bot.
The second remaining in the game.
Note: This value isn't meant to be modified by your bot.
Whether or not the game is in overtime.
Note: This value isn't meant to be modified by your bot.
Whether or not the game is active.
Note: This value isn't meant to be modified by your bot.
Whether or not the game is in its 3-second kickoff pause.
Note: This value isn't meant to be modified by your bot.
Whether or not the match has ended.
Note: This value isn't meant to be modified by your bot.
The bot's team score.
Note: This value isn't meant to be modified by your bot.
The bot's enemy score.
Note: This value isn't meant to be modified by your bot.
The Matrix3's sole purpose is to convert roll, pitch, and yaw data from the gametickpacket into an orientation matrix.
A number representing the pitch of the car. Goes from -PI
to PI
.
Note: This value isn't meant to be modified by your bot.
A number representing the yaw of the car. Goes from -PI
to PI
.
Note: This value isn't meant to be modified by your bot.
A number representing the roll of the car. Goes from -PI
to PI
.
Note: This value isn't meant to be modified by your bot.
A list of the [forward, right, up]
determined by the input data.
Note: This value isn't meant to be modified by your bot.
Equivalent to data[0]
.
Note: This value isn't meant to be modified by your bot.
Equivalent to data[1]
.
Note: This value isn't meant to be modified by your bot.
Equivalent to data[2]
.
Note: This value isn't meant to be modified by your bot.
Creates a Matrix3 object from another object that defines the properties roll, pitch and yaw.
Example:
my_matrix = Matrix3.from_rotator(packet.game_cars[self.index].physics.rotation)
Creates a Matrix3 object from some forward direction and some up direction.
Example:
my_matrix = Matrix3.from_rotator(Vector(1, 0, 0), Vector(0, 0, 1))
Localizes a vector rooted in the center of the field, and returns a Vector
.
-
vector
- AVector
rooted in the center of the field.
Returns the detriment of the matrix.
Vector supports 1D, 2D and 3D Vectors, as well as calculations between them. Arithmetic with 1D and 2D lists/tuples aren't supported - just set the remaining values to 0 manually. With this new setup, Vector is much faster because it's just a wrapper for numpy.
The X coordinate. Defaults to 0.
The Y coordinate. Defaults to 0.
The Z coordinate. Defaults to 0.
Creates a Vector object from another object that defines the properties x, y and z.
Example:
my_vector = Vector.from_vector(packet.game_cars[self.index].physics.location)
Returns the distance from the vector to (0, 0, 0)
, aka the vector's Euclidean length.
Returns a Vector
that shares the same direction but has a length of 1.
-
return_magnitude
- IfTrue
, the method will return the normalized vector and the original vector's length. Used for optimization.
Returns the dot product of the 2 vectors.
-
value
- AVector
.
Returns the cross product of the 2 vectors.
-
value
- AVector
.
Returns a Vector
that has had it's z coordinate set to 0.
Returns a copy of the vector.
Returns the angle (in radians) between the 2 vectors after they've been flattened.
-
value
- AVector
.
Returns the angle (in radians) between the 2 vectors.
-
value
- AVector
.
Returns the vector, but rotated by angle
radians.
-
angle
- Number of radians to rotate the vector by.
Returns the Vector's direction between a start
and end
Vector such that start
< Vector < end
in terms of clockwise rotation. This is only for the x and y coordinates, not the z.
Returns the Vector's direction between a start
and end
Vector such that start
< Vector < end
in terms of clockwise rotation.
Returns the distance between the 2 vectors.
-
value
- AVector
.
Returns the distance between the 2 vectors, after they've been flattened.
-
value
- AVector
.
Returns the vector, but all the values in the Vector have been capped between low
and high
.
-
low
- A number. -
high
- A number.
Returns the midpoint of the 2 vectors.
-
value
- AVector
.
Scales self
to a magnitude of value
.
-
value
- A number.