In games like Factorio, you might notice that when the player is at a certain coordinate relative to the tree, it renders in front of the player, thereby giving the effect that the player is behind the tree. My question is, how is this accomplished?
This effect is usually accomplished through sorting the draw order along an axis. In this case, the Y axis. Objects with the lower Y value (higher up on the screen) are drawn first. Objects drawn with a higher Y value are then drawn, overlapping the objects drawn earlier.
In this example, the X value is unimportant;
On the left, the orange box is drawn first because it's y is less than the y of the green box.
On the right, the orange box has now moved down 10 units on the y axis and is now drawn after the green box because it's y is greater than that of the green box.