Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: leafy on February 01, 2011, 01:52:24 am

Title: More accurate positioning
Post by: leafy on February 01, 2011, 01:52:24 am
I've noticed that in games like portal x position is calculated using the floor function of divison by a large number (256?) because if you just use integral increments you get choppy animations, like in my game.
So how does more accurate positioning work?
Title: Re: More accurate positioning
Post by: Builderboy on February 01, 2011, 02:06:27 am
Well Axe works in integers, so the decimal is not calculated and you are left with 1.  The concept is basically this:  You store the coordinates to a screen that is 256 times bigger than the calculator one, and when you display your character you zoom out by dividing by 256.  This means you have 65536x the positions of a normal screen, so you have much more precision.  Everything you do to the value now will have 1/256 as much effect.  Instead of adding 1, it will now be like adding 1/256 :)
Title: Re: More accurate positioning
Post by: yunhua98 on February 02, 2011, 05:33:46 pm
so this would be easier for Physics were things travel parabolically, I assume?
Title: Re: More accurate positioning
Post by: Compynerd255 on February 09, 2011, 10:29:42 am
Yes, this would allow you to create parabolas, as well as more natural, precise movement. The difficult thing about doing this, however, is simply remembering when to translate your coordinate system. For a simple 2D game, it's not that bad, but with a 3D (raycast, Mode 7) game, you would also be scaling when referencing your environment's tilemap.
Title: Re: More accurate positioning
Post by: Ashbad on February 09, 2011, 03:21:40 pm
yes, this is kinda what I am using in Colell ball toy.  except about only 64 times instead of 256.  It's actually quite effective :)