Skip to content

3304: Limit number of crease defenders#3456

Merged
Lmh-java merged 4 commits into
UBC-Thunderbots:masterfrom
Lmh-java:lmh/3304-aggressive-defense
Jun 14, 2025
Merged

3304: Limit number of crease defenders#3456
Lmh-java merged 4 commits into
UBC-Thunderbots:masterfrom
Lmh-java:lmh/3304-aggressive-defense

Conversation

@Lmh-java

@Lmh-java Lmh-java commented May 11, 2025

Copy link
Copy Markdown
Contributor

Description

In general: improve aggressiveness of defense

Particularly:

  • Refactor defender_fsm_base logics (added early stop to prevent unnecessary computation)
  • Move max number of crease defender to ai_config, which allows dynamic configuration on the max number of crease defender. Originally the max number of crease defender could be up to 3 at a moment. This looks like we are having an exceeding number of robots being assigned to passively block the enemies. To make the overall defense strategy to be more aggressive, we should assign fewer crease defender.
  • [Not implemented in this PR, instead see Shadow Defense Base #3450] Implement a new fsm active_defender, following the below logic:
    An active defender is promoted from a pass defender when
    1. It is closest to the ball or the enemy player that carries the ball
    2. There is no other active defender on the team at the moment

The specific active defender behavor is still WIP.

Testing Done

Resolved Issues

Closes #3304
Related to #3450

Have synced with @zuperzane and we have the same idea on the shadow defender (or active defender). The actual defense logic will be implemented in his PR #3450

Length Justification and Key Files to Review

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

@zuperzane

Copy link
Copy Markdown
Contributor

Hey I'm also working on aggressive defense if you wanna check it out see what it would look like for us to combine prs, mine is like a robot will try and strip the ball away from the enemy
It's in here #3450

@itsarune

Copy link
Copy Markdown
Contributor

@Lmh-java so far, these are great changes. Have you taken a look at #3450 which is similar to the active defender idea?

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried playing around with max_num_crease_defenders but it doesn't seem to work for me

@Lmh-java

Copy link
Copy Markdown
Contributor Author

@zuperzane @itsarune apologies for somehow missed the discussion here.
I only started a bit on the active denfender FSM logic, so I am cool with anything. Right now, with the max_num_crease_defenders in place and set to 2, the robot already seems crazily violent to me.

I can't get a chance to run #3450 atm (I am trying to unblock a few issues for bazel uprading and my entire environment points to a different bazel version) and it is a bit hard to tell what the specific behavior is just from the code. So I will be sharing my plan here and let's sync (I will also attend the meetings starting this May 31, Sat)

For active defender, my original plan was

  1. The pass denfer closest to the main threat is promoted to be active defender.
  2. active defender only exists when we have more players than the opponent.
  3. The active defender will make physical contact with the enemy who possess the ball.
  4. According to the threat score of the enemy, different level of aggresiveness will also be selected (This needs more planning, because I don't want to turn the soccor into WWE)

@Lmh-java

Lmh-java commented May 27, 2025

Copy link
Copy Markdown
Contributor Author

I tried playing around with max_num_crease_defenders but it doesn't seem to work for me

Can't validate at the moment, but I just rebased and pushed since I shipped a fix on proto parsing that was merged some time ealier. Iirc, the max_num_crease_defenders was working locally for me

@Lmh-java Lmh-java force-pushed the lmh/3304-aggressive-defense branch from 250fff9 to d2d034b Compare May 27, 2025 08:30
@zuperzane

Copy link
Copy Markdown
Contributor

Ok that makes sense my tactic is similar the only difference is that it turns into a ball stealer once it is in between the ball and the net instead of it being the closest. We can talk on Saturday I'll be there

@Lmh-java Lmh-java marked this pull request as ready for review May 31, 2025 18:28
@Lmh-java

Copy link
Copy Markdown
Contributor Author

@zuperzane and I have synced, and I will stop my PR here and it will just have a config to limit the number of crease defenders and refactor some code. Superzane has the logic for shadow defender done. Therefore, this PR is ready for review.

cc @itsarune
The config should be working after I rebased and pushde

@Lmh-java Lmh-java changed the title 3304: Improve aggressiveness of defense 3304: Limit number of crease defenders Jun 1, 2025
@Lmh-java Lmh-java requested a review from itsarune June 3, 2025 00:27
Comment thread src/software/ai/hl/stp/tactic/defender/defender_fsm_base.cpp Outdated
itsarune
itsarune previously approved these changes Jun 6, 2025

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ⚽ ⚽

@Lmh-java

Lmh-java commented Jun 7, 2025

Copy link
Copy Markdown
Contributor Author

@itsarune oops, I didn't mean to dismiss your review lol

@Lmh-java Lmh-java requested a review from itsarune June 7, 2025 19:52

@itsarune itsarune left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

(we set it up to auto-dismiss reviews whenever you make a commit)

@williamckha williamckha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦾🦾🦾

@Lmh-java Lmh-java merged commit e0e8ed8 into UBC-Thunderbots:master Jun 14, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve aggressiveness of defense

4 participants