#14582 closed defect (fixed)

SCUMM: MI2: pathfinding doesn't match original

Reported by: ffyte Owned by: athrxx
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Monkey Island 2

Description

ScummVM version (scummvm -v):
ScummVM 2.8.0git (Aug 1 2023 13:08:24)
Using SDL backend with SDL 2.0.20
Features compiled in: Vorbis FLAC MP3 ALSA SEQ sndio TiMidity RGB zLib MPEG2 FluidSynth Theora AAC A/52 FreeType2 FriBiDi JPEG PNG GIF taskbar TTS cloud (servers, local) ENet SDL2 TinyGL OpenGL (with shaders)

Your OS:
Linux Mint 21.2 Cinnamon

In Monkey Island 2, some speedrunners noticed that movement on the overhead-view map screens of the three islands works slightly differently on ScummVM compared to the original game. Because Guybrush's sprite is so small, it is hard to make out what exactly the difference is, but I think he walks at a different speed whenever he is moving at 45° angles. What is clear, is that Guybrush takes longer to reach his destination on ScummVM. Here is a list of test results for one specific spot, but I think this probably is a phenomenon that occurs at all times on these map screens.

Time it takes Guybrush to walk from the Spitting Contest (exiting the screen on the right side) to the small guardhouse in front of Elaine's mansion. This was always just one click on the destination from a standing position right outside Ville de la Booty. Timed from the first frame we see Guybrush move on the map until the screen changes from the map screen to the guardhouse:

  • DOS/Ger DOSBox emulator: 8.3s
  • DOS/Ger DREAMM emulator: 8.3s
  • DOS/Eng DOSBox emulator: 8.3s
  • FM Towns/Eng DREAMM emulator : 8.3s
  • Amiga/Ger PUAE emulator: 8.3s
  • DOS/Eng ScummVM: 8.8s
  • DOS/Ger ScummVM: 8.8s
  • FM Towns/Eng ScummVM: 8.8s
  • Amiga/Ger ScummVM: 8.8s

Here is a comparison video with FM Towns on ScummVM at the top, DOS on DOSBox at the bottom: https://cdn.discordapp.com/attachments/428303733466726419/1141406194221731901/wthbooty.webm

Something else about MI2 pathfinding on ScummVM, which is probably unrelated:
There's always been one tiny, irrelevant difference in the pathfinding that I noticed. When Guybrush does a 180° turn, on ScummVM he turns in the other direction. Like when you open the envelopes in jail, on ScummVM he goes up-right-down. On the original game he goes up-left-down. You can also notice it in some other spots.

Change History (9)

comment:1 by AndywinXp, 15 months ago

Summary: Scumm Monkey Island 2 pathfinding doesn't match originalSCUMM: MI2: pathfinding doesn't match original

Thanks for submitting this as a ticket! :D
I have some stuff in the queue right now, so if someone beats me to it, that's great. Otherwise I'll try to sort it out for 2.8.0 anyway.

comment:2 by athrxx, 15 months ago

I have fixed a tiny little bug which happens to speed up this particular walk by 500 msecs. So I guess this really is the bug we have here...

I didn't look at the wrong actor turning. That's a different issue.

comment:3 by AndywinXp, 15 months ago

I didn't want to admit it but I was hoping you'd come by for this one :P thanks!

comment:4 by athrxx, 15 months ago

I have also fixed the way Guybrush does his 180° turns, now. We actually had that fixed for SCUMM1-3 some time ago. For SCUMM4-6 it is the exact same code.

comment:5 by athrxx, 15 months ago

I noticed that the turning movement was also broken for COMI and FT (not turning in the wrong direction, but actually no turning animation at all). I have fixed that, too.

comment:6 by dwatteau, 15 months ago

@athrxx: Thanks for your work on this!

Commit 8a54e258a5aeac082ebb3a444d0c57138b6694f0 ("SCUMM: (SCUMM7/8) - fix actor turning animation") appears to cause a regression in ft-demo, though:

Starting program: ./scummvm ft-demo

Thread 1 "scummvm" received signal SIGSEGV, Segmentation fault.
0x000055555569c57a in Scumm::oldDirToNewDir (dir=<error reading variable: Cannot access memory at address 0x7fffff7feffc>) at engines/scumm/util.cpp:54
54      int oldDirToNewDir(int dir) {
#0  0x000055555569c57a in Scumm::oldDirToNewDir (dir=<error reading variable: Cannot access memory at address 0x7fffff7feffc>) at engines/scumm/util.cpp:54
#1  0x00005555556edc87 in Scumm::Actor::animateActor (this=0x555557a789d0, anim=3) at engines/scumm/actor.cpp:2673
#2  0x00005555556edaad in Scumm::Actor_v7::startAnimActor (this=0x555557a789d0, f=3) at engines/scumm/actor.cpp:2623
#3  0x00005555556edece in Scumm::Actor::animateActor (this=0x555557a789d0, anim=3) at engines/scumm/actor.cpp:2713
#4  0x00005555556edaad in Scumm::Actor_v7::startAnimActor (this=0x555557a789d0, f=3) at engines/scumm/actor.cpp:2623
#5  0x00005555556edece in Scumm::Actor::animateActor (this=0x555557a789d0, anim=3) at engines/scumm/actor.cpp:2713
#6  0x00005555556edaad in Scumm::Actor_v7::startAnimActor (this=0x555557a789d0, f=3) at engines/scumm/actor.cpp:2623
#7  0x00005555556edece in Scumm::Actor::animateActor (this=0x555557a789d0, anim=3) at engines/scumm/actor.cpp:2713
#8  0x00005555556edaad in Scumm::Actor_v7::startAnimActor (this=0x555557a789d0, f=3) at engines/scumm/actor.cpp:2623

(etc.)

comment:7 by athrxx, 15 months ago

Heya, thanks for testing that. I don't have the demo installed, but I'll get the demo if I need to.
For now, this looks like a "simple" typo on my part. Could you please replace
Actor::animateActor(f) with Actor::startAnimActor(f) in line 2623 and see what happens?

Last edited 15 months ago by athrxx (previous) (diff)

in reply to:  7 comment:8 by dwatteau, 15 months ago

Thanks, that does it! I've pushed the suggested change.

This ticket can probably be closed, by the way, since the reported issues appear to be fixed, now?

comment:9 by athrxx, 15 months ago

Owner: set to athrxx
Resolution: fixed
Status: newclosed

Thanks! Yes, I'll close this. The v7/8 things aren't even part of the ticket...

Note: See TracTickets for help on using tickets.