[iOS] Some polygons may crash the game [1.3.4]

x70x

  • *
  • Posts: 122
Hey there, I seem to be having a problem while running the game in xcode to test on my iPad. It begins to load the game and soon after it will crash with this error:

Assertion failed: (edge.LengthSquared() > 1.19209290e-7F * 1.19209290e-7F), function Set, file /Users/jon/Desktop/stencyl/plaf/ios/exporter/../physics/Box2D/Collision/Shapes/b2PolygonShape.cpp, line 137.

This appears to be an issue with the Box2D collision shape functions, but I have no idea how to fix it via Stencylworks. Do I have to go through all my actors and reset their collision boxes to see which one is causing the problem? Or is this a bug with the exporter since my game runs perfectly fine in Flash?

« Last Edit: December 17, 2011, 03:24:58 pm by Jon »

Jon

  • *
  • Posts: 17524
Ah, one thing you can't do yet is work with concave polygons in your non-terrain shapes.

x70x

  • *
  • Posts: 122
I have checked all of my actors and none of them have concave collision shapes. Is there any other reason why I might be getting this error?

Jon

  • *
  • Posts: 17524
Hmm, you are right - that isn't it.

Do you have a shape that's really, really small? That's the only other thing that comes to mind.

x70x

  • *
  • Posts: 122
yeah... I have a circle shape that has a radius of 4 and a laser with a collision box of 4x16... are those too small?

Jon

  • *
  • Posts: 17524
Shouldn't be too small - but could you narrow it down and let me know which of the two it is?

x70x

  • *
  • Posts: 122
So, I've deleted or changed any actor that has a collision shape with a less than 6px height or width... still getting the same error. Should I go a step further and not have any actors with 8px or less?

Jon

  • *
  • Posts: 17524
Weird - my reply never went through. I meant to say to e-mail me the game. One of us should be able to figure it out.

You shouldn't need to work with those restrictions - it's fixable.

x70x

  • *
  • Posts: 122
Thanks for your help. I'm currently away from my machine that I use for stencyl projects but I will send it to you sometime tomorrow. While this issue is being fixed maybe I will start on an entry for the winter game contest ;)

x70x

  • *
  • Posts: 122
I'm assuming your email is just jon[at]stencyl.com?

Jon

  • *
  • Posts: 17524
Yes, you can also e-mail the contact e-mails here, and those will route to me and 1-2 other people (Joe and Ceric). I prefer that for the times I'm not around, and those other 2 can get back to you in my absence.

http://www.stencyl.com/about/contactOther/

x70x

  • *
  • Posts: 122
I've sent the project folder to Jon and the webteam[at]stencyl.com address (is that the right one?)... anyways, I'm sure you are plenty busy with other things so no rush, but I was just wondering if anyone else has encountered this bug/error? Anyone besides Jon have suggestions for a fix or is it all related to the export process and not something I can fix on my own?

Also just want to say that I have been using Stencylworks for the last few months to teach a game design course and one of the student groups has already begun porting their game to iPad and it is working quite well. You have made an awesome product and thanks for your help!

Jon

  • *
  • Posts: 17524
I think I've seen it once and though we had it fixed. It, I think, was caused by integer division rounding down anything less than 10 to 0 - but more nuanced than that.

Jon

  • *
  • Posts: 17524
Turns out that the 5 sided shape was the cause. Not sure why, but in this instance, using 2 boxes for the collision shape was both more accurate and avoided the issue. I'll re-investigate why the shape crashed the game in the future.

Jon

  • *
  • Posts: 17524
Finally found the problem in which porting over the vertex direction checker function, which syntactically worked verbatim from AS3, was causing integer truncation and led to sides with 0 lengths.

I've also now re-enabled Add Polygon to the shapes page, now that this bug's been fixed, so it should now be safe to use polygon shapes for Actors in iOS games.