Community Reputation

About haxpor

For me, first full game is "Apollo 13". The name is just for eye-candy, it's 2d game. The concept is that you control the apollo 13, you must try to avoid the meteors coming all around the way as long as possible. Then you can grab the length of time you can be alive and compare with others. Thus a little longer of game-playing time can be achieved. I do it with Java at that time, but it's not difficult to do it with XNA.

You want to rotate those specific vectors right? Then, you can do this by using normal matrix rotation or you can find out about the quaternion used in the case of many axis rotate at the same time. For the normal matrix rotation, assume that following are the information you have [It's pseudocode] float rollAngle float yawAngle float pitchAngle vector3 position vector3 up vector3 forward You see that I have included the information about rotating angle at very top of the code, we will apply the rotation from these information in every update() function of our program. Note that in this case up is positive y-axis, forward is positive z-axis. Okay, it's more like we are the airplane, so let's assume that for the sample case we want to move in the new position and rotate the following steps, Keep in mind that we are the camera, we don't rotate all the world, but ourselves - move to position (5,10,0) - turn our airplane's head (forward vector) to the left for 30 degrees => thus yawAngle is ToRadians(30), which related to the rotation around y-axis. - turn our airplane's head up for 15 degrees => thus pitchAngle is ToRadians(15) , which related to the rotation around x-axis. - roll ourselves for -65 degrees => thus rollAngle is -ToRadians(65) Thus you first update your position and rotation angle before doing any transformation with matrix. - Update position by position = (5,10,0) *But if you apply the speed to move, then you might do this position += (1,0,0) This says you will move in the x-axis for 1 unit (depend on the direction to move), and update the the current position. - Update rotation by We all know the information of rotation, they are yawAngle = ToRadians(30), pitchAngle = ToRadians(15) rollAngle = -ToRadians(65) Then we apply the matrix transformation by //calculate the overall rotation matrix upfront matrix rotation = matrix.createRotationX(pitchAngle) * matrix.createRotationY(yawAngle) * matrix.createRotationZ(rollAngle) //transform the up-vector vector3 unitUp = new vector3(0,1,0) up = vector3.Transform(unitUp,rotation) In which vector3.Transfrom() is the function that will receive vector3 as input and transform it with the rotation matrix. In face behind the scene, that function will create the homogeneous matrix from the input 'vector3' and then multiply with the rotation matrix (which the rotation matrix created upfront is homogeneous matrix already). See homogeneous matrix for more information, but for short homogeneous matrix is 4x4 matrix, created to workaround the problem to include all the translation and rotation in just one place, and to be applied with others. Next, you do the same for forward vector vector3 forwardUnit = vector3(0,0,1) forward = vector3.Transform(forwardUnit, rotation); That's it, you're done. So you can use those up-vector, forward-vector to create your camera's view matrix and projection matrix and use in your app. It's quite long post here, sorry for that.

You're right about first looking at c++ language itself. But in some case that you're not build the engine from scratch by yourself, then you want some speed from the manage language, so c# would be more flexible and robust. Anyway I faced with myself the problem that I really need the low-level, so I ask myself should I go away from c# to c++, but after I read this thread, hooh god!!, I forget about dll we can link between. That's great solution. NOTE: For one thing that I really need in xna is about model animation, I have a little about how to write our apps about this, but at the past I have a skim look at the tiny animation sample, and it's quite rock!!! May be I should write the animation library with C++ and call it from C#. Any suggestion on model animation (Not separate meshes, but something like skinning human's walking, something like that). Thanks

It's no need to spawn the new thread for the new client, you can do all of that in one thread that handle all the client data. But it's some kind of pros-and-cons here between the two. If you spawn the thread, it's clean and nice to do but with the limitation of thread can be spawned on such system (game server), and it will comsume more memory. If you do it all in one thread, the time-sharing to give for all clients to update their stuff is concerned, and the algorithm there should be careful done. Nevertheless if the game is not too large, I prefer using spawn the new threads due to it's likely to be implemented in short time.

Maybe you can try to look at this one 'Developing Games in Java, by David Backeen'. This book is divided into 2 big parts, 2d stuff and 3d stuff. Along the way you learn up from the ground, this book teach you to create your game engine. I think it is very that you try to create your own engine first, just before look to use other ones. :)