Archived

This topic is now archived and is closed to further replies.

Sardius2

Render/Input Manager

Recommended Posts

I have recently learned I cannot just render frames during idle time, and update input as often as I render, since the slower/faster the fps is, the slower/faster the movement is. Does anyone know of a good book/tutorial/website or anything that helps introduce to rendering and input managing? I would appreciate it.

Share this post


Link to post
Share on other sites
Well...

I use Visual Basic, and the method I''ve found for making the game run at a consistent rate is quite simple.

I presume that once a frame is rendered, you execute the game loop code? Well, put this into a separate Sub.

Now, what I do is to use the API call GetTickCount. This returns the number of "ticks" (miliseconds) since the PC powered up.

I also store the LAST tick count into a Long Integer as a backup.

Let''s say that you want to run the game loop every 15 miliseconds:


LastTickCount = GetTickCount ''(otherwise it''ll run VERY fast at the beginning)

Do
Render ''Render the 3D stuff

For x = 1 to (GetTickCount - LastTickCount) / 15
GameLoop ''Run the game code.
Next x
LastTickCount = GetTickCount

Loop

(I think that should work... well, it''s what I use...)
Play around with it!

Share this post


Link to post
Share on other sites