CodeBase - REAL Timer based movement

Return to the CodeBase listing

Category: Math / Physics

Version: 1.0

0
0

Information

Uploaded: 15th Dec 2003 20:18

Modified: 15th Dec 2003 20:23

Author:  Jaze

Summary

REAL Timer based Movement Loop

Full Description

This simple little demo is the ground work I'm using for making timer() based movement in my games or whatever. Run the Snip, turn right a little - and see the white square slowly<br /> move away from the other squares. (Even when your framerate...like mine...was 300fps!!!)<br /> <br /> Extra work? Yes.. benefit? Same Gameply on any computer - and the better the machine - the smoother the GFX. (In my opinion)<br /> <br /> Some say 30fps or so is all human can see.... but slamming higher rates means your EYES can create the BLUR factor because your &quot;scene&quot; moves smooth.... can get &quot;blurs&quot; (according to your eyes) with this kind of set up... and its amazingly smooth.<br /> <br /> REMEMBER: The camera is there just as a quick way to navigate - the camera is not<br /> timer based in this example - though the structure is designed to handle moving cameras<br /> the same way it does objects so it could be made to move the same way the &quot;cube&quot; in this example does... by using the velocity amount. You'd just have to make a record in &quot;arR()&quot; that is iType=cnCamera - and set the camera id=0 for it to control the main one :)<br /> <br /> <br /> I didn't translate what VELOCITY means in metric - just how much to move per millisec - so depending on what you are &quot;creating&quot; the velocity that is appropriate for your project may be leaps and bounds different for another scene or project. Hope this is helpful. I saw another TIMER codebase entry that was nothing more than a HARDCODED delay - &quot;Don't do nothing until computer counts to 100....&quot; which will count to 100 faster on a fast machine and slower on a slow machine - hence - your game would appear to go as fast as computer wished - not how you wished it to behave. If you only care about running it on your own machine... than that kind of timer is fine I guess. IF you want people to try your stuff out and have it run the same to them as it does on your machine... well... This is the way to go.<br />

Comments

No comments yet.