Wrong size while object moves at far far position

0 favourites
  • 3 posts
From the Asset Store
Be quick and choose whether the shown equation is right or wrong.
  • Problem Description

    Wrong size while object moves at far far position

    Attach a Capx

    capx

    Description of Capx

    A sprite with bullet + scroll to behavior in a far far position (100000000, 100000000) -

    The size of sprite is changed/flashed in some ticks

    Steps to Reproduce Bug

    • run this capx ( in debug mode )
    • the size is changed/flashed some ticks
    • disable the event which sets the position
    • the sprite works correctly

    Observed Result

    the size is changed/flashed some ticks while the sprite is at far far position.

    Expected Result

    The size should not changed.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)

    Operating System and Service Pack

    window7 64 bits

    Construct 2 Version ID

    r229

  • I am pretty sure this is to do with floating point precision rather than being any kind of bug. All the code is totally agnostic about where objects are so there's really nothing special about it being further away, except floating point precision issues come in to play.

    I don't think it's changing size, it's just the Y position is randomly flickering up and down. This is probably because it is moving down with the bullet behavior, so it's doing y += 400 * dt where Y is an extremely large number, so this is relatively speaking making tiny adjustments to the number, likely significantly affected by rounding errors. The same errors affect the viewport positioning and rendering code.

    Actually I just remembered, the engine mostly uses double precision floats, but for performance the renderer uses single precision (32-bit) floats (since they are half as big). These only have integer accuracy up to 2^23, which is about 8.3 million. So at a position of 100 million, the engine has better accuracy than the renderer, so this is probably entirely cosmetic.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley

    Thanks for replying. It might be better to have a tip to tell user that do not put object far far away.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)