Menu

#3369 GOB: Unnecessary slowdown on slow computers

GOB: Gobliiins
closed-fixed
Graphics (902)
5
2013-11-17
2007-08-04
Uwe Ryssel
No

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.

Discussion

  • Sven Hesse

    Sven Hesse - 2007-08-04
    • assigned_to: nobody --> drmccoy
     
  • Sven Hesse

    Sven Hesse - 2007-08-05

    Logged In: YES
    user_id=556976
    Originator: NO

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

     
  • Sven Hesse

    Sven Hesse - 2007-08-05

    Logged In: YES
    user_id=556976
    Originator: NO

    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.

     
  • Uwe Ryssel

    Uwe Ryssel - 2007-08-07

    Logged In: YES
    user_id=836333
    Originator: YES

    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.

     
  • Max Horn

    Max Horn - 2007-08-11
    • summary: Gobliiins is not fast as it can be on slow computers --> GOB: Unnecessary slowdown on slow computers
     
  • Sven Hesse

    Sven Hesse - 2007-08-19
    • status: open --> closed-fixed
     
MongoDB Logo MongoDB