Skip to content

Routines

Virx edited this page Aug 31, 2020 · 9 revisions

util/routines.py

Aerial(self, ball_intercept, intercept_time)

Double jumps then boosts up into the air on a flight path towards ball_intercept at intercept_time.

Can hit the ball above 300uus.

Uses a lot of boost. Depending on the situation, it can hit the ball very hard. Fairly accurate, but it might hit the ball a little higher than expected.

  • ball_intercept - A Vector.
  • intercept_time - A number.

update(self, shot)

This updates the current shot with new target location information.

shot - An instance of Aerial

double_jump(self, ball_location, intercept_time, shot_vector, best_shot_value)

Uses both the initial jump and the dodge to gain height, then hits the ball.

Can hit the ball when it's between 250uus and 551uus.

Uses a modest amount of boost, but boost isn't required. When available, it will use it to get to the ball faster and hit it harder. Can't hit the ball very hard. Isn't very accurate.

  • ball_location - A Vector.
  • intercept_time - A number.
  • shot_vector - A Vector. This describes the direction that the bot should hit the ball in in order for it to go towards the target.
  • best_shot_value - A number. The offset from the center of the ball that the bot can still hit the ball from. See best_shot_value under VirxERLU in util/agent.py.

update(self, shot)

This updates the current shot with new target location information.

shot - An instance of double_jump

jump_shot(self, ball_location, intercept_time, shot_vector, best_shot_value)

Uses the initial jump to gain height (if needed) then uses it's dodge to hit the ball with power in a certain direction.

Can hit the ball from the ground up to 300uus, and can hit the ball while driving backwards.

Uses a modest amount of boost, but boost isn't required. When available, it will use it to get to the ball faster. Will hit the ball very hard, if given the opportunity. Extremely accurate, when given enough time.

  • ball_location - A Vector.
  • intercept_time - A number.
  • shot_vector - A Vector. This describes the direction that the bot should hit the ball in in order for it to go towards the target.
  • best_shot_value - A number. The offset from the center of the ball that the bot can still hit the ball from. See best_shot_value under VirxERLU in util/agent.py.

update(self, shot)

This updates the current shot with new target location information.

shot - An instance of jump_shot

short_shot(self, target)

Uses flips, boost and throttle to driving at the ball and hit it. Estimates a intercept location on it's own, and it will climb walls to reach the ball.

It can only hit the ball when it's very close to the ground.

Uses a modest amount of boost, but boost isn't required. When available, it will use it to get to the ball faster. Will hit the ball semi-hard if it's lucky. If it's on the right side of the ball, it's kind of accurate.

  • target - A Vector that this routine will try to put the ball between.

atba(self, exit_distance=500, exit_flip=True)

Uses flips, boost and throttle to driving at the ball and hit it.

It can only hit the ball when it's very close to the ground.

Uses a modest amount of boost, but boost isn't required. When available, it will use it to get to the ball faster. Will hit the ball semi-hard if it's lucky. Doesn't consider where it's hitting the ball.

  • exit_distance - Distance from the ball that the bot will exit the routine at. Default is 500.
  • exit_flip - If True, then when the bot exits the routine it will flip at the ball. Default is True.

goto(self, target, vector=None, brake=False)

Goes towards the stationary target, and tries to face vector. Brakes to slow down the bot right on the location, if brake is True.

  • target - A Vector.
  • vector - A Vector. If None, then the bot will just go towards target.
  • brake - A boolean. If True, it will do a bit of math to determine the exact point to start braking that will have the bot stop extremely close to target.

retreat(self)

Brings the bot back to it's goal. If there's more than 1 bot on it's team, it will compensate.

shadow(self)

If used in the offensive zone, it puts the bot in the ideal position to put the ball into the goal.

If used in the defensive zone, it puts the bot in the ideal position to prevent the ball from going into the goal.

goto_boost(self, boost)

Uses goto's pathfinding, but has a few extra triggers related to boost pads.

generic_kickoff(self)

Drives at the ball with a full throttle while boosting. Flips into it when it gets close.

wave_dash(self)

Does a wave dash forwards.

flip(self, vector, cancel=False)

Flips towards vector.

face_target(self, target=None, ball=False)

Has the bot jump and face target, or the ball if ball is True.

You only need to define target or set ball to True.

  • target - A Vector.
  • ball - A boolean.

ball_recovery(self)

Uses recovery, but has it face the ball instead of a static target.

recovery(self, target=None)

Orients the bot for a clean landing on the ground or the ceiling, and facing target.

  • target - A Vector. If not defined, then the bot will simply right itself. Default is None.

brake()

Applies the brakes to slow down the car.

Clone this wiki locally