Possible bug in provided get_target function?

Possible bug in provided get_target function?
0

#1

I’ve been working on a better simulator and I’ve had bizarre behavior in which my simulated destructor firewalls are attacking other enemy firewalls. After some digging, this problem appears to go all the way to the get_target() function in AdvancedGameState. A cursory inspection of the logic appears to have nothing stopping stationary firewalls from selecting other stationary firewalls as targets? Not quite sure what’s going on here, whether this is somehow my problem or not. I’ve modified enough of the starter files that I’ve lost track at this point :crazy_face:


#2

I haven’t actually ran the code or anything, but a quick look at the GitHub script makes me think you are correct that there is a bug.

Specifically, this line (line 43):

if unit.player_index == attacking_unit.player_index or (attacking_unit.unit_type == SCRAMBLER and is_stationary(unit.unit_type)):
    continue

I think if you just add another condition it should work (not tested), so it would become:

if unit.player_index == attacking_unit.player_index or (attacking_unit.unit_type == SCRAMBLER and is_stationary(unit.unit_type)) or (is_stationary(unit.unit_type) and is_stationary(attacking_unit.unit_type)):
    continue

#3

This functions are written from the perspective of a moving Information unit:

get_target: finds the best target for the current information unit
get_attackers: find who would attack a information unit , on a target location

get_target should not be used from stationary units, there are way more efficient ways to do it.


#5

Another observation: my simulated stacks of EMPs will all blast the same poor little filter deep into negative stability, wasting most of their shots, because the provided get_target does not disallow zero-stability targets. Looks like another " or unit.stability <= 0" needs tossed into that big conditional to skip that iteration.


#6

I don’t think the starter kit was designed for direct modification of the game map, like that. I do agree it’s a bit weird to have destructors not accounted for - in my laziness I just rewrote a get_destructor_target instead of combining the logic - but accounting for how the player may potentially simulate/modify the game map could get messy quickly.


#7

Im dumb, nevermind my (deleted) post :joy:


#8

I agree; I’ve actually never used any of the functions inside the AdvancedState because by the time I noticed them I’d already written my own implementations that work slightly differently.


#9

For reasons stated previously in the thread, get_target currently seems to be working as intended.

However, if anyone disagrees the intended usage of a function in the starterkit, or believes any other aspect of the starter kit can be improved or made more clear, they are welcome to make a PR and let us know about it on the forums.