FPS tan(x)

FPS is a genre of digital game where we control our character in the first person view with the objective to shoot projectiles (usually we see only our hand / weapon).

Typically this is not a game developed for teach math to the players. But we can compare these microworlds with our own, and the mathematical relations must remain valid. Even the trigonometry that we learn in school can be used within the game to get some hidden information.

This is a real story, Heretic is a digital game of this genre that I played since was a child (when the computer started to become popular), so much that the game runs in DOS (for who knows what that means, understand that it is not something new) . If someone wants to play this game (Heretic), just click here.

In Heretic, we can adjust the aim of the character from the maximum up value, but the game doesn’t tell us how many is it. We could only accept that this information is not offered to the players, or else, calculate by means of the game’s own resources what this value is.

First, we need identifies elements of the scenario that could be use as measures. I choose use the character’s steps. So by shooting against a wall at a distance of “y” steps, and firing a shot with the maximum up value, I can calculate the height of this shot also in the unit steps of the character.

Thus we have an unknown angle “x”, the height of the shot “z”, and the distance from the gun to the wall “y”. If we draw this information in a right triangle, we realize that we lack the hypotenuse (the largest side of the triangle). However, knowing the others to sides, we can calculate the tangent of this angle “x”, dividing “z” by “y”, and querying a table of trigonometric values to find the angle that corresponds to the value found. This can be replicated to any FPS (Counter-Strike, Doom, Heretic, Quake, …).

Below is a video of the process and calculation for Heretic in particular.