Rattlesnake's Tail (Distortion and Shaking of Moved Objects)

0 favourites
  • 8 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Problem Description

    ____ Depends on object's speed - with a time it will shake like rattlesnake's tail and have some sort of distortion____

    Attach a Capx

    ____ Here It Is ____

    Description of Capx

    ____ Astronaut tied to a rope launching into space____

    "Q" and "E" - rotate object

    If "W" is down - speed is equal to 9999999

    If "S" is down - speed is equal to 100

    If "W" & "S" is not down - speed is equal to 0

    Some screens:

    Steps to Reproduce Bug

    • Speed up the rocket and watch

    Observed Result

    ____ Growing of distortion depends on object's speed, but this problem will appear anyway. It's not a matter of scrolling as was my first thought. Behavior also have nothing to do with it.

    If object's speed will be equal to 0 then object will stop to shake, but you'll see the distortion. It will start shake with the same intensity (But may be slower) if you start to move object again ____

    This problem may appear in anyone's project if someone will play it for quite some time.

    Wouldn't be a problem for me If I'd wanted to make a game about astronaut that launching into space.

    Updated (31.12.15)***

    Desperately I tried to test this problem on Construct Classic. And there is no such thing. Of course, when speed is devilish huge (99999999 in Custom Movement) it will appear, but somewhy just for a seconds.

    And just shaking. No distortion.

    Now I'm asking myself "Should I move my project to CC?".

    ___________________________________________________________

    Expected Result

    ____ Surely I don't want to see any kind of distortion and shaking ____

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)
    • NW.js [Desktop]: (YES)

    Operating System and Service Pack

    ____ Windows 7 Maximum 64-bit (6.1, 7601) ____

    Construct 2 Version ID

    ____ Release r216 (64-bit) ____

    Hey, lads. I wish everyone a Happy New Year! All best to Scirra Team and thank you guys for awesome work that you do. I'm really looking forward to see Construct 3 in upcoming 2016.

  • Well I moved my work to Classic and currently enjoy this good old engine that I know very-very well and for a long time.

    The only thing I currently can't be happy about - it's no ways to export my project to something aside from Desktop in Classic, but again the same thing for Construct 2 (Don't count Wii U)

    And also stamp on multiplayer elements, but that's okay.

    Anyway I still think CC and C2 are both great engines and can serve good to anyone with hands (and sometimes even without them), but for a little different purposes.

    I hope Scirra Team will take some good focus on Desktop (Maybe other platforms like Xbox One) and on implementing 3D/2D elements in Construct 3.

    Positively gonna buy the engine even If I won't make my game on it.

    Happy New Year to Everyone!

  • I haven't had a chance to run the capx but just to hazard a guess you're probably running into a percision limit for floating point numbers. Aka after a point tiny changes to giant numbers are rounded off. A Google search for the details of floating point numbers will give lots of interesting stuff on the subject. Typically space games or game with huge worlds like minecraft work around this keeping numbers closer to zero and shifting the position of stuff around. In the case of your super high speed I'd just scale all the numbers down. I mean speed is relative and you don't need to use actual units.

  • R0J0hound Thanks for your reply.

    I don't need high speed at all. High speed only makes this bug to appear faster, but i'll appear anyway.

    Keep numbers to zero it's a good advice, but I still have to design locations and make scenes somehow.

    I'm not sure that's minecraft working in way of spaceship games. That's more like they destroying and recreating objects on the way.

    Just like in big games as GTA, AC, Bloodborne, Witcher 3 and so on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I didn't mean those games specifically, I just mentioned them because they run into the issue with floating point numbers.

    Basically floating point numbers are stored like this fo example:

    1.234 *10^10

    Two numbers are stored. The significant digits and the exponent.

    So just for example say it only has 4 significant digits and a two digit exponent you could represent various numbers like this:

    10 = 1.000*10^01

    192 = 1.920*10^02

    1,000,000,000 = 1.000*10^09

    Etc.

    The result is you can represent a wide range of values but the limitation is the numbers further from zero are further apart. Or in other words, there are more values closer to zero.

    For example take 10,000

    1.000*10^04

    The next higher number is 10,010

    1.001*10^04

    So with a number that big the closest another different number can be is 10 away. And the distance only increases with bigger numbers.

    Now the actual floating point format uses 15-17 significant digits, but in a similar way the differences from one number to the next increases at extremes.

    To fix the object distortion subtract the ships position from everything to shift toward zero so the the corners of the object's quad can be placed with higher percision.

    As your ship nears the edge of the Galaxy (maximum 64bit floating point number) you'll run into another similar issue. The ship with no longer be able to move by small steps, instead it will jump by larger and larger steps until either a position of infinity is reached or the step exceeds the velocity, at which point the ship will stop moving.

  • R0J0hound It works. Will keep it all in mind from now on.

    Tho I should stay on Classic.

    As my game is in Top Down perspective I found 3D elements very important and even without them - there is many good things in this good old engine that's somewhy C2 don't include.

    Thanks for a really useful information, R0J0hound

  • This is a variant of "Expecting math calculations to be exact" in common mis-used events and gotchas. R0J0hound is right that you are running in to the precision limits of floating point numbers on computers, so closing as won't fix.

    You only need to hold down W for a short while to get 100,000,000 pixels away. Internally the engine stores positions as double-precision floats, which have integer precision up to 2^53 (= 9007199254740992). However for performance reasons the renderer uses single-precision floats, since this uses half the memory bandwidth, is faster to process, and is still perfectly suitable for virtually all realistic uses. This means when it comes to draw the object it only has integer precision up to 2^23, which is 8,388,608. Basically beyond that point there will be rounding due to the limited precision, and the further you go the more severe the rounding is, which appears as the object shaking as it goes further.

    Making the renderer use full double-precision floats would cause all games to take a performance hit. This is a really extreme example which it should be easy to work around: you don't really need to move the object that far, you can do a lot with just faking it (e.g. not actually scrolling but showing stars in the background shooting past really fast, or something similar). As far as I can tell from a quick glance at the source, CC also used single-precision floats in its renderer, so ought to be subject to the same problem, but maybe I forgot some aspect of the renderer that uses better precision. CC is officially retired and hasn't been updated for years though, so I would say don't even consider it!

  • Ashley Thanks much for your reply.

    I didn't expected any kind of fix and only looked for an explanation to open my eyes on the subject. Which I did with Your's and R0J0hound's help.

    CC has this problem as well, but it's appears only on around 10 million pixels away from zero and only for a while. So not bothers me at all.

    I also think 8Direction behavior there is better then in C2 as you can easily change direction of your movement to any angle. Which you somewhy can't do in C2.

    If you'll add something like these in upcoming versions that would be awesome.

    My game is not about spaceships. It's about sea vessels and characters on them. So I'm not sure zero scrolling will help, but will certainly try to came up with something.

    3Dbox and Z elevation holding me really tight to CC. It's making my Top-Down game look a lot more better.

    Tho I can achieve it in C2 if I do some "dark rituals" with Q3D plugin.

    Currently I will work on versions of the game on both engines until I decide which one is the best instrument to make my project come to live.

    Thanks everyone!

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