Home    ICT    Music    Adventure    Other    Me    Bullying    Learning    Economy    CV  
 
Home
CV
Games industry
Blood splats
Blood splats
When kids ask why they have to learn about vectors, because they are never going to use it again in their lives, they are astonished when I can tell them that vectors were once a big part of my working life.

Since vectors is essential to 3D graphics, math teachers have occasionally invited me to their class to tell about how vectors are used in the games industry, and what fun I had with them.

The most obvious use of vectors is multiplying vector with matrix in order to rotate points in 3D space. There are plenty of libraries that do this for you - it gets tricky only when you want to write the process yourself in order to beat your competitor at rendering speed. The games industry is cutting edge, you always want to be ahead of everyone else.

But more interestingly to your upper secondary school student are the blood splats. When I was working on The Crow City of Angels, all combat was very dynamic. As each character was different and may or may not wield a weapon, and each weapon having a different shape, there could be no pre-calculated responses to what one could call "collision of body parts".

So you have a weapon that goes from point A to point B, the question I had to answer was - did the fist, foot, head(banging) or weapon hit another character's limb? Further, I had to learn which limb it was and where on the limb I could attach the wound.

How hard was the hit? That's a combination of the speed of the weapon and the target limb. How big was the wound - meaning, how many blood particles should I produce? And the most interesting question, which direction should the blood particles fly?

The Playstation (and yes, I mean the original PSX) has only so much RAM, so we had only a certain number of blood particles we could produce on the screen. The idea was that the wound would slowly close, so that it did not pour our blood continually. Indeed, how often a new blood particle would come out was a function between the random number generator and the size of the wound.

In the first attempts at this function, I completely failed at keeping the wounds small enough. The result was that I used up ALL available slots for blood particles in half a second. For the next half second, no new blood particles could be produced, yet the wound was to live for another five seconds.

This lead to the following visual: Character A hits character B on the chest. Character B falls back (direction calculated by collision vectors described above), wound opens, and a huge splash of blood pumps out. Then nothing. Then huge splash. Throb! Throb! Throb!

Given the nature of The Crow, this was not really completely bad - it just looked a lot more brutal than we ever intended. The calculation parameters were quickly adjusted to how the client (Acclaim) wanted them - but if I recall correctly, the orginal can still be invoked on the PSX version with the correct password. (I just don't remember what that password was.)

Previous: How to get around the office

Built using CMS-library for Trollsilm Tagged Template