So, I'm measuring the distance between two bots with:
(This is inside an if block which has a boolean value on the boolean stack indicating whether code inside the if block should run or not)
*.refxpos *.refypos dist dupbool dup *998 != and 998 store dropbool
*.xpos *.refxpos sub dup mult *.ypos *.refypos sub dup mult add sqr dupbool dup *997 != and 997 store dropbool
The first line is dist(refxpos, refypos), and the second line is sqr(((xpos - refxpos)*dup) + ((ypos - refypos)*dup))
I have a bot which does repro 50, and then both it and the child move away from each other, until they pass 400 dist (according to dist, not the manual formula), at which point they both fixpos.
The bots are still close enough at that point to shoot each other, regardless of map size, indicating that the coordinates returned by dist are the actual (or near) coordinates. (The bots do not aim their movement or shots very well on the largest map size though)
(I'm going to write ~number in the rest of this post where I mean the number is sometimes that number, but is sometimes 1 higher or 1 lower than that number instead, to save time.)
(And for each bot, I'll say what I got for the dist method and the manual method with dist:manual)
On size 1-4 maps, I get either ~452:~452, or ~522:~522. Said another way, each single bot has either ~522 and ~522 for both methods, or ~452 and ~452 for both methods.
On size 5 maps, I get either ~452:~362, or ~522:~417.
Size 6 maps: ~452:~301, or ~522:~348
* = within 1 distance point anyhow.
So, we can conclude that:
1. Refxpos/refypos and xpos/ypos are returning values which are scaled down by the size of the map
2. dist() takes in scaled-down units, and returns actual distance units
So how do we do work on actual x or y coordinate differences? We have to get the actual distance, which we can do like so: dist(xpos+xdiff, ypos) or dist(xpos, ypos+ydiff).
Additionally, this is helpful: refvel* are in actual distance units rather than scaled-down units: My test bots are showing the same values at the same tick for these in both the smallest and largest map size.
There's just two problems I see so far:
1. At very large map sizes you end up with refxpos,refypos coordinates whose difference from your xpos,ypos is so tiny (say, 6 on the largest map) that the actual coordinates returned by dist (and angle) are unreliable.
2. Why are the actual distances being returned as sometimes ~452 and sometimes ~522 (which are ~70 units apart), and never something in between? (Note: I'm discounting the results from huge maps which return different actual distance values than ~452 and ~522, because their scaled-down units are so tiny that it makes the result inaccurate)