I am currently building a small 3D engine. And i was curious about what to base my engines timing on. The 2 ways i have come up with are these.
First way i thought about was to build 2 seperate pieces of my engine. The first would be JUST the visual things, running as fast as they can, to get the most FPS out of it. And everything else (sounds, collisions, state updates, etc) would be done in a seperate piece, that ONLY fired once every time interval. Problem with this is, I think that requires a fair knowledge of different OSs, and a fair knowledge about threading. I have neither. So doing that would require platform dependent code, and alot more work.
The other way, would to simply base EVERYTHING off of frame rate. Basicaly, i would draw my scene, do sounds, collision detection, input, etc; once per frame, then using glut timmer func, only call a glut post redisplay once every 1/60th of a second. Now I understand that this has 2 problems, first if the fps slow, then the animation will to, and second if the fps draw too fast, then the CPU is just waiting idle for a few milliseconds waiting for its next draw. But i think i could make a much more acurate collision detection, and physics engine doing it this way.
Any suggestions??



).
.