Jump to content
  • Advertisement
Sign in to follow this  
_damN_

What could cause assertion failures

This topic is 3497 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im currently busy coding a small computer game simmilar to a space invaders type game. but when the player fires a bullet and it hits the top of the screen(Thats when the sprite must be killed), the programme crashes and gives me an assertion failure message? I cant seem to find why the game is doing that. So what could be causing this? Please help!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by _damN_
Im currently busy coding a small computer game simmilar to a space invaders type game. but when the player fires a bullet and it hits the top of the screen(Thats when the sprite must be killed), the programme crashes and gives me an assertion failure message? I cant seem to find why the game is doing that. So what could be causing this?

Please help!
It could be any one of a million things.

What does your Debugger tell you?

Share this post


Link to post
Share on other sites
The debugger doesnt say anything... The game runs. I just thought that there was a general reason for an assertion error to accur?!

Its when a bullet collides with the edge of the screen.

Share this post


Link to post
Share on other sites
It could be something like trying to dereference a NULL pointer (i.e. the bullet was removed, it's pointer set to NULL, but it's used elsewhere as well -- some place that checks for NULL pointer using an assert) or that perhaps you're drawing outside the screen and there's an assertion that checks whether you're drawing within bounds...

Generally, assertions are used to check for invalid input parameters to a function. If you're not doing that yourself, then it is in a library you're using. The most common cause for such things is memory corruption.

You're going to have to give some more information if you want more than general hints.

Share this post


Link to post
Share on other sites
Quote:
Original post by _damN_
The debugger doesnt say anything... The game runs. I just thought that there was a general reason for an assertion error to accur?!

Its when a bullet collides with the edge of the screen.
When you get the assertion, the debugger will break on the line that's causing it. You can then look up the call stack into your code and examine the contents of the variables to find out why the error occurs.

Share this post


Link to post
Share on other sites
Every tutorial site should make their second tutorial (after Hello World) a "basics of debugging" tutorial. Debugging is one part of programming that is pretty well completely ignored in academia (from a teaching standpoint anyways). I'm pretty sure I used to debug using printf statements when I was in my first year of university.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!