Log In  

Just got the latest build, and switching to hardware sqrt causes a crash when the input is 0.

quick repro: open pico8, enter editor, type "sqrt(0)", press Ctrl-R to run.

P#11333 2015-06-19 16:22 ( Edited 2015-08-20 18:31)

There may be a few more cases than just zero. I get this crash just a few metres from the start line after using a wrapper to avoid exactly-0 values:

P#11334 2015-06-19 16:28 ( Edited 2015-06-19 20:28)

thanks, fixed for 0.1.2

sqrt() in 0.1.1 also fails for anything above or equal to 32761, so to workaround in a wrapper:

sqrt0 = sqrt
function sqrt(n)
  if (n <= 0) return 0
  if (n >= 32761) return 181.0
  return sqrt0(n)

This cart is looking ridiculously amazing! I imagine it works as a stress test on pico-8's limited number representation and math. Is there anything you found unreasonably difficult or impossible to work around?

P#11339 2015-06-19 23:10 ( Edited 2015-06-20 03:13)

I think that's why my game occasionally crashes! Cheers.

P#11340 2015-06-20 06:58 ( Edited 2015-06-20 10:58)

It's proven extremely difficult to work around the limited number size... I'm getting a ton of mystery overflows in my collision detection - which to solve I've had to limit the size of model triangles and butcher a few calculations with divisions.

I think things are working mostly correctly now, apart from a few mystery sticks on triangle corners. I've yet to check extensively for any extreme bugs in the latest pico8, but it looks like things are holding together apart from this.

P#11343 2015-06-20 14:47 ( Edited 2015-06-20 18:47)

Actually - I missed a few triangles.. I just got shunted to the wall you can see on the right that the 3 large cliff triangles end at. The level partitioning removes triangles that are too far away from the test point normally, but for triangles this big that doesn't happen.

And just as I say that... I fall through the bridge's edge, and then the floor below it. Looks like I have some work to do. :P

P#11344 2015-06-20 14:55 ( Edited 2015-06-20 18:55)

Oof, this, uh, yes. This is a thing that can happen it turns out, with the sqrt(0).

P#12823 2015-08-20 14:31 ( Edited 2015-08-20 18:31)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-06-05 06:00:33 | 0.006s | Q:18