Assertion Failed?

edited May 2012 in Help request
I'm finally on Grey's fourth tutorial and everything was going well (for a change :P) and then when I try to run the program I get this message:
Assertion failed!

Program: C:ORX TutorialsinFirstProject_d.exe
File: ....srcCollisionShapes2PolygonShape.cpp
Line: 137

Expression: edge.LengthSquared() > 1.192092896e-07F * 1.192092896e-07F

For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts

I couldn't find the documentation, can somebody please tell me what's going wrong?

Comments

  • edited May 2012
    Hiya Cactus :)

    Usually this error happens when you have an object with a "bad" collision box; -- and THAT only ever happens (in my experience) when you link to an incorrect image, or forget to link an image.

    At the top of that tutorial there is a link to a zip with two new files in it, can you please make sure you've got those?

    Hope that helps!
    - Grey.

    edit: this file (the zip is made with 7zip, if you have trouble opening it, let me know and I'll try to make a new one.)

    edit2: data/phys/wall.png and data/phys/box.png
  • edited May 2012
    Yeah, I can't open it, I have WinRAR. I do think that that's where my problem is. I only have the wall.png not the box.png files. :)
  • edited May 2012
    I added the file and I still get the same message. Not sure what's going on anymore...

    Somebody help me please!

    Also, Grey, you should put the source code for each tutorial up for download.
  • edited May 2012
    I believe Grey explained why he'd rather not upload the source on another thread on the forum. :)

    If you get the same message it means you still have a physics body with a zero size. Probably due to a missing texture or a wrong path. If you post an archive of your whole project I can have a look if you want.
  • edited May 2012
    How exactly do I post an archive? Is there an option to just attach a file?
  • edited May 2012
    hi again guys,

    Firstly; I don't post complete source for each of my tutorials, because the intent is to get people learning :) -- Those experienced programmers will likely be able to learn what they need to from my tutorials without the final source (I try hard to explain the whats and whys for just this reason.) and it also avoids the temptation for others to just "cheat" and download the source -- which doesn't really help anyone in the end. (edit: I have done this in the past, and I learned considerably less at the time because of this; not making accusations or anything, just trying [in my own way] to help others ^_^)

    Cactus, that error, as Iarwain has said, is a problem of a physics body with a size of zero. Did you have trouble with any of the other zip files? I've made a new file with all the needed images inside, here, I'd also -highly- recommend grabbing 7Zip (it's free!) but obviously that's up to you. :)

    As for posting an archive; you can put it on drop-box or something, anywhere really, then use
    [url=someaddress]linkname[/url]
    
    example from above:
    [url=http://grey.orx-project.org/tutorial_data/data.zip]here[/url]
    
    or if you'd like you can email me the file directly ( the.grey.1 [at] gmail.com ) and I'll take a look as soon as I've some free time. (or post it here for others to look at too if that's easier.)

    Hope that helps :)
    - Grey.
  • edited May 2012
    Hi Cactus,

    I've just looked through your files;

    This appears to be the reason for your assert:

    Interaction.ini
    Texture = C:ORX TutorialsFirstProjectdataphyswall.pngwall.png
    

    Give that a fix and see what happens. (there is no 'wall.png' folder :) )

    - Grey.

    edit: Also, make sure you read your console output. You would have been getting a warning in the console telling you that a texture was not found, or failed to load etc. That could have helped you find the problem too. :)
  • edited May 2012
    Thanks Grey, it works now, there's only one problem. When I run it the horizontal boxes don't go all the way across the window. There's two at the top and two at the bottom, in the middle. As in:

    [][]
    []
    []
    []
    []
    []
    []
    []
    []
    []
    []
    [][]
  • edited May 2012
    If you use the [ code ] and [ / code ] tags it won't strip out the spaces in your posts.

    as for the problem, you've done some copy/pasting without reading ;) --

    HorizontalWallGraphic -- you've got two copies of the 'repeat' variable. Try having only one :)
  • edited May 2012
    /Embarrassed :P

    Thanks for all the help Grey! It works now, I think my biggest problem is me going too fast. Thanks again!

    --Connor
  • edited May 2012
    Aw man! Why must I have so many problems! xD

    Ok, hopefully last one.

    I'm at:
    case orxINPUT_EVENT_ON:
    {
    	if( orxInput_IsActive( "SpawnBox" ) )
    		orxObject_CreateFromConfig( "DynamicBox" );
     
    	EventAct = "pressed down";
    	break;
    }
    

    and when I build I get:
    1>c:orx tutorialsfirstprojectsourcestandalone.cpp(226): error C2196: case value '0' already used
    1>c:orx tutorialsfirstprojectsourcestandalone.cpp(231): error C2065: 'EventAct' : undeclared identifier
    

    I placed the code underneath

    case orxEVENT_TYPE_PHYSICS:

    and within the

    switch(currentEvent->eType)

    Any help please? :P
  • edited May 2012
    Waiting on a phone call so might have to get back to you afterwards - but first thing to check: make sure you've not put it inside the 'case' brackets.
    case orxEvent_Type_Physics:
    {
      //stuff here
      break;
      // make sure your code is not here
    }
      // instead make sure it's here! :)
    


    edit: IGNORE ALL OF THE ABOVE! :)

    I've just looked through your code again, you seem to have missed a step earlier in tutorial 4, where you add in input events!

    Do a search for "case orxEVENT_TYPE_INPUT" in the tutorial and you should see some code dealing with pressing buttons on/off. You'll need to implement that, and then make the changes further down in the tutorial (the ones you were just trying to make.)
  • edited May 2012
    Thanks Grey! You narrowed it down to one error

    orxINPUT_EVENT_ON:

    I still get an error with that.
    1>c:orx tutorialsfirstprojectsourcestandalone.cpp(231): error C2196: case value '0' already used
    
  • edited May 2012
    orxINPUT_EVENT_ON == 0, so in a switch statement, you must have it twice. Something like this:
    switch (evt)
    {
    case orxINPUT_EVENT_ON:
      ...
      break;
    case orxINPUT_EVENT_ON:
      ...
    }
    
  • edited May 2012
    Unfortunately that's not the answer, I found another case that equals 0, case orxEVENT_TYPE_ANIM:
    So those two have the same value. How exactly would I change that?
  • edited May 2012
    One is an event type (orxEVENT_TYPE_ANIM) and the other is an event ID (orxINPUT_EVENT_ON).

    They should not be used in the same switch statement at all: switch(_pstEvent->eID) != switch(_pstEvent->eType) or all hell will break loose. :)
  • edited May 2012
    Heya Cactus,

    I've tweaked the tutorial dealing with that specific event handler change; please take a look at this section again. :)

    Good luck!
  • edited May 2012
    I changed what you said to and now I get six errors! :D Fortunately most are the same, so that's good, however I've looked at them and don't know how to fix them.

    [code]

    1>c:orx tutorialsfirstprojectsourcestandalone.cpp(194): error C2360: initialization of 'EventPayload' is skipped by 'case' label
    1> c:orx tutorialsfirstprojectsourcestandalone.cpp(185) : see declaration of 'EventPayload'
    1>c:orx tutorialsfirstprojectsourcestandalone.cpp(223): error C2360: initialization of 'ObjectName' is skipped by 'case' label
    1> c:orx tutorialsfirstprojectsourcestandalone.cpp(189) : see declaration of 'ObjectName'
    1>c:orx tutorialsfirstprojectsourcestandalone.cpp(223): error C2360: initialization of 'EventPayload' is skipped by 'case' label
    1> c:orx tutorialsfirstprojectsourcestandalone.cpp(185) : see declaration of 'EventPayload'
    1>c:orx tutorialsfirstprojectsourcestandalone.cpp(242): fatal error C1075: end of file found before the left brace '{' at 'c:orx tutorialsfirstprojectsourcestandalone.cpp(175)' was matched
    [/code]

    How do you initialize the, pointers? I would have done that on my own but I'm not really sure how.

    Sorry if I'm being a bother. =","BBCode
  • edited May 2012
    Hey no worries.

    Though those are pretty basic C errors and I'd recommend following some tutorials/reading some C books in order to learn how to deal with them.

    The last error tells you that you didn't close a curly bracket correctly and former ones mean that you didn't write your case statements correctly with respect to local variables initialization.

    Good luck! :)
  • edited May 2012
    Hmm, I've spent quite a bit of time looking at the errors and thinking of different ways to fix it, but I'm afraid that I can't figure it out. I checked and I did put a bracket at the end of each and every function. And I don't see what is wrong with the declarations.

    Programming, I love it and hate it. o.0
  • edited May 2012
    Show us your current code file, between all of us I'm sure we can figure it out. ;)
  • edited May 2012
    I don't have msvs 2010, so I can't compile your project but my money is on your first case statement (lines 182-192).

    It's missing a closing } and a break; statement at the very minimum.

    It's probably missing much more if I judge by the its last line being a variable definition without initialization (and all former initialized variables aren't also used). ;)
  • edited May 2012
    Ah, problem solved, thanks Iarwain. :-)
  • edited May 2012
    No problem! Hope things will get smoother for you in the future. :)
Sign In or Register to comment.