Looking for some help debugging my bullets

Started by
4 comments, last by Balaam 17 years, 4 months ago
I'm writing a small FPS style game and I've gotten on to the shooting. Unfortunately my bullets aren't working correctly. But I can't think what to check. I'm sure I'm giving them the same direction as my player is facing. The view vector that I'm plugging into gluLookAt. The only difference is I normalize it first. Currently I've got the bullets with zero velocity as big sphere, and they have line showing their direction - it doesn't match up at all! It's not random but it's wrong. It's off center and sometimes nearly backwards. Is there anything stupid I'm missing? Or what should I be checking? Thanks for any help.

I'm writing a book about How To Make An RPG, check it out! | Blog

Advertisement
Write a unit test which identifes the observed incorrect behavior. Then, write unit tests for the intermediary steps of your computation, determine which step goes wrong, and recursively write smaller tests until you've found out where your error is.

Then, keep the unit tests handy in case something else goes wrong.
I would love something like Nunit for C++.

I think a lot of ths stuff is happening with me passing stuff to the OpenGL api and I don't really want to attempt to emulate the API to make sure everything's ok :D It's really something I can only check with my eyes.

At the moment it seems I'm not actually facing the direction that is given in the _view vector and passed to gluLookAt. So perhaps I'm altering the scene further up.

I'm writing a book about How To Make An RPG, check it out! | Blog

Quote:Original post by Balaam
I think a lot of ths stuff is happening with me passing stuff to the OpenGL api and I don't really want to attempt to emulate the API to make sure everything's ok :D It's really something I can only check with my eyes.


If that's the case, then your program has a very bad design, which will only cause more and more problems as time passes. I suggest that you correct this problem before moving on. Ideally, you want as little coupling with OpenGL as can be, to make debugging and testing possible.

Of course the view component of gluLookAt isn't vector, it's a point, hence why I'm retarded and my solution - thanks for the help :D

I'm writing a book about How To Make An RPG, check it out! | Blog

I thinks it's very hard to do test cases for stuff like an API, hardware, file access etc. There was a interesting discussion about this on the Sweng Gamedev list about this http://lists.midnightryder.com/pipermail/sweng-gamedev-midnightryder.com/2006-November/006225.html

In this case unit testing would not have solved my problem or pin pointed it, as it was a fundemental misunderstanding of the API I was using.

I'm writing a book about How To Make An RPG, check it out! | Blog

This topic is closed to new replies.

Advertisement