External Publication
Visit Post

OpenTTD AIs and Game Scripts • Can somebody teach me tile arithmetic?

Transport Tycoon Forums - Index page [Unofficial] February 12, 2026
Source

I'd appreciate if somebody could teach me in detail how it works because I'm having difficulty understanding.

I see in code some people add, substract and even multiply with tiles and then divide by manhattan distance, how does this work? Here is example: tile1 + (tile1 - tile2) / Manhattan distance.

This is crazy, there is no documentation about how this works or what it gives. There are cases where tiles are multiplied by something, but my problem is I don't know what the result means.

I know they're just integers, however the map is half negative half positive, so how do you know the result will make sense? I've also spotted invalid arithmetic resulting in odd bugs so I'm not sure it's bullet proof.

Statistics: Posted by GoldMine — 12 Feb 2026 21:56


Discussion in the ATmosphere

Loading comments...