Line of sight

The line of sight is a sequence of squares between two objects which approximates the line between them. The two objects can see each other if and only if no square in the line of sight is a barrier.

In GOP, the line of sight is used to determine whether a player is able to attract or repel an orb from their position, but the actual movement of the orb can differ from the tiles within the line.

Calculation
The line of sight is based on a hypothetical straight line drawn from the first object's square to the second object's square. The squares which the line passes through form the line of sight between the two objects. These squares can be calculated by Bresenham's line algorithm. However, there still remains the question of where exactly within the square the line starts and where it ends.

Before RuneTek 5
Before RuneTek 5, a distinction was made between the player and the NPC. The line of sight was always directed from the player to the NPC, and the starting point of the line was always on the boundary of the square. If the NPC is exactly diagonal to the player, then the starting point is the nearest corner of the square to the NPC; otherwise, it is the midpoint of the nearest edge to the NPC. The ending point of the line is the same relative location in the NPC's square as the starting point was on the player's square.

After RuneTek 5
After RuneTek 5, there is no longer a distinction between the player and the NPC. Therefore, in light of this change, the line of sight is always calculated by taking the object which is farther to the west as the player and the other object as the NPC. If both of them are at the same x-coordinate, then the object which is farther south is taken as the player (however, note that in this case it makes no difference which of the two is taken as the player).