How It Is Running Faster?

Started by
4 comments, last by Spoonbender 18 years, 8 months ago
i have found that sometimes while playing a DOS game if you switch over to windows (using Alt-Tab) and then when come back to DOS game again, the game runs very fast!! There is no skipping of the frames but its runs in a normal way but faster!!. My question is how can i achieve this kind of speed in my current project, which is a DOS pacman game. I have read about system timer but the examples i have seen is talking about ajusting the frames depending about the speed of the computer and not really how to increase the processing speed WITHOUT SKIPPING FRAMES. Pramod
Advertisement
You'd have to explain how your currently implementing timing/input code... I maen if I just stuck some basic input code in my main loop that incremented my position by 1 each frame I would move very fast. Based on post history I'm assuming mode 13H which would mean about 320 pixels across for the whole screen. On a modern PC you should be able to render atleast 60 fps and at 1 pixel per frame that puts you at 5 seconds to cross the level... if you want to move faster than this you could move 2 pixels per frame.. etc etc.

Obviously this is a very simplistic method of movement/timing but I think it might be a helpful explaination (or atleast help you explain your actual problem more specifically).
The code is written in Turbo C v3.0 for mode 13h (300x200 pixels). The sprites move by one pixel either up or down. The flow of the code is as follows:

1. All calculations <- This goes through many calculations like collission detection, Array updation for sprites and sound support, Fonts functions, Keyboard inputs etc., which takes up considerable processing time.
That is the speed of the game depends actually on these calculation. But if i run this on a faster PC it would be a different speed. Don't know if Waiting for the Vertical Retrace is stripping down the speed.


2. Draw Sprites
3. Wait For Vertical Retrace
4. Erase Sprites
5. Go to 1.


NOW IS THERE ANY WAY TO INCREASE THE SPEED WITHOUT CHANGING THE FRAME.
Hardware acceleration would do the job, I don't know how to implement hardware acceleration with DOS however.
Quote:have found that sometimes while playing a DOS game if you switch over to windows (using Alt-Tab) and then when come back to DOS game again, the game runs very fast!

Some people would call that a feature, some people would blame microsoft, and I would call it a bug.
Quote:But if i run this on a faster PC it would be a different speed.

I would call that a bug too.
Quote:I have read about system timer but the examples i have seen is talking about ajusting the frames depending about the speed of the computer

Yes. Do it.
Quote:how to increase the processing speed WITHOUT SKIPPING FRAMES.


You mean you want to always move at 1 pixel per frame, but you want your code to do it faster by speeding up the processor? Well, certainly sir, and if you find a piece of software that can speed up the processor without overclocking it, I have a business proposition for you. Intel is going dooooown!
Quote:Original post by tppramod
i have found that sometimes while playing a DOS game if you switch over to windows (using Alt-Tab) and then when come back to DOS game again, the game runs very fast!! There is no skipping of the frames but its runs in a normal way but faster!!.

My question is how can i achieve this kind of speed in my current project, which is a DOS pacman game. I have read about system timer but the examples i have seen is talking about ajusting the frames depending about the speed of the computer and not really how to increase the processing speed WITHOUT SKIPPING FRAMES.


Pramod


Here's a secret for you. There is no magic inside the computer.
This also means, there is no way to increase processing speed, without physically increasing the speed of the processor.

What happens with Dos games under Windows is a very different thing. That's called bugs. It happens because the games were written for one ancient and simplistic OS, with clockspeeds in the 2-digit mhz range, and are suddenly made to run under one which insists on controlling every piece of hardware, and on a CPU measuring in the gigahertz.

But at a wild guess, I'd say you manage to disable vsync when you alt-tab. Again, under the circumstances, running a game on an OS it wasn't designed for, and on a CPU the programmer had never even dreamt possible, that behavior isn't too surprising.

This topic is closed to new replies.

Advertisement