Help with a First Person Shooter engine!!!!!!!!!!!!

Ok, first let me thank you for taking your time and helping me, i am 17 years, and just started to understand DirectX.

I have been building up online shooter for quite along time now, but I have two main problems:

1) I don't know how to make my mouse rotate the Camera in X and at the save time move it (the camera), to give the person the classical feel it him in that game. I mean, i know Direct Input and all, but all the matrix operation I have think of are useless. And I have tried to do something like this:

GraphDevice.Transform.View = Matrix.Multiply(Matrix.RotationY(-MousePos.X), Matrix.LookAtLH(New Vector3(-CameraPos.X, CameraPos.Y, CameraPos.Z),New Vector3(-CameraPos.X, CameraPos.Y, CameraPos.Z - Dif),New Vector3(0, 1, 0)))

I now that I am not taking care of the X axis right now, but atleast I wanted my "view" to rotate in Y.... But it does not work! If i get far from where my camera starts, the whole world starts rotating but taking my initial position as a Rotation center, witch is useless to me.

If I am not clear please let me now.

2) I just wanted to know how to add Cell-Shading to my game. I now how to use high shader lenguaje, but DirectX does not come with it, can you please help?

Again, thanks alot!!!!

[1520 byte] By [DarkRathamantis] at [2007-12-26]
# 1
hi, for the first question try this:

assume that the view target is 0,0,1 + your camera position...
then create a float to hold the camera rotation...
now use : view target = Vector3(Cos(rotation), 0, Sin(rotation)) + camera position.
now is just build the view matrix.

in the 2nd question:

create the effect.
Set all parameters : Matrices, Textures and other variables,
Set the Technique name(Effect.Technique), then:

int nPasses = Effect.Begin(Yor Shader Flags)

for(int cPass = 0; cPass < nPasses; cPass++)
{
Effect.BeginPass(cPass);
Render here all the objects with Cell Shading
Effect.EndPass();
}
Effect.End();

Key_46 at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 2
Thanks alot! Now with the code you gave me for my View MAtrix the only problem i have left is that my camera wont go where i am pointing at. Example: If I Point north, and press the up key it will go north, but if i point south, and I press the Up key it will go north! But other than that you code works perfectly well! Thanks!!!
DarkRathamantis at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 3

Hi

The following is the first article in a very good tutorial, it covers a lot about DirectX and the physics when creating a game
http://msdn.microsoft.com/coding4fun/gaming/arcade/article.aspx?articleid=938703&title=Beginning+Game+Development%3a+Part+I+%e2%80%93+Introduction

In about Article IV i think it covers the second problem you are having

In short what you want to do is get a Vector3 that represents the way you are pointing
The easiest way is extracting that from your View Matrix

Vector3 look = new Vector3();
_look.X = _viewMatrix.M13;
_look.Y = _viewMatrix.M23;
_look.Z = _viewMatrix.M33;

Then using that to move forwards

_position = _position + _look * units;

Note: The above example uses the Left Handed coordinate system

Chris

ChrisGunn at 2007-9-4 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...