Wednesday, March 31, 2010

Jumping (part 1)

So, the core of our game is the jumping.
I was in charge of creating a jumping system, so I'm going to explain it here.
When the character jumps, we use an initial velocity. This velocity is then "divided" into horizontal velocity (Vh) and vertical velocity (Vv).
Here's a little image that shows how to do that:

So, if you know about sines and cosines, you know that they have the same value at 45 degrees, so if you wanted your vertical and horizontal velocities to be equal, the angle would have to be 45 degrees. Anyway, back to the game...

If this were a 2D game, we would be done there, however, this is a 3D game! Which means, we not only move in the X and Y axes (yes, that's the plural of "axis"). We use the Z axis as well.
So, we need to find out how much to move in the Z and in the X depending on the horizontal velocity and the orientation of the player.

The player has its own matrix. Matrices store rotation, translation and scale of an object.
In this case, we're interested in the player's rotation.
To explain it simply, a player will have its own X, Y and Z axes. So, when he rotates around one axis, the direction of the other two is altered.
So, we only need to get the angle in which every axis of the player's matrix!

However, since we won't only be moving on a plain, it means we will also be standing at angles, which means we have another issue which affects the movement in all three axes (instead of just the Y axis)... This is called "gravity".
And I will talk about this in the next post. Stay tuned!

Monday, March 29, 2010

In a world...

My name is Miguel Casillas and I'm a Game Programmer.

This blog was created to talk about my contributions in my Final Project in my Bachelor of Science degree. A game called Speckt.

In this game, the player controls a small, flea sized robot, who needs to jump around on huge creatures and complete different challenges.

I will talk about my tasks in this game and I will give explanations so that those who don't really know programming can hopefully learn a couple of things as well. If you guys behave, I will post images too. Just remember, if you're a programmer: this project is done in DirectX, so we will be using a left-handed coordinate system, so if you want to use the formulas I put in OpenGL, you will have to do some tweaking when dealing with the Z axis.

Follow me in this ADVENTURE, it's gonna be awesome!