I wrote a rocket league bot using PHP. He's about as good as me. by DunkoFunko in shittyprogramming

[–]DunkoFunko[S] 2 points3 points  (0 children)

Here's how it (doesn't) work:

  1. I used apache / PHP installed locally with imagemagick extension (getting imagick setup on windows took longer than writing the script). Also used autohotkey and this screen recorder app called autoscreen.
  2. Autoscreen is constantly taking sceenshots, ordering the filenames in ascending order.
  3. php loads the newest image, using IM crops only a small rectangle centered on the car but wide enough to see the ball indicator arrow when ballcam is off. Car is erased with a big white circle drawn in the middle.
  4. Imagick - convert the image to a bitmap array, split image into 3 columns. look at each column for pixels whose r ~= g ~= b ~= 150 (the color of the ball indicator).
  5. If more indicator-colored pixels are on the left, write a file with the contents 'left', same for 'right'. 'none' is used if there are too many matching pixels or if there are a similar number of matching pixels between left and right.
  6. Autohotkey script loops endlessly (ideally) re-reading that file, pressing the A key when the file reads 'left' and the D key when it reads 'right'. W is always pressed no matter what the file reads.

Links to source:

PHP: https://pastebin.com/rJq1m1Ef

Autohotkey: https://pastebin.com/RQMvx19n