HaxeFlixel / HaxeFlixel/flixel
Position jittering due to floating imprecision
Nobody has claimed this yet.
- Dominant language
- Haxe
- Stars
- 2.2k
- Forks
- 522
- Avg merge
- 34m
- Merged PRs (30d)
- 1
Description
There was a previous issue regarding this, though the fix then only hid the symptoms in the specific case identified (while also causing another issue).
See: https://dl.dropboxusercontent.com/u/28458706/RoundingDemo.swf
Code: http://pastebin.com/QgD4axRs
Press up and down to move the FlxSpriteGroup up and down at a rate of 0.3px per frame. Every now and again the sprites will split due to float imprecision.
I'm wondering if anything with a float position should round off negligible real parts when close to an integer? (For example, in set_x and set_y?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the split in the linked RoundingDemo.swf and reviewing the referenced code while moving a FlxSpriteGroup by 0.3px per frame. Then inspect the float-position handling, including the set_x and set_y locations mentioned in the issue. Done means the sprites no longer split from floating-point imprecision without repeating the earlier fix's side effect.
Written by the indexing model from the issue text.
Assessment
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100