Targetting most recently created bug

There appear to be some cases where, according to unit id’s, the game engine does not follow the final targetting rule that “In the rare case that the above logic does not identify a unique unit, the most recently created unit will be chosen.”

An example is replay 6086086, where on frame 22 of round 0, (line 27 in the file), you can see that ping “9” is attacked when the rule says it should be ping “10”. There are 5 pings stacked together and very little else going on, so I can’t tell why the replay shows the second-to-last of 5 pings as the one attacked!

Under player 2 units, the 5 pings are:
[[25,16,18.0,“6”],[25,16,18.0,“7”],[25,16,18.0,“8”],[25,16,2.0,“9”],[25,16,18.0,“10”]]

Now I haven’t seen this change any macro behavior yet, but I suppose it might in some special corner case in the future?

I did some testing with my simulator. It seems that it is important the the tiebreak targeting rule should be consistent, but it doesn’t seem to matter too much exactly what the rule is. I should note that I am only validating that my simulator produces the correct set of unit locations and healths at each frame, I am not tracking unit IDs here.

1 Like

I’ll look into making this consistant.

1 Like

This one took me a while to figure out… We used CompareTo() incorrectly
You can click the ‘play’ button on this Replit to see what went wrong

Oh okay that makes sense, then! I was actually wondering why the id’s are being stored as strings in the first place, because if they were stored as numbers, this would have been a non-issue, yeah?

1 Like

I deployed Ryan’s fix so it should be fixed now. Let us know if there’s still something wrong.

@acshikh Thanks so much for finding this!

1 Like