Releases: FormularSumo/FormularBot
Major bugfix and improvements to demo routine
#35 8957041

^This small statement at the end of line 175 in FormularBot.py was causing FormularBot to not switch routine when closest to goal. This meant when doing go_to_ally_goal routine FormularBot would almost never move.
#34 54d0d12 315639b
Major improvements in demo routine, improving both DemoBot and FormularBot:
Only boost if target within 45 degrees (stops boosting up the walls)
Only goes for boost if not within 2000 of target and speed > 2100 and angle within 45 degrees (0.785398 radians), to avoiding breaking off a demo when about to contact.
Drift if going for a demo but angle > 1.5 radians (~85 degrees)
Print 'there are no enemies to demo :(' when applicable (was supposed to previously but broken)
Also
DemoBot has anti-turtling code like FormularBot now.
In goto_nearest_boost bot half flips or drifts, not both
Added speed variable (worked out from velocity in 3 different directions) which I can probably use in future for things.
21/8/2020
#31 - Improved go_to_friendly goal routine so FormularBot flips less and more often faces the right way, see commit for details and other changes
12bc85b


#33 - Re-introduced demoing, when ally is close and closer to ball than FormularBot, and ball is near enemies goal, FormularBot will try to demo enemy nearest ball. Again, see commit for detail and other changes
ec18552

Changed anti-turtling code to use orientation rather than Z coordinate (both in addition to speed) which has massively increased how often FormularBot flips to get out of turtling
7faed4f
"Made rendering a little safer" - as per - ddthj/GoslingUtils@4dcba0b
(I did previously add this ddthj/GoslingUtils@7dad4cd commit from GoslingUtils, but it caused this #32 bug, so I removed it 2bffd46)
Not strictly part of this release but updated README f21dad2 080e1f1 dd3b86c
18/6/2020
#10 - FormularBot now uses Quickchat. Currently says 'I got it' if going for kickoff and joint_closest and has teammate(s).
3e3471b
#23 - Created a new logo for FormularBot
124c850 + 61c6eca

#21 - Created new appearance for DemoBot
29a51eb

#20 - Added a fast back_centre kickoff
e165b82
Fixed ghost boosts and removing unused variables as per ddthj/GoslingUtils@2ce7644 and ddthj/GoslingUtils@1a21d16
95e61f5
2/5/20
30/4/20
Previouisly FormularBot would drive towards goal if abs(agent.me.location.y) < 5000. This was supposed to stop FormularBot moving when it reached its goal, however it also stopped FormularBot moving if it was in enemy goal.
Now I have a separate check for blue team and orange team. The blue team one is if agent.me.location.y > -5000:
Changed onside from me_onside = my_distance + 80 < my_ball_distance to 70 to hopefully stop FormularBot cancelling shots so much.
elif x_position == 0:
kickoff_position = 'back_centre'
else:
kickoff_position = 'unknown'
^ In 1.4 FormularBot will have a fast back_centre kickoff. If kickoff position is not standard (eg different gamemode) FormularBot will continue to drive towards ball while boosting and flip when close.
FormularBot drifts if abs(angles[1]) > 1: while going centre.
29/4/20
Instead of going for kickoff if closest or joint closest not FormularBot only goes for kickoff if closest or (joint closest and on left). It's usual in Rocket League for the player on the left to go for kickoff unless otherwise agreed.

DemoBot fix. When I moved all decision making and stack clearing code to FormularBot.py I moved code which worked out closest enemy as well. That code has now been moved back to routines.py as it's only used for demo_nearest_enemy routine and is needed by both FormularBot and DemoBot.

Fixed goalie code. In 1.3.2 I made it so goalie is False if shooting is true, however I forgot that'd make goalie rush out and shoot when ball is near enemies goal. I've now changed it to goalie is False if me_onside and (closest_to_ball or distance_ball_friendly_goal < 3000), the other two conditions of shooting.

One of the conditions to not check if stack should be cleared is going for kickoff, however I forgot the '' around kickoff. This didn't result in an error because kickoff is the name of something and this didn't affect anything previously as kickoff would never be cleared anyway, however because FormularBot now only goes for kickoff if on left and joint closest or closest I noticed this bug and fixed it.

Commented some code in FormularBot.py and DemoBot.py
28/4/20
Goalie false if shooting true.
Removed airborne and distance_ball_foe_goal < 3500 as conditions to keep shooting if offside.
Hopefully stopped bot driving in circles in goal.
Only get boost when should be doing something else if len(agent.friends) > 1
24/4/20
Replaced uses of if agent.ball.location.y * side(agent.team) * -1 > x * side(agent.team) * -1 or similar, which only worked for blue team, with if distance_ball_foe/friendly_goal which works for both teams and is exactly ball distance from goal.
Changed shooting range to 4000 and x to 1250. Changed clearing range to 3000. Changed closest to 1500
Added stack == 'getting boost' and agent.me.boost < 20 as a condition to not clear stack because often bot would not have any boost because it kept clearing stack everytime it tried to get some. Now it doesn't clear stack while getting boost unless boost > 20.
Since I removed all stack clearing code from routines.py I forgot to update DemoBot to not send True as a variable when pushing demo_nearest_enemy to stack, which meant DemoBot was crashing. Also added a try/except, which says no enemies to Demo :(
Removed defaultThrottle(agent.0) from goto_friendly_goal as something to do when reaching it as that's not needed and probably stops car from turning around from momentum.
Added 'Plays best in 3s.' to description as most of FormularBot's team code is written for 3s for when it played in Ultimate Battle League.
23/4/20
Major:
Re-wrote stack clearing code so bot should never have nothing to do, and should almost always be doing the most recent thing the decision making codes decides to do

Stack is now cleared whenever decision making code decides bot should be do something else unless: going for kickoff or shooting and close and (agent.me.airborne or me_onside or agent.me.location.y * side(agent.team > 2500 * -side(agent.team)). This is to prevent bot cancelling a shot when it's already committed.
Changed goalie code a bit so goalie = False only if not(onside and closest to ball). This means as soon as goalie is closest to ball (and onside) it will go out for a shot, but not before. Removed only if distance > 6000 or kickoff as those aren't needed anymore.
Added fast kickoff for off_centre kickoffs (all my fast kickoffs are based on this video https://www.youtube.com/watch?v=q4WDvcNdbD0&t=182s)
Minor:
Bug fix: bot would sometimes be a goalie in 1 v 1s when it's not meant to, resulting in the stack being cleared and bot doing nothing. This was due to one of the places where checking if should be goalie using closest_to_friendly_goal rather than goalie, which is only true of len(agent.friends) > 0
Added very_close variable because I wanted distances where bot moves away from ball to prevent scoring own goals and distance where bot wouldn't cancel shot because already committed to be different. So now very_close is used for the own goal preventing and has a range of 500, while close is used for not shot cancelling with a range of 1000
Changed some paint colours and made DemoBot look the same as FormularBot (as opposed to looking like an older version. At some point I will design DemoBot properly so it looks different)
21/4/20 2
Fixed bug where shots would only be taken if agent.ball.location.x < 1500 and agent.ball.location.x > -1500 which would often cause problems where bot would do nothing
Removed closest to friendly goal as a condition for shooting as closest to ball now only accounts allies who are onside. This used to often make the goalie rush out when another bot is closer to hit., whilst not providing any benefit.
Commented out stack printing code in console as shouldn't be in public version
going_centre is only cancelled if close and ball is within defending quarter rather than just close
Shooting is no longer not cancelled if shooting conditions aren't met, ball is close but in attacking quarter



