Opened 3 years ago

Last modified 12 months ago

#13412 new defect

AGS: Zniw Adventure - Sprites in ScummVM appear less sharp/fuzzier

Reported by: antoniou79 Owned by:
Priority: low Component: Engine: AGS
Version: Keywords: Zniw Adventure
Cc: Game:

Description (last modified by antoniou79)

This is tested on Windows 10 x64 21H2 (19044.1620) using ScummVM latest development build from master (2.6.0git)

I'm logging the issues I've experience in the game that also exist in the demo that is available on the IndieDB web site (https://www.indiedb.com/games/zid-zniw-chronicles-zniw-adventure/downloads).

In short the issues are:

  • A segmentation fault in the "Extras" in-game option (only in the Demo as far as I can tell!).
  • (new) In the full game the Extras menu is not displayed properly (Extras menu buttons are wrongly overlayed over main menu buttons that should be hidden)
  • Fonts or glyphs looking different (bolder or more cleanly defined) than when running the game or demo without ScummVM.
  • Main character's outline is also more bold and cleanly defined when running the game or demo without ScummVM
  • There's a glitch happening in the in-game Credits, when moving to the next credit screen.

Steps to reproduce the *segmentation fault* issue:

  • Launch the demo, choose a language from the start screen
  • Choose one of the "Forest Demo" or "Cave Demo".
  • When you gain control of the main character, press Esc to bring the native in-game menu.
  • Click on the "Extras" option. The segmentation fault may happen immediately at this point, but it may not and the Extras dialogue window will be displayed.
  • If the Extras dialogue window is displayed, move randomly the cursor around within that window. The segmentation fault occurs always for me -- I think it's some area that triggers it.

Debugging the segmentation fault issue with Visual Studio points to putpixel() from engines\ags\lib\allegro\gfx.cpp, when its x, y argument values are outside the width, height limits. This putpixel() call is done by alfont_textout_ex() in engines\ags\lib\alfont\alfont.cpp.

Putting a CLIP in the two lines here:
https://github.com/scummvm/scummvm/blob/d719e83783a530e6e272ddd0207edaf33fb37ed0/engines/ags/lib/alfont/alfont.cpp#L2177
fixes the segfault, but this may not be the right solution -- since it causes some new glitches in the credits (not shown in this ticket).

I am attaching screenshots from the rest of the issues (bad font rendering, bad character outline, credits glitch).

Note: The issue with in-game fonts black outline not being drawn below the glyph's "baseline" was fixed by one the commits by DreamMaster, a few weeks ago, in the process of synching the AGS engine with upstream code.

Attachments (19)

textWithScummVM.png (99.9 KB ) - added by antoniou79 3 years ago.
textWithoutScummVM.png (82.8 KB ) - added by antoniou79 3 years ago.
textWithScummVM01.png (177.4 KB ) - added by antoniou79 3 years ago.
textWithoutScummVM01.png (152.3 KB ) - added by antoniou79 3 years ago.
charactersWithScummVM.png (99.1 KB ) - added by antoniou79 3 years ago.
charactersWithoutScummVM.png (78.1 KB ) - added by antoniou79 3 years ago.
creditsGlitchWithScummVM.png (176.6 KB ) - added by antoniou79 3 years ago.
agsZniwSettings.png (33.7 KB ) - added by antoniou79 3 years ago.
ScummVM_ZniwDemoOptionsText.jpg (263.7 KB ) - added by antoniou79 21 months ago.
Standalone_ZniwDemoOptionsText.jpg (251.4 KB ) - added by antoniou79 21 months ago.
ScummVM_ZniwDemoCreditsButtons.jpg (152.8 KB ) - added by antoniou79 21 months ago.
Standalone_ZniwDemoCreditsButtons.jpg (182.9 KB ) - added by antoniou79 21 months ago.
ScummVM_ZniwFullExtrasScreen.jpg (227.8 KB ) - added by antoniou79 21 months ago.
Standalone_ZniwFullExtrasScreen.jpg (175.8 KB ) - added by antoniou79 21 months ago.
ScummVM_ZniwFullPlayScreen.jpg (212.0 KB ) - added by antoniou79 21 months ago.
Standalone_ZniwFullPlayScreen.jpg (162.1 KB ) - added by antoniou79 21 months ago.
fixTheoraDecoderRate.txt (777 bytes ) - added by antoniou79 21 months ago.
original-zniwadventure-demo-Options.png (171.4 KB ) - added by antoniou79 17 months ago.
scummvm-zniwadventure-demo-Options.png (162.7 KB ) - added by antoniou79 17 months ago.

Change History (42)

by antoniou79, 3 years ago

Attachment: textWithScummVM.png added

by antoniou79, 3 years ago

Attachment: textWithoutScummVM.png added

by antoniou79, 3 years ago

Attachment: textWithScummVM01.png added

by antoniou79, 3 years ago

Attachment: textWithoutScummVM01.png added

by antoniou79, 3 years ago

Attachment: charactersWithScummVM.png added

by antoniou79, 3 years ago

by antoniou79, 3 years ago

comment:1 by antoniou79, 3 years ago

Description: modified (diff)

It seems that the segmentation fault in the Extras screen only happens in the Demo. I cannot reproduce it with the full game (GOG version).

comment:2 by antoniou79, 3 years ago

Also attaching the AGS setup settings I'm using for the full game (where the screenshots are taken from), in case scaling and renderer are relevant to the issue(s).

by antoniou79, 3 years ago

Attachment: agsZniwSettings.png added

comment:3 by antoniou79, 3 years ago

Video showing the credits' glitch:
https://youtu.be/Y5M4S5jwNQc

comment:4 by antoniou79, 3 years ago

Re the fonts issue. Looking at another bug ticket (https://bugs.scummvm.org/ticket/13437) about the font discrepancy for Maniac Mansion Deluxe, I wonder if the issue is as "simple" as some bug that causes the engine to choose the wrong font ie. a completely different font name/file than the one it's supposed to, and not a font rendering issue.

comment:5 by antoniou79, 2 years ago

One of the recent commits (during last week, most likely) broke the UI in the credits tab for the demo and the main game. Now the arrows are missing, only "<" and ">" symbols appear at the edges of the tab, and also the "X" button is missing to close the tab. The attached video shows how the Credits tab was before.

Also, the UI for Extras in the main game, from the main menu, is now broken. It loads its panel, but the buttons from the main menu stay overlayed on the panel, obscuring it. Those buttons shouls disappear when clicking on "Extras".

The reported bugs in the OP of the ticket, still persist.

comment:6 by antoniou79, 2 years ago

Description: modified (diff)
Keywords: fonts crash added

Quick update; the reported issues are still in the recent development build 2.7.0git (master HEAD) and stable RC 2.6.0.

comment:7 by antoniou79, 2 years ago

Recent AGS commits, (today's commits, since I checked yesterday) fix the segmentation fault in the Extras screen of the Demo version (first bullet point in the ticket OP) in the development branch 2.7.0git that I've tested. Good work!

Also the glitch in the credits screen is somewhat fixed. Still glitchy -- and missing navigation button and Back (X?) button) but looks better.

The bug with the overlays in the Extras screen (second bullet point in the ticket OP) in the full game persists.

comment:8 by antoniou79, 2 years ago

In recent builds:

  • Segmentation fault is fixed (as mentioned above)
  • Navigation in Credits screen is still glitched and missing the (X) button to close it -- probably buttons for the arrows for navigation too, because currently it just shows < and > .
  • The Extras screen bad overlay persists.
  • (New) In the demo version, choosing the "Forest Demo" the intro video now plays very fast while the sounds for it play at the normal pace. This is a new bug.

comment:9 by antoniou79, 21 months ago

In recent builds (2.8git) the glitch in the horizontal crawl of the credits is fixed! This fix was by patch: https://github.com/scummvm/scummvm/commit/ec8d8beda7e25241890956f506901c4414c6cea8

This patch is backported to 2.7 branch, but it won't make it to 2.7.0 (since it's too late for it).

Bugs that persist:

  • In Credits screen the navigation buttons are still missing (a bad overlay priority issue?) (Demo and Full version).
  • The Extras screen bad overlay persists (Full version, Start Menu). As far as I can tell, this happens in the "Play" option as well (bad overlay over "Saved Games" screen).
  • In the Demo version, choosing the "Forest Demo" the intro video now plays very fast while the sounds for it play at the normal pace. This was a regression sometime *after the official 2.6.1* build. I haven't investigated yet which commit caused this.
  • Fonts rendering issues. The old glyph outlines was resolved but glyphs look different than the standalone version (probably the same bug as reported elsewhere, eg. see: #12940, #14258)

comment:10 by antoniou79, 21 months ago

Attaching some screenshots for the current state of the graphical issues:

  • Font rendering; notice the bold text in Options screen, eg. "Display Options", "Game volume", is not bold in ScummVM.
  • Text wrapping; see "Cycle immediately" text in the Options screen. In ScummVM it wraps weirdly mid-word "immediately". In Standalone it does not wrap like that.
  • Missing buttons in Credits screen (notice the arrows and "X" button in Standalone mode).
  • Overlay issue with "Extras" and "Play".

by antoniou79, 21 months ago

by antoniou79, 21 months ago

by antoniou79, 21 months ago

by antoniou79, 21 months ago

by antoniou79, 21 months ago

by antoniou79, 21 months ago

by antoniou79, 21 months ago

by antoniou79, 21 months ago

comment:11 by antoniou79, 21 months ago

I've done some bisecting for the fast intro to Forest Demo regression.

It seems the responsible commit is from Sep 21, 2022:

commit b2a9df06e2e0e03b1dc2bd9a81fa0612e4021be3
Author: Matthew Duggan <mgithub@…>
Date: Mon Sep 19 09:56:25 2022 +0900

VIDEO: Set decoder frame rate when loading Theora video.

video/theora_decoder.cpp | 1 +
video/theora_decoder.h | 1 +
2 files changed, 2 insertions(+)

https://github.com/scummvm/scummvm/commit/b2a9df06e2e0e03b1dc2bd9a81fa0612e4021be3

In our video/theora_decoder.cpp, in TheoraDecoder::loadStream(), the framerate returned for this fast playing Forest demo cutscene is "Rational: 13/1".
In contrast, the demo's logo intro which plays normally, gets a framerate "Rational: 60/1".

Something does not seem to work right here, because the fast playing Forest demo cutscene does not play in 13 fps, if that's what it is supposed to do.

comment:12 by antoniou79, 21 months ago

Possible fix for fast intro video to forest demo:

diff --git a/video/theora_decoder.cpp b/video/theora_decoder.cpp
index b9b57912d30..3edb5800165 100644
--- a/video/theora_decoder.cpp
+++ b/video/theora_decoder.cpp
@@ -169,7 +169,11 @@ bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) {
        if (_hasVideo) {
                _videoTrack = new TheoraVideoTrack(getDefaultHighColorFormat(), theoraInfo, theoraSetup);
                addTrack(_videoTrack);
-               setRate(_videoTrack->getFrameRate());
+               // Set video speed to 1x
+               // Note: video_decoder's setRate() method does not set frames-per-second rate
+               //       but rather the speed of the playback (eg. 1x, 2x etc, with 1x being normal speed).
+               //       Hence, we do not pass _videoTrack->getFrameRate() as argument to setRate().
+               setRate(1);
        }

        th_info_clear(&theoraInfo);

Attached as a diff file too.

by antoniou79, 21 months ago

Attachment: fixTheoraDecoderRate.txt added

comment:13 by antoniou79, 21 months ago

Update:
It seems that it might not be necessary to set the rate within loadStream() at all for *AGS engine* games.

setRate(1) is called within the base class' video_decoder start() method here:
https://github.com/scummvm/scummvm/blob/91f47ebea5b411880a19a11d2939af60fd46160f/video/video_decoder.cpp#L440

And for AGS, start() gets called, at least in AGS and for the case of Zniw here:
https://github.com/scummvm/scummvm/blob/91f47ebea5b411880a19a11d2939af60fd46160f/engines/ags/engine/media/video/video.cpp#L83

So the playback rate is already initialized to 1x (normal playback).

However, maybe other engines (Tetraengine was mentioned as a possible one) do not call start() and do need some proper initialization. Which means that maybe a more comprehensive fix is needed.

comment:14 by antoniou79, 21 months ago

Update:

Τhe fast playing video issue is fixed now by mduggan on master (2.8git) by commit:
https://github.com/scummvm/scummvm/commit/b4647bc3f61053921b65ce5282a3c9603423ff4e

The fix is also done in the 2.7 branch (again won't be part of 2.7.0).
https://github.com/scummvm/scummvm/commit/22b30da94e636c64334df233b4b00a2f1f706cde

So, remaining issues:

  • In Credits screen the navigation buttons are still missing (a bad overlay priority issue?) (Demo and Full version). (see recent screenshots)
  • The Extras screen bad overlay persists (Full version, Start Menu). As far as I can tell, this happens in the "Play" option as well (bad overlay over "Saved Games" screen). (see recent screenshots)
  • Fonts rendering and text wrapping issues. The old glyph outlines bugs was resolved, but glyphs look different than the standalone version (probably the same bug as reported elsewhere, eg. see: #12940, #14258) and text wraps around differently too in some cases. (see recent screenshots)

comment:15 by antoniou79, 20 months ago

After the latest commits that synched the ScummVM AGS with upstream AGS (https://github.com/scummvm/scummvm/compare/aaef1c26a3eb...be309e97ebc7) some of the above issues have now been fixed:

  • The bad overlay in Extras and Play options is fixed.
  • The missing navigation buttons in Credits are fixed.

Only issues that remain now are:

  • Fonts rendering and text wrapping issues. The old glyph outlines bugs was resolved, but glyphs look different than the standalone version (probably the same bug as reported elsewhere, eg. see: #12940, #14258) and text wraps around differently too in some cases. (see recent screenshots)

Since the text rendering and wrapping issue is tracked in other tickets too, maybe we should close this one?

comment:16 by tag2015, 17 months ago

If the only issue is related to the fonts, I think we could close this bugreport and append to https://bugs.scummvm.org/ticket/12940.
Do you have two screenshots that show clearly the difference between scummvm and the original interpreter that we can attach to the other bugreport? I'm a bit lost with all the files here :)

by antoniou79, 17 months ago

comment:17 by antoniou79, 17 months ago

The two I uploaded now should show the issue (I have others but this should suffice I think).
The immediately obvious issue is the bad wrapping of the "Cycle immediately" text.
But if you can switch back and forth between the two screenshots you can notice that the glyphs actually seem different (look at 's' or 'm'), and also text that is more intense (semi-bold?) in the original does not appear bold at all in ScummVM.

comment:18 by tag2015, 14 months ago

@antoniou79 could you give it a test? The fonts should match the original now

comment:19 by antoniou79, 14 months ago

Yes. Fonts match the original (as far as I can tell anyway).

comment:20 by tag2015, 14 months ago

Can we close this bug then? Or there are other issues?

comment:21 by antoniou79, 14 months ago

The only issue I can see as "pending" from my post is the one about the characters' outline looking "weaker/fuzzier" on ScummVM, and that could be nitpicking on my end or maybe the standalone's "nearest neighbor" filter makes the outline look smoother.

If no one else notices there's a difference there (you can check with the demo version), we can close this.

comment:22 by tag2015, 12 months ago

Keywords: fonts crash removed
Priority: normallow
Summary: AGS: Zniw Adventure issues and crash (segmentation fault)AGS: Zniw Adventure - Sprites in ScummVM appear less sharp/fuzzier

in reply to:  21 comment:23 by tag2015, 12 months ago

Replying to antoniou79:

If no one else notices there's a difference there (you can check with the demo version), we can close this.

You are correct, I can notice it as well. Most likely related to the sprite filtering in AGS

Note: See TracTickets for help on using tickets.