Name: Clair

Occupation: Video Game Programmer

Company: Game Pro

 
 

Pythagorean Theorem
The Pythagorean Theorem reveals an interesting relationship between the longest side of a right triangle (hypotenuse) and the two shorter sides (legs). The square of the hypotenuse is equal to the sum of the squares of the two legs. I use this relationship whenever I need to calculate the distance in one of my games. It could be the distance bewteen two characters or the distance from a character to a secret doorway or an invisible trap.

Pathfinding

Another application of the Pythagorean Theorem in calculating distances can be found in pathfinding algorithms. The idea is to find the shortest path from one point to another. However, this time there are obstacles to consider. Rather than calculate the distance between two points, we must compute the best move every step of the way. Each time you take a step, you can move back, forward, sideways, or diagonally. Each step has a value associated with it. Some steps are more expensive than others. The sum of all these individual moves equals the entire pathway.

Geometry
I create many of my game worlds using a pseudo isometric perspective. Isometric projection is a way to represent a 3D object on a two dimensional surface. To create pseudo isometric tiles, we start with a diamond shape and make the width twice as large as the height. The tiles are then overlayed with a graphic image representing part of the game environment and placed together seamlessly to create a virtual game world.

Maps and Grids
The entire isometric world is stored in a tile map. A tile map is just a grid of numbers that specify the type of tile needed in each location. If your game world occupies a 15 by 15 tile space, you would need 15 rows, each containing 15 numbers. 0 may designate grassy areas, 1 might be paths, 2 may be obstacles, 3 may be doorways. I have to be able to write a program that translates this array of numbers into a two dimensional world that can be seen on the screen.

 
Copyright © MathPlayground.com