I dunno how to detect breaches

I’ve been doing terminal for a while, but since my algos are all static, I wanted to try something new. But I don’t even know how to detect breaches! I’ve tried the stuff that other threads have suggested, but it doesn’t seem to work.
If I could get a detailed explanation, that would be great.

I’m assuming you read through this thread, where the best way to find breaches is the “breach” event. Here are a few ideas that could work for the most part (or at least be mostly accurate) that are a bit easier to manage:

  • If you’re already analyzing each action frame, track the last position of enemy units. If you lost health between turns, the last location is the breach location.
  • If you’re only analyzing the first action frame, you can store the enemy placements and in your regular logic run the pathfinder to get a fairly accurate representation of the path. Once again, if you lost health, the breach should be the last location.
  • A less accurate way (but probably just as good) is to get your damaged/destroyed turrets between two rounds (store game states in the regular logic, no action frame analysis needed). The center of those locations is probably a good location to build defenses and should be fairly aligned with the breach location (except when the enemy sends out scramblers).

Alright thanks, but is there an easy way to analyse every first frame of an action phase?

I mean to get the information unit’s locations. Do you have to check through the whole ‘P2Units’ thing

In your implementation of on_first_frame(), you can construct a game state from the game_state_string that was passed in (same setup as you see at the top of your regular logic). From there you can interact with that frame (and any other frame in your on_frame()) implementation just like you would in your regular logic. For instance, iterate over the game map locations and find locations that contain attacking units owned by player 2.