-
Notifications
You must be signed in to change notification settings - Fork 40
Mapping (World & Image Coordinates)
Andrew edited this page Sep 16, 2013
·
1 revision
The protobuf messages pass coordinates in two parts: a cell and an offset within that cell. These can be converted into the in-game world coordinates using the following algorithm.
MAX_COORD_INTEGER = 16384
def coordFromCell(entity):
cellwidth = 1 << entity[(u'DT_BaseEntity', u'm_cellbits')]
x = ((entity[(u'DT_DOTA_BaseNPC', u'm_cellX')] * cellwidth) - MAX_COORD_INTEGER)\
+ entity[(u'DT_DOTA_BaseNPC', u'm_vecOrigin')][0]
y = ((entity[(u'DT_DOTA_BaseNPC', u'm_cellY')] * cellwidth) - MAX_COORD_INTEGER)\
+ entity[(u'DT_DOTA_BaseNPC', u'm_vecOrigin')][1]
return (x, y)
These utilities will allow you to create images and animations using the in-game coordinates:
- Example mapping utility that derives a world-to-image coordinate mapper from tower pixel positions: https://github.com/mfajer/skadi/blob/mapping/skadi/util/mapping.py
- Page that generates a coordinate mapping function from an image you select (report problems/inaccuracies to Frond on #dota2replay): https://dl.dropboxusercontent.com/u/2172752/dotamap_coords.html