Sign in to follow this  
Balaam

Looking for some help debugging my bullets

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this