How does ScummVM determine the correct speed for a game?

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

Post Reply
feda
Got a warning
Posts: 9
Joined: Tue Aug 31, 2010 2:58 pm

How does ScummVM determine the correct speed for a game?

Post by feda »

How does ScummVM determine the correct speed for a game?
For example, how does it know how fast QFG4 is supposed to run? Is it just a guess?
User avatar
sev
ScummVM Lead
Posts: 2316
Joined: Wed Sep 21, 2005 1:06 pm
Contact:

Re: How does ScummVM determine the correct speed for a game?

Post by sev »

Just as the original was doing it. There are game scripts to rule the game speed.


Eugene
User avatar
criezy
ScummVM Developer
Posts: 980
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: How does ScummVM determine the correct speed for a game?

Post by criezy »

Or for some other games the speed is hardcoded directly in the game engine and not controlled by the game scripts. But in that case as well, we aim at reimplementing it in the same way as the original game did it (either based on the original source code if we have it, or based on reverse engineering of the original executable).

Drascula is one example of an engine using hardcoded animation speed. We actually had a bug report about the speed being wrong when compared to DosBOX (bug #7115: DRASCULA: FPS are incorrect or some frames are dropped). We have access to the original source code for this game, which helps to check the behaviour of the original executable (no reverse engineering needed!). In this case we could see that the original executable is using the 1Ah interrupt to control the speed of the animations. And knowing how this interrupt call works, we can replicate the same behaviour in ScummVM. There is some details on my commit to fix the aforementioned bug on how this is mapped to ScummVM and the remaining inaccuracy due to differences in implementation.
feda
Got a warning
Posts: 9
Joined: Tue Aug 31, 2010 2:58 pm

Re: How does ScummVM determine the correct speed for a game?

Post by feda »

So ScummVM does this not by changing the CPU cycles (like Dosbox), but by looking at each game's code?
User avatar
criezy
ScummVM Developer
Posts: 980
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: How does ScummVM determine the correct speed for a game?

Post by criezy »

That's correct. Unlike DOSBox, ScummVM is not an emulator, and thus there is no emulated CPU for which we could control the cycles. Instead ScummVM is a reimplementation of game executables for modern hardware.
Post Reply