Skip to main content
gamedev.net
🔒 Locked

SetTimer problems under XP

Started by Pike65 1 reply 700+ views
Original Post
Pike65
Pike65
My game is currently using SetTimer to run all of the time dependant operations, and everything runs fine under Win2k, but chugs seriously under XP (about half the speed). Is this some kind of known problem, or has my code broken it in some other places? (Totally possible - it''s a hack of a hack of a hack) From what I''ve seen no one else seems to use SetTimer in their code, as well. Is this generally a bad idea?
S1CA
S1CA
SetTimer() means your program gets WM_TIMER windows messages.

These messages are lower priority than most other messages (such as those for mouse movement etc).

That means that messages with a higher priority always take precedence in the message queue for your window (i.e. a mouse message will "jump the queue" and push your WM_TIMER message to the back).

This means that the more "other" messages your application is recieving, the lower the priority consideration your timer messages will get, so they may take a lot longer to "arrive" at your program than you hoped.

WM_TIMER is the least precise way of doing timing. You shouldn''t really use it for anything that NEEDS precise updates (such as animation in a game). I''d only really use it for doing things like updating low importance animations in a Windows application (stuff like the animation you get when a file is downloading - unlike a game, you don''t care if the animation stutters or slows down because it''s not the main focus of what you''re doing).

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Pike65
Pike65
Awesome, that''s all I needed to know ; )

Thanks a lot.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.