By: Ali Soltanian Fard Jahromi
What are the Trigonometric Functions?
The trigonometric functions are a set of functions which show the relation between an angle of a right-angle triangle and the ratio of the lengths of two of its sides. The trigonometric functions are: sine, cosine and tangent. The trigonometric functions are periodic, meaning that their graphs repeat continuously in a specific pattern. For example, here is the cosine function’s graph:
Uses of the Trig Functions in Game Programming
I am a game developer and a digital artist (CGI, 3D animation, digital art). I have developed and released many games in different genres. Trigonometric functions can come particularly useful in game programming. For example, in some games, I have to find a way to implement a day and night system, where the world oscillates between day and night repeatedly as the game progresses. This repetitive pattern can be represented by the cosine trigonometric function. The cosine function always results in a number between negative one and one. In the code for my game, I have a value which represents the brightness of the atmosphere of the environment which can be anywhere from zero to one. To achieve the day and night cycle, I create a variable that is constantly increasing. I then take the cosine of it. Furthermore, I take the absolute value of that variable so that the value of the variable is never below zero. The figure below is a model representing the day and night cycle implemented in the game:
The result is a trigonometric function representing the day and night cycle in my game program.
Space Survival – 3D Shoot’em Up Video Game
Developer: Ali Soltanian Fard Jahromi
Publisher: Soltanian Games
The milky way galaxy has become a warzone. A space empire called “The Sheyertonian Empire” has been stealing resources from The Valeratonac Empire. The Sheyertonians will take as much resources from the Valeratonac at any cost. Even if that cost is the lives of many. You are part of the Valeratonac. Your mission is to find and take down their most powerful ships so their main bases can be taken down.
Play for free on Steam: https://store.steampowered.com/app/1559850/Space_Survival/
Interview on Radio New Zealand (Radio NZ):