FunkyFr3sh / cnc-ddraw

GDI, OpenGL and Direct3D 9 re-implementation of the DirectDraw API for classic 2D games for better compatibility with Windows ME, 2000, XP, Vista, 7, 8, 10, 11, Wine (Linux/macOS/Android) and Virtual Machines
https://discord.gg/afWXJNDDF5
MIT License
2.31k stars 148 forks source link

Secret of Shadow Ranch: Game Breaking Bug with Magnet Puzzle #319

Closed indianajson closed 5 months ago

indianajson commented 5 months ago

Here's a reproducible bug for a change (you may have noticed I closed #317 because I still can't reproduce that one again). In Nancy Drew: Secret of Shadow Ranch there is a 2D puzzle where a magnet is used to move pieces around a board. The puzzle is designed so that if you hit an edge of the puzzle with the object the magnet drops it.

When cnc-ddraw is enabled:

The magnet will pick up the object, move it a little bit, then immediately drop the item.

When cnc-ddraw is disabled:

The magnet moves the objects as intended unless you hit an edge. However, the rest of the game has performance issues.

From my laymen's perspective, cnc-ddraw seems to be interpreting every spot on the puzzle as an edge, causing the magnet to drop the item. Because of the bug it is impossible to complete the game. I did fiddle with the config file and was unable to fix the issue with any of the existing settings.

Didn't include a log because I think, like #311, the log won't help. The save file below has the puzzle open with the magnet in hand. If you need to grab the magnet, it is in the inventory and represented by an apple icon (the magnet is one of those refrigerator magnets, in the shape of an apple). Also, the save files are not located inside the game folder, but instead saves to "users/[username]/Documents/Secret of Shadow Ranch/".

MagnetPuzzle.SAV.zip

FunkyFr3sh commented 5 months ago

Seems to be working fine in windows, will have to test in wine I guess

https://github.com/FunkyFr3sh/cnc-ddraw/assets/8355237/09a715a0-16a7-4db4-937e-5f1ba69482da

Edit: Maybe also share your ddraw.ini, just in case

FunkyFr3sh commented 5 months ago

Works in wine too (linux mint 21.3, wine 9.0)

indianajson commented 5 months ago

Works in wine too (linux mint 21.3, wine 9.0)

That's annoying. So something wrong on my end. I'm going to dump my ddraw.ini and let it make a fresh one to see if that makes any difference. Be right back.

indianajson commented 5 months ago

Fresh ddraw.ini didn't fix it. I'm really confused now. Not that it's going to help, but here is what happens to me.

https://github.com/FunkyFr3sh/cnc-ddraw/assets/1751044/41c0bce4-d786-4df8-82d2-7d1765ba01bd

FunkyFr3sh commented 5 months ago

Works on macOS too, but I couldn't use the same wine version (some weird unrelated wineskin bug I have for a longer time) using 22.1.1-16 instead

https://github.com/FunkyFr3sh/cnc-ddraw/assets/8355237/30c6107e-57dc-4981-b5b3-2d677c436d2b

indianajson commented 5 months ago

I tried a few different engines, but I'm going to try the exact one you're using. It is either the engine I'm using or an issue on my machine and if it's on my machine I am really confused.

FunkyFr3sh commented 5 months ago

Yeah, give it a try!

I do have the moving cursor bug now as well, which is nice lol - It was fixed in linux/windows, will try to fix it on macOS now as well

FunkyFr3sh commented 5 months ago

Fixed, latest build (should work now with all on default)

cnc-ddraw.zip

indianajson commented 5 months ago

Can you upload your Wineskin and Engine? I can't find 2.9.2.0 and on my computer 2.9.2.1-rc9 isn't working even with the fix.

FunkyFr3sh commented 5 months ago

I made a .app;

https://pixeldrain.com/u/5j7ADoYJ

Note: Had to wrap it in a .pkg, otherwise it's not possible to download and run it

Game is not installed inside of it, you have to do it on your own

indianajson commented 5 months ago

Thanks, will try.

indianajson commented 5 months ago

I don't get it, still not working. It has to be an issue on my end.

Really appreciate you taking the time to test on all OSes (Win, Linux, Mac) and verify this.

The cursor bug you fixed... was that this issue or the issue we talked about in #317?

FunkyFr3sh commented 5 months ago

Yeah, that was the one from #317 where the cursor was moving towards the bottom right in the main menu. Did not add any changes for this issue here

Does it happen in windowed mode as well? Now that fullscreen works as well, does it happen there too?

Maybe it's even the same weird issue again as the last bug in the othwer game? Maybe the game is running too fast? maybe need limit_bltfast=true and maxgameticks=600 again ? 😄

indianajson commented 5 months ago

As to the runaway cursor issue, you have gone above and beyond, as usual. I noticed that was fixed but didn't put two and two together.

As to this issue, yes, happens in all screen modes. I did try adjusting maxtick but forgot to limit_bltfast so I need to try that again.

I decided to restart my system on the off change that was the problem and it decided it was update time. So once it's done I'll try and let you know.

Really appreciate all your help and time!

indianajson commented 5 months ago

Alright... well, I've won stupid prizes today. The first thing I tested before submitting this issue was maxtickspeed. Nothing. Nada. Zippo. I totally forgot about limit_bltfast needing to be true.

Just changed that. IT WORKS... you fixed it... the wizard of GitHub. The great FunkyFresh strikes again!

FunkyFr3sh commented 5 months ago

Ah nice 👍 I guess I'll have to enable that for every nancy drew game by default

indianajson commented 5 months ago

As a note, maxtickspeed can be equal to 1000 and limit_bltfast set to true for this game, but cannot be -1, -2, or 0 for me. While Message in a Haunted Mansion can't be much over 600 and limit_bltfast set to true.

indianajson commented 5 months ago

I guess, if nothing else, this revealed a useful preset that may help some users.

FunkyFr3sh commented 5 months ago

@indianajson I could need your help, here's a new build with a new setting "limiter_type=1" - This new setting changes the behavior of the old "maxgameticks=" setting. Could you test both games and see what is the highest possible "maxgameticks" value now before it breaks?

cnc-ddraw-nancy-drew.zip

indianajson commented 5 months ago

Happy to help! I'll test this when I get back to my desk in a few hours.

indianajson commented 5 months ago

For Message in a Haunted Mansion's maze puzzle:

Max Settings to function:

limiter_type=1 maxgameticks=240

Results

At 240 the maze is playable but slow. At 245 the maze puzzle slows to a crawl. At 250 the maze will not move forward.

With limiter_type=2 (bltfast) the maxgameticks can be up to 600, as we previously discussed, and the maze plays smoothly. However, this does introduce the cursor flicker on the load screen.

For Secret of Shadow Ranch's magnet puzzle:

Max Settings to be playable:

limiter_type=1 maxgameticks=200

Results

At 200 the magnet functions normally for all four objects, but the game feels like its skipping frames (not quite smooth). By 245 the magnet starts to become mostly unresponsive for one of the four objects (the other three are okay). Values above 600 seem to break the magnet for all four objects.

With limiter_type=2 (bltfast) the maxgameticks can be at 1000, as we previously discussed, and the magnet works perfectly.

Based on my tests, the maxgameticks must be lower with limiter_type=1 and do not play as well as limiter_type=2.

FunkyFr3sh commented 5 months ago

Nice! Yes, the value has to be lower with the new setting. I think it limits it properly now, setting 200 should equal to 200 FPS. That was the issue with the old method, the limiter kicked in multiple times per frame and we had to use a lot higher values to workaround the issue.

So 200 is still too high. Does it feel okay'ish with a lower value like 150 or 100? In theory we could go as low as 60 now

indianajson commented 5 months ago

For both Message in a Haunted Mansion and Secret of Shadow Ranch the puzzles work well at 120 and the games' performance is smooth.

FunkyFr3sh commented 5 months ago

For both Message in a Haunted Mansion and Secret of Shadow Ranch the puzzles work well at 120 and the games' performance is smooth.

Works fine for me as well, thanks for testing! Will set up 120 for all nancy drew games by default