Opened 17 years ago

Closed 17 years ago

#3369 closed defect (fixed)

GOB: Unnecessary slowdown on slow computers

Reported by: SF/uweryssel Owned by: DrMcCoy
Priority: normal Component: Engine: Gob
Version: Keywords:
Cc: Game: Gobliiins

Description

During testing of my AmigaOS 3 port of version 0.10.0 I've detected that Gobliiins is ca. 50 % slower than in the MacOS version: In MacOS version the character needs for a certain distance 4.7 seconds, in my port it needs 7.5 seconds.

Although the Amiga port runs only on a M68060/50MHz this slowdown of this quite old game could not accepted. So I looked into the source code and made same tests, and I found the slowdown "bug":

In engines/gob/game_v1.cpp function Game_v1::collisionsBlock line 914 a delta time is calculated using a cycle time (normally 80 ms) minus a measured time (in my case 40 ms on average). This delta time is used to process the user inputs (in my case 80-40 = 40 ms). After that the screen is updated (copyRectToScreen and updateScreen) and needs more 30-40 ms. This high drawing time results from the full screen redraws. The auto computing of the changed parts cannot save time, because of the high checksum calculation runtime.

So one cycle is 40 + 40 + ~40 ms = ~120 ms (instead of 80 ms). That's the 50 % increase. If I switch the game to fast mode (Ctrl-F) I get the above mentioned ~5 seconds. This is because the above measures time span of 40 ms is doubled to 80 ms and the delta time is therefore decreased to almost zero.

To get the right cycle time the drawing time have to be measured, too.

Ticket imported from: #1767748. Ticket imported from: bugs/3369.

Change History (6)

comment:1 by DrMcCoy, 17 years ago

Owner: set to DrMcCoy

comment:2 by DrMcCoy, 17 years ago

I commited a possible fix to the repository. Could you please retry with the latest SVN version / next daily build?

comment:3 by DrMcCoy, 17 years ago

Heh, please ignore the "next daily build" part (I just start thinking before writing stock phrases next time ^^;) and try with a latest SVN checkout/update.

comment:4 by SF/uweryssel, 17 years ago

deltaTime = timeVal - ((_vm->_util->getTimeKey() - timeKey) - _vm->_video->_lastRetraceLength); should be deltaTime = timeVal - ((_vm->_util->getTimeKey() - timeKey) + _vm->_video->_lastRetraceLength);

But it seems that more time is taken inside the checkCollisions call on line 828. This call needs almost constantly 60 ms (deltaTime = 2) compared to 20 ms of drawing. So 40 ms have to be added. I've moved the timeKey setting from line 900 to 801 (right after the "do" line) and removed the lastTraceLength stuff. So I get cycle times between 90 and 110 ms (60 ms + 30-50ms between line 900 and 912).

Perhaps the times should be measured on a faster computer, too, to see if the checkCollisions call time is negligible.

comment:5 by fingolfin, 17 years ago

Summary: Gobliiins is not fast as it can be on slow computersGOB: Unnecessary slowdown on slow computers

comment:6 by DrMcCoy, 17 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.