Monday, February 24, 2020

Programming Video Games

Background, Video Game, 80S, AliensI have at least one student every year who wants to get a job in the video game industry working on games but he insists he doesn't need any math.  If he's going to help write the programming for the game, he is going to need to know math.  He's going to need to know quite a variety of math.

In fact, math is the basis of all games because the math tells which direction and where characters move, how long it takes before they can regenerate, what they need to move to the next level, or anything else.

Most games are built in virtual worlds filled with rules that keep it running.  These rules are based on mathematics because math explains and defines the world.  Some of the math may be based on physics such as when you shoot a banana at the top of a building, it has to follow a parabolic trajectory.  If your character has to climb a mountain, the mountain has to be defined by slope.

Video games require mathematics from Algebra, Trigonometry, Calculus, Linear Algebra, Discrete and Applied Mathematics, and so many more.  They don't necessarily use everything but they do use a lot of math.  Programmers especially need to know how to use matrices, delta time, unit and scaling vectors, dot and cross products, and scalar manipulation among other things.

Mathematics is what is used to make everything in the virtual worlds so they look real and everything  reacts correctly.  If you shoot a bullet in Call of Duty, it is math that provides the proper trajectory.  If you jump over something, the math helps provide the proper movement.  We also need to know how much damage someone will sustain if they fall off a cliff.

Some of the specific types of math needed include:

1.  Probability and statistics.  Probability is used to calculate the chances of something happening and the degree to which it occurs such as if you swing your sword at the ogre, what are the odds you will actually kill him vs just damage him and the extend of the damage.  Calculating odds is needed for every event that happens in the whole game.

2. Linear Algebra provides matrix theory and the more practical uses of Algebra.  This is what programmers use to understand and move things through three dimensional space.

3. Geometry provide an understanding of how shapes are formed.

4. Algebra and calculus help find limits, functions, derivatives, and maximum and minimums along with helping to explain the physics that is happening.  Then there is parabolic trajectories, rate of change, and so much more.

5. Mathematical modeling takes the basic mathematics such as geometric shapes and figures out how to put them together to make the more complex shapes.  For three dimensional space, one creates a cylinder by rotating a curve around it's central axis.

6. Game Theory helps people learn how everything works together so programmers know how it all fits.

These are just a few examples of how math is used in creating video games.  The next time a student talks about video games, let them know how useful math is in this field.


No comments:

Post a Comment