Blizzard / s2client-proto

StarCraft II Client - protocol definitions used to communicate with StarCraft II.
MIT License
3.78k stars 431 forks source link

Using camera_move action in feature layer is inaccurate #64

Closed islamelnabarawy closed 6 years ago

islamelnabarawy commented 6 years ago

Summary: The camera_move action introduces inaccuracy between the center of the camera feature in the minimap and the point that was passed as an argument to camera_move. The bigger the map, the more inaccurate it gets.

This jupyter notebook illustrates the issue.

The inaccuracy is probably coming from the way the camera feature layer itself is generated, but it manifests very clearly when the center of the camera rectangle is used as an argument to camera_move.

Steps to reproduce:

Expected result:

Actual result:

islamelnabarawy commented 6 years ago

Turns out this was due to the fact that the size of the minimap is even, and when getting the center I was rounding down the 0.5. When I get the ceiling instead, the issue doesn't happen.

In case anyone else runs into the same problem, the solution is to round up instead of down when calculating the camera position using the camera feature. That gets rid of the issue.