Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 1 more developer from Canada and 12 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 19 Oct 2002
Offline Last Active Nov 18 2012 11:43 PM

#5002209 How do Rotation Matrix Work?

Posted by Beem on 18 November 2012 - 08:46 PM

I hate to be the bearer of bad news, but all you really need to know right now, is that nobody knows what the matrix is. If you multiply two of them together it catenates them and then both transformations will occur. The reason you can do this is because 4x4 matrix with multiplication and addition defined as we normally do form a ring. In a ring multiplication is associative, so it matters not which matrices gets multiplied when, but only that they are properly pre-multiplied or post-multiplied depending on what you want to accomplish. For now just follow the formulas that tell you how to form the matrix, where to put the cosine and sine of the angles, and you'll have to be careful about transposes, since some graphics libraries use row vectors and some use column vectors. With row vectors, you post multiply by the matrices, with column vectors you pre multiply them, and when you switch from one to the other you must transpose the matrices. This will potentially cause for the most confusion.

The best way to think of matrices as some kind of black box, a function, that takes a vector as an input and ouputs a vector that has been transformed. With 4x4 matrices, which is what he use in video games, because they allow us to use the magical homogenous transormation, the input will be a 4x1 vector. Just set the w component to 1 for positional transformations, and you're good to go. Don't worry about setting w to antyhing else.

Now the reason I said I had bad news, is because if you truly want to understand matrices, you got to go to college to learn about linear algebra. I'm sorry to say it, but without a strong mathematical background if you tried to just read about matrices you'd think they are just some mystical force in the universe that somehow just work. There are all sorts of interesting reasons why we can pull off what we do in video games using matrices, such as orthogonal transformations, and the like, but it really takes a strong mathematical background to get understand it.

I will say this, however, if you get a degree in mathematics, you can still get a job in video games, and also since you have a degree in math and not computer science, people won't ask you to fix their computers all the time cause they don't know you know about computers.

#5002067 Ideas for Lua integration in a game engine.

Posted by Beem on 18 November 2012 - 10:50 AM

I want to play devil's advocate with this post. Scripting sounds cool and all, but you are making asmall project, and you are going to find that going back in forth between scripting and getting the scripting to work with your engine, is going to be incredibly difficult and take a really long time, and you won't have anything worth showing anyone for a long time. I know a lot of people use Unreal, which is all about scripting, and so when it comes time to make your own engine, you're like "I want scripting, like Unreal". I think you should take a note from id Software, instead of using a scripting language, just use good old C++ and put your AI and game flow into a DLL file, then you just have to write some kind of SDK, a pure virtual class, or list of callback functions. It's going to save you a lot of headache, plus you will know exactly how memory is being managed.