About lag : I took a look at the game internals and here is what I found out :
- The game internal loop (which take care of updating life engine, input, physics, rendering, ...) is trying to target 70fps (and not 60fps as I thought). If it ran faster than this, the game will slow down to match that speed.
You can measure those FPS by using FRAPS and the technique I explained before (there is a free version on the official website). or this :
- As in most games, there is some internal mechanism that make sure player will run/rotate at same speed, regardless fps.
You can try it yourself easily : lower the number of cycles (Eg : 1000) check time needed to rotate OR to move player from on point to another : should be pretty similar regardless CPU cycles.
I am not sure how accurate it is. It might that implementation is not perfect and player still ran slightly slower when CPU is not fast enough.
Anyway, there is some actions which are not covered by this mechanism and which will make you lose some time :
- Switching between cameras.
- Switching between floors.
When one of those events occurs the game just freeze and all time spent is lost.
Try yourself with low cpu cycles and room viewer linked : start running from one place to another, when the camera is switching the player stop moving for a while and resume from where is was before the freeze.
The potential move that could have been done during the freeze is not recovered.
It seems playing some sounds also slow down the game (i'm not 100% sure about this)
One reason why room/camera switch is so slow is because all ressources are compressed inside PAK files. When camera is switching, it is like the game has to unzip an image from a zip file each time.
The game has very little memory available (640K) so once a ressource had been used, it is thrown away (and reloaded later if needed).
Also : what definitely slowdown the game (without impacting player speed) is the rendering. Once you have 2-3 enemies on the screen (like in the dining room) the FPS will go down.
- The game internal loop (which take care of updating life engine, input, physics, rendering, ...) is trying to target 70fps (and not 60fps as I thought). If it ran faster than this, the game will slow down to match that speed.
You can measure those FPS by using FRAPS and the technique I explained before (there is a free version on the official website). or this :
1) start CheatEngine.
2) Raise number of cycles to a high value (eg : 35000 cycles).
3) Search "70" (2 bytes value).
4) Lower cycles to 200.
5) Search "0" (2 bytes value)
6) Repeat 2-5 until one value only is found : this is the internal fps counter used by the game itself (very precise)
2) Raise number of cycles to a high value (eg : 35000 cycles).
3) Search "70" (2 bytes value).
4) Lower cycles to 200.
5) Search "0" (2 bytes value)
6) Repeat 2-5 until one value only is found : this is the internal fps counter used by the game itself (very precise)
- As in most games, there is some internal mechanism that make sure player will run/rotate at same speed, regardless fps.
You can try it yourself easily : lower the number of cycles (Eg : 1000) check time needed to rotate OR to move player from on point to another : should be pretty similar regardless CPU cycles.
I am not sure how accurate it is. It might that implementation is not perfect and player still ran slightly slower when CPU is not fast enough.
Anyway, there is some actions which are not covered by this mechanism and which will make you lose some time :
- Switching between cameras.
- Switching between floors.
When one of those events occurs the game just freeze and all time spent is lost.
Try yourself with low cpu cycles and room viewer linked : start running from one place to another, when the camera is switching the player stop moving for a while and resume from where is was before the freeze.
The potential move that could have been done during the freeze is not recovered.
It seems playing some sounds also slow down the game (i'm not 100% sure about this)
One reason why room/camera switch is so slow is because all ressources are compressed inside PAK files. When camera is switching, it is like the game has to unzip an image from a zip file each time.
The game has very little memory available (640K) so once a ressource had been used, it is thrown away (and reloaded later if needed).
Also : what definitely slowdown the game (without impacting player speed) is the rendering. Once you have 2-3 enemies on the screen (like in the dining room) the FPS will go down.