Vectors in Video Games – 16/10/20

Firstly, what is a vector? A vector is something that has magnitude and a direction. Push, Pull, Acceleration and Gravity can all be used as vectors.

So with that in mind, Vectors are used everywhere in video games, below are 5 examples from games that I like playing where vectors may have been used. I will also use Pseudo-Code to explain how this may happen.

Example 1: Mario Kart 8 Deluxe

In Mario Kart 8, each driver // kart uses a Vector, in this case it would be a Vector3. The Vector3 would need to be able to accelerate and have a speed increase.

Example 2: Crash Bandicoot 2

In Crash Bandicoot 2, when we’re jumping on polar’s head for our 20 lives and not because we disrespect animals, vectors are used here. The vector I want to point out is Crash’s jump in particular. Crash would need to have a Vector3 telling him where to stop jumping and and another vector3 pulling him backdown, although if a gravity code is used, we could also use that to keep him grounded.

Example 3: FIFA21

I don’t necessarily like playing FIFA, but its way more enjoyable with a few mates in the pro clubs game mode. Looking at this screenshot, the ball would be a Vector3. Because the ball can move in many different directions, and with spin, it would need to be able to rotate and have a force pushing it in multiple directions, dependent on where the impact has came from.

Example 4: Sonic the Hedgehog 3

The blue boy is making another appearance on my blog, this Vector2 would need pure acceleration that increases dependent on distance travelled. He would also need a point to define gravity and also to define a jump height.

Example 5: Rocket League

In Rocket League you can drive on the roof, and this would be done with the same method as used in the Super Mario Example. A certain point of gravity would be used, there would need to be some acceleration for the car to move as well.

Obviously, within these 5 games, Vector’s are used more than we may know, in the 3D models, the assets of the levels and even for camera movement. It’s not hard to understand why using and understanding how these are used are fundamental to video game programming.

Leave a comment