Mathematics in Game Development

Mathematics in Game Development

By: Dhruv Mehta (Content Writer, Sudans Tech)

From the very beginning of our childhood we are taught maths in such a traditional way that we most often than not feel that maths is boring and esoteric. Most of us in our high school have these very common questions like:

“When am I ever going to use these mathematical equations in real life? When are we going to use ‘cos’ and ‘sin’ in our lives? How are these topics useful?”

And right here comes Game Development answering all our questions. Mathematics is a fundamental topic which comes in handy when we are working with making games and 3D Vector graphics.


Where in Game Development do we need Maths?

Answering the big question here that where do we need math in game development?

  • Game Programming : Defining various mathematical functions through code like Lerp function, Inverse Lerp and Remap functions.
  • Object Animations : Moving and animating a game object with respect to time at a specific angle and speed.
  • Game Physics and Physics Modelling : Moving the player in a particular direction using ‘Arrow keys or WASD keys’ in a particular vector direction with a specific speed.
  • 3D graphics rendering : A 3D renderer software engine works on the Cartesian Coordinate System and converts the matrix pixels to form the art work.
  • Lightning Techniques : The intensity and the amount of light that is required in a game scene is done all by using some mathematical calculations and functions.

These are just a few cases where you will find maths in game development. There are many more of such cases about which you will learn when you do intensive game programming.


How much Math should you know to do Game Development?

The next question after knowing that, where you need math in game development should be how much math should you actually know?

During the early days of computer programming and during the inception of Graphical based systems there used to be a lot of 3D math that needed to be done to render the objects on the screen. But nowadays a lot of things are predefined and already calculated for us. And tools which help us to do this are called game engines and 3D renderers. The game engine does all the mathematical hard work for you.

People who do heavy rendering stuff and work with physics modelling need a stronger grasp on certain mathematical topics to understand how the coordinate system works and how the game object renders out. But for the game programmers a decent amount of basic math calculation like multiply, divide and vectors etc. (we will still see some essential mathematical topics for game development in the below section). For game programmers other things like code performance, finding bugs, building solutions etc. are more important.

GAME DEVELOPMENT.png


Mathematical concepts we need in Game Development

Some of the basic fundamental math essentials that you need for game programming and development are -

  • Vectors : Vectors are the part of maths that works on a Cartesian coordinate system which has a direction and a magnitude. It helps in placing the game objects in the 3D space and moving them in a particular direction.
  • Angles : Angles form the very basis of maths where we study about cos, sin and tan. In game development they help us to rotate and animate the game objects.
  • Geometry : Geometry is the field of maths which deals with the shapes and sizes of the objects. While making a game, a developer needs to adjust the shape and size properties of the game object to make the game workout.
  • Matrices : Matrices typically transform a 3D or a 4D vector into another 3D or 4D vector, and help us perform operations such as rotation, translation, scaling, and skewing etc.
  • Transformations : Transformations basically help in 3D rendering of the graphics by performing operations that uniformly change the coordinates of a geometric object designed inside a 3D renderer.

Again these are not all the essential math topics, just a few which will get you started with game development.

Game in math (1).png

Lastly, to conclude we would like to make it clear that maths is not a necessary requirement in game development but an important asset which helps you in understanding the programming calculations which are taking place behind the scenes and sometimes in front as well, when you are coding your game.