AGS games run slow?

Ask for help with ScummVM problems

Moderator: ScummVM Team

Post Reply
bliznik
Posts: 12
Joined: Tue Jan 26, 2021 5:55 pm

AGS games run slow?

Post by bliznik »

So I just found out that ScummVM is capable of running AGS games, like the AGD Interactive version of QFG2 and Heroine's Quest.

I personally really love the option of running games using the HQ filter, so would love to play these games using ScummVM.

However, the speed of these games is extremely slow. Painfully slow. Has anyone figured out a reason for this? Are there settings that I can tweak or change to see if they would affect the speed at all? Usually, these types of speed issues can be resolved by altering the graphics settings, but no matter if I use the best or the worst graphics settings, the speed of the game is extremely slow compared to other games, like QFG4 or even Ultima VIII: Pagan.
User avatar
criezy
ScummVM Developer
Posts: 810
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: AGS games run slow?

Post by criezy »

We are aware that the AGS engine in ScummVM is slower than the original AGS, and hopefully we can find some ways to speed it up.
Most games work fine for me though on a relatively low spec laptop, exceptions being games like The Cat Lady which is indeed painfully slow.

Are you using one of the daily build that we provide by any chance? I think those are compiled without optimizations, which will not help the performances.
If you are compiling ScummVM yourself, optimizations are also not enabled by default, but you can enable them with --enable-optimizations when running configure; or if you are using create_project and Visual Studio or Xcode you can set the compilation scheme to Release.
bliznik
Posts: 12
Joined: Tue Jan 26, 2021 5:55 pm

Re: AGS games run slow?

Post by bliznik »

Are you using one of the daily build that we provide by any chance? I think those are compiled without optimizations, which will not help the performances.
If you are compiling ScummVM yourself, optimizations are also not enabled by default, but you can enable them with --enable-optimizations when running configure; or if you are using create_project and Visual Studio or Xcode you can set the compilation scheme to Release.
Ohhh, that might be it! Yes, I'm using the daily build. I installed the official version 2.2.0, and I can't add AGS games to it, so it looks like in order to run AGS games I'll need to figure out how to compile ScummVM while enabling optimizations.

Thanks for your help! New project. ^_^
User avatar
daniele82
Posts: 115
Joined: Sun Nov 25, 2018 11:06 pm
Contact:

Re: AGS games run slow?

Post by daniele82 »

Hi!
I tried to test my first game.
The Fan Game - Back to the Future Part III: Timeline of Monkey Island
https://www.adventuregamestudio.co.uk/s ... ey-island/
It is very slow compared to other games.
Do you know why?
User avatar
dreammaster
ScummVM Developer
Posts: 477
Joined: Fri Nov 04, 2005 2:16 am
Location: San Jose, California, USA

Re: AGS games run slow?

Post by dreammaster »

daniele82 wrote: Tue Apr 13, 2021 11:45 am Do you know why?
My current hypothesis is that ScummVM is doing screen rendering too frequently & redundantly. In debug builds, the method calls to split up the RGB of each pixel is taking up time, whereas with release builds it's more optimized and less noticeable. More recent games that use 32-bit images are likely adding extra time on top of that to handle processing alpha transparency blending on each pixel being drawn, hence the tendency for newer games to run slower.

Looking into it further is on my TODO list.
User avatar
daniele82
Posts: 115
Joined: Sun Nov 25, 2018 11:06 pm
Contact:

Re: AGS games run slow?

Post by daniele82 »

dreammaster wrote: Tue Apr 13, 2021 3:59 pm
daniele82 wrote: Tue Apr 13, 2021 11:45 am Do you know why?
My current hypothesis is that ScummVM is doing screen rendering too frequently & redundantly. In debug builds, the method calls to split up the RGB of each pixel is taking up time, whereas with release builds it's more optimized and less noticeable. More recent games that use 32-bit images are likely adding extra time on top of that to handle processing alpha transparency blending on each pixel being drawn, hence the tendency for newer games to run slower.

Looking into it further is on my TODO list.
Thanks for your answer. we hope that in the future with a new version you will be able to solve the problem.
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3382
Joined: Mon Oct 31, 2005 7:39 am

Re: AGS games run slow?

Post by eriktorbjorn »

dreammaster wrote: Tue Apr 13, 2021 3:59 pm My current hypothesis is that ScummVM is doing screen rendering too frequently & redundantly. In debug builds, the method calls to split up the RGB of each pixel is taking up time, whereas with release builds it's more optimized and less noticeable.
Sounds reasonable. I played through the first puzzle and intro of Ben There Dan That with profiling enabled, and apparently this is where it spent most of the time:

Code: Select all

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self                 self     total           
 time   seconds   seconds       calls   s/call   s/call  name    
 24.77     47.27    47.27       82518     0.00     0.00  AGS3::BITMAP::draw(AGS3::BITMAP const*, Common::Rect const&, int, int, bool, bool, bool, int, int, int, int)
 17.45     80.56    33.29  3411064217     0.00     0.00  Graphics::PixelFormat::colorToARGB(unsigned int, unsigned char&, unsigned char&, unsigned char&, unsigned char&) const
 11.73    102.95    22.39 13640229055     0.00     0.00  Graphics::PixelFormat::expand(unsigned int, unsigned int)
 10.22    122.45    19.50  2937767983     0.00     0.00  Graphics::PixelFormat::ARGBToColor(unsigned char, unsigned char, unsigned char, unsigned char) const
  6.76    135.34    12.89   735978176     0.00     0.00  Graphics::ColorComponent<8>::expand(unsigned int)
  6.67    148.06    12.72  3349761236     0.00     0.00  AGS3::BITMAP::getColor(unsigned char const*, unsigned char) const
  4.94    157.49     9.43  2956442871     0.00     0.00  Common::Rect::width() const
  4.04    165.21     7.72  6814450448     0.00     0.00  Graphics::PixelFormat::aBits() const
  2.40    169.78     4.58  3411180805     0.00     0.00  Graphics::PixelFormat::gBits() const
  2.39    174.34     4.56  3410886397     0.00     0.00  Graphics::PixelFormat::bBits() const
  1.69    177.56     3.23   471831913     0.00     0.00  AGS3::BITMAP::rgbBlend(unsigned char, unsigned char, unsigned char, unsigned char&, unsigned char&, unsigned char&, unsigned int) const
  1.27    179.98     2.42  3411276882     0.00     0.00  Graphics::PixelFormat::rBits() const
User avatar
dreammaster
ScummVM Developer
Posts: 477
Joined: Fri Nov 04, 2005 2:16 am
Location: San Jose, California, USA

Re: AGS games run slow?

Post by dreammaster »

eriktorbjorn wrote: Wed Apr 14, 2021 5:16 am Sounds reasonable. I played through the first puzzle and intro of Ben There Dan That with profiling enabled, and apparently this is where it spent most of the time:
Thanks for the profile. It fits in with my hypothesis. I'll likely spend some time on the weekend investigating the slowness in more detail.
User avatar
sev
ScummVM Lead
Posts: 2096
Joined: Wed Sep 21, 2005 1:06 pm
Contact:

Re: AGS games run slow?

Post by sev »

This is exactly what was causing slowness in the HiDPI GUI. The solution is to write specialized routines as SDL does: https://github.com/SDL-mirror/SDL/blob/ ... ine.c#L775

This was my initial plan of addressing it, now went a bit lower in my TODO list, once immediate slowness of GUI was fixed.


Eugene
User avatar
daniele82
Posts: 115
Joined: Sun Nov 25, 2018 11:06 pm
Contact:

Re: AGS games run slow?

Post by daniele82 »

Many people are hoping that a new version will come out to eliminate the slow running problem of some AGS games. I hope so too. Thanks for your work.
:)
Post Reply