|
-
Sep 21st, 2021, 02:41 PM
#5
Re: Timed Loops to Simulate Hertz
I have a managed game loop timer codebank submission here: https://www.vbforums.com/showthread....aged-Game-Loop (this was written 7 years ago, might qualify for optimization).
It also leverages QueryPerformanceCounters and QueryPerformanceFrequency, but the frequency is not a perfect 16.6ms elapse rate. It is usually off by a couple of couple hundreth to sometimes a full millisecond. I could never get it to consistently tick at 16.6ms and eventually gave up.
My conclusion was that this was a limitation of VB.NET being a higher level programming language and WinForm technology being antiquated. I could be completely wrong, but I do remember spending significant time on trying to get this resolve only to come up short.
Edit - Looking a little bit more, it seems as though QueryInteruptTimePrecise (documentation, only available Windows 10) may be more precise than QueryPerformanceCounters: https://docs.microsoft.com/en-us/win...on-time-stamps
Last edited by dday9; Sep 21st, 2021 at 02:47 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|