Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Programming running way too fast in WindowsXP. Posted by PP2005 on 4 Jul 2006 at 5:48 AM
I've made a program that I also want to be able to run in Windows and not just pure DOS. The problem is that the Delay() procedure isn't precise on fast machines, so the program runs way too fast. I've tried using alternatives to the standard Delay(), such as MilliDelay() found in the SDelay unit and the Wait() procedure, but it still runs too fast in WindowsXP. Why is that? The MilliDelay() procedure is supposed to be very precise... but it isn't in WindowsXP.

I've also used MoSlo to slow down the program. It does slow down the program enough for it to be usable, but the speed in the program isn't constant. As the program is a textmode arcade game, a constant speed is quite crucial -- otherwise it's pretty hard to control the game.

Any advice?
Report
Re: Programming running way too fast in WindowsXP. Posted by zibadian on 4 Jul 2006 at 9:43 AM
: I've made a program that I also want to be able to run in Windows and not just pure DOS. The problem is that the Delay() procedure isn't precise on fast machines, so the program runs way too fast. I've tried using alternatives to the standard Delay(), such as MilliDelay() found in the SDelay unit and the Wait() procedure, but it still runs too fast in WindowsXP. Why is that? The MilliDelay() procedure is supposed to be very precise... but it isn't in WindowsXP.
:
: I've also used MoSlo to slow down the program. It does slow down the program enough for it to be usable, but the speed in the program isn't constant. As the program is a textmode arcade game, a constant speed is quite crucial -- otherwise it's pretty hard to control the game.
:
: Any advice?
:
Perhaps the task-switching nature of the newer windows OSes throws off your game control. It might be that the precise implementation of the MilliDelay() might be dependent on the task-priority.
I would suggest that you port your game from DOS to windows. That way you can use the windows API to gain speed control.
Report
Re: Programming running way too fast in WindowsXP. Posted by PP2005 on 5 Jul 2006 at 12:31 AM
: :
: Perhaps the task-switching nature of the newer windows OSes throws off your game control. It might be that the precise implementation of the MilliDelay() might be dependent on the task-priority.
: I would suggest that you port your game from DOS to windows. That way you can use the windows API to gain speed control.
:


Thanks for your reply. I've downloaded FreePascal for Win32 so I can compile a Windows version of my game. I've done a few tests and they all seem to run the delays as they should.

I've run into a few problems, though. How do I set the screen size to 80x50 and not the standard 80x25? TextMode() doesn't work. I've looked for an answer on the FreePascal message boards, but nobody seems to have a simple solution.

Also, how do you hide the cursor in textmode in Win32? And how do you hide the mouse cursor?
Report
Re: Programming running way too fast in WindowsXP. Posted by PP2005 on 5 Jul 2006 at 6:58 AM
Nevermind. I'll use Virtual Pascal instead. :o)



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.