Skip to content

Incorrect target because of floating point arithmetic #145

@AttackingOrDefending

Description

@AttackingOrDefending

In this game at frame 1524 (round 37, round frame 27) the interceptor that was at [22, 10] in the previous frame (1523) and went to [22, 11] in frame 1524 attacked the interceptor at [21, 15] instead of the one at [23, 15] because p2units was: [[22,15,113.8,"503"],[21,16,113.799995,"504"],[22,17,101.899994,"505"],[22,15,113.8,"506"]]. As you can see unit 504 had 113.799995 health while unit 506 had 113.8 health. This caused the targeting to select unit 504 because of the lower health instead of the correct unit 506 (because it was closer to an edge). The difference in health was caused by the floating point arithmetic when adding support to the units. This can be fixed in the game engine by rounding the results to some decimal places (e.g. 2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions