Wrong size while object moves at far far position

Bugs will be moved here once resolved.

Post » Tue Jun 07, 2016 9:50 am

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
B
108
S
26
G
267
Posts: 4,456
Reputation: 149,747

Post » Mon Jun 20, 2016 2:46 pm

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.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Mon Jun 20, 2016 3:36 pm

@Ashley

Thanks for replying. It might be better to have a tip to tell user that do not put object far far away.
B
108
S
26
G
267
Posts: 4,456
Reputation: 149,747


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 2 guests