FunkyFr3sh / cnc-ddraw

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

American Conquest and its total conversions have an issue with Speed Mode on modern computers. #335

Closed eierfrucht closed 3 weeks ago

eierfrucht commented 1 month ago

American Conquest & American Conquest: Fight Back (these target mdraw.dll) and its total conversions Rise of East Asia & European Warfare (these two target ddraw.dll) randomly revert to Fast Mode from Slow Mode, sometimes mid-game!

European Warfare: https://www.moddb.com/mods/european-warfare-napoleonica Rise of East Asia: https://www.dropbox.com/scl/fi/ly47heccq2bsqj6nrk4hv/American-Conquest-Gold-Edition.rar

Even in Slow Mode, the scale seems to be logarithmic in nature so decreasing it below 80% makes the game crawl while every 1% step above 80% speeds it up exponentially until it's too fast after just a few steps.

To crown it all, map scrolling speed is somehow tied to the overall speed so even at 80%, map scrolling is quite choppy.

Game speed is tied to CPU frequency like explained here: https://www.gog.com/forum/american_conquest/what_to_do_when_the_game_runs_too_fast/post2

"Limit tic rate" setting in cnc-ddraw seems to have no effect over any of this.

Suggested solution: somehow override the Slow/Fast Modes and the Speed slider entirely, instead tying the game speed to a variable in a special section of ddraw.ini; interpolate this number with actual CPU speed to set the game speed consistently regardless of the CPU at hand.

FunkyFr3sh commented 1 month ago

In these games cnc-ddraw got no control over the game speed, they're using DirectDraw in a very special way (they even had to workaround the issues with their mdraw.dll patch) - These games need to be patched, it's nothing a DirectDraw wrapper should be messing with.

Here's some experimental patch suggested by helgo, this is as good as it will get for now: https://github.com/FunkyFr3sh/cnc-ddraw/issues/116#issuecomment-2207279421

eierfrucht commented 1 month ago

So this hasn't been merged into 6.7? My bad.

With the experimental build, what speed mode should I choose and is there a way to get around the random switching from Fast to Slow?

If a mod targets ddraw.dll, should I strictly use the build saying "(ddraw)" , or can I simply rename the library?

FunkyFr3sh commented 1 month ago

So this hasn't been merged into 6.7? My bad.

With the experimental build, what speed mode should I choose and is there a way to get around the random switching from Fast to Slow?

Haven't heard about that one, so no idea

If a mod targets ddraw.dll, should I strictly use the build saying "(ddraw)" , or can I simply rename the library?

both files are the same, you can just rename it

eierfrucht commented 1 month ago

The speed mode is described here: https://www.gog.com/forum/american_conquest/what_to_do_when_the_game_runs_too_fast/post2

Slow and fast game modes seem to be 2 different tic logics, and the game randomly switches to Fast on its own.

eierfrucht commented 1 month ago

I had no luck with the experimental patched build, no matter the tic limit in cnc the game was a 1-2 FPS crawl (even with 1000 or Unlimited).

But with the latest 6.7, I was (hopefully!) able to find a configuration that will keep the game from randomly changing the game speed & Fast / Slow mode.

The trick is to always keep Off these settings:

Limit game speed Force High FPS / fix Stuttering Fix invisible videos / UI elements

And to always keep On these:

Fix bad performance & Sound Issues Unlock Additional Screen Resolutions

Enable Vsync seems to work, while Borderless + Maintain Aspect Ratio + Adjust mouse sensitivity are required to run the game in fullscreen mode (regular Fullscreen will just run the game in a pixel-exact centered box)

The next important thing is to set the Compatibility Mode for DMCR.exe to Windows XP SP3 in the executable's properties. This is what seemingly makes the game correctly remember the last used resolution, game speed, and scrolling speed. This also prevents the game from randomly kicking in Fast Mode, too.

Once in game, set the mode to Slow (Fast seems to make no difference except it will eventually ruin the multiplayer and introduce the occasional hiccup in single player) and the game speed to anywhere between 80% and 90%, Going above 90% will give ridiculously high speeds while going below 80% will reduce the game to a crawl (there's definitely something wrong with the value scaling on this slider).

Exit the game, re-launch it and make sure resolution, game speed and mode didn't change. If so, you are good to go. My current stable settings that won't randomly change any longer:

Settings

P.S. I have no idea what Fast Mode was supposed to be but it's BAD! Even with Slow, it's super easy to make the game run super fast if you wish so.

eierfrucht commented 1 month ago

I have discovered a graphics bug running with mainline 6.7 on a GOG copy of AC:FB targeting mdraw.dll: when the resolution is set to 1366x768, scrolling leftwards spawns a vertical column of graphical garbage as shown in the image: https://i.postimg.cc/mRF35xYq/glitch.png

No other in-game resolution causes that.

FunkyFr3sh commented 1 month ago

Might be a bug in the game, 1366x768 is generally a problematic resolution and might just not work well. Do you have 1360x768 as well? Maybe try that one instead.

Kola124 commented 1 month ago

P.S. I have no idea what Fast Mode was supposed to be but it's BAD! Even with Slow, it's super easy to make the game run super fast if you wish so.

Afaik Fastmode multiplies everything to make it seem feel/faster. Eg Animation x2, Mine x2 etc. I think slow and fast mode have same logic only difference is multiplier, there is one while loop that could be main cause of slowdown in game logic when it runs fast mode.