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.12k stars 143 forks source link

Shaders & scaling questions #282

Closed 2mg closed 5 months ago

2mg commented 5 months ago

What's the fallback (shader=nothing), or with GDI renderer, upscaling method being used? The cnc-ddraw that comes with TSClient also seems older and has nothing about it's default upscaling method, just that it can use .glsl.

Regarding downscaling, I presume the idea is to render at high resolutions and bring them down to the max of the display, as a means of getting a sharper and less aliased image, correct? If so, I've put 4k with TibSun, and things are tiny, feels like the 4k wasn't scaled down, but made to fit into 1080p screen.

And can glsl shaders be stacked one after another, and how to do that? Editing shaders means editing .glslp, does cnc-ddraw use these?

FunkyFr3sh commented 5 months ago

What's the fallback (shader=nothing), or with GDI renderer, upscaling method being used? The cnc-ddraw that comes with TSClient also seems older and has nothing about it's default upscaling method, just that it can use .glsl.

Bicubic (catmull-rom) is the default shader in newer versions and nearest-neighbor was the default in older versions. GDI is always nearest-neighbor

Regarding downscaling, I presume the idea is to render at high resolutions and bring them down to the max of the display, as a means of getting a sharper and less aliased image, correct? If so, I've put 4k with TibSun, and things are tiny, feels like the 4k wasn't scaled down, but made to fit into 1080p screen.

it is supposed to be like that, higher resolutions will make everything smaller.

feels like the 4k wasn't scaled down, but made to fit into 1080p screen.

Not sure what you mean with that, scaling it down to fit into the 1080p screen is exactly what it's doing.

And can glsl shaders be stacked one after another, and how to do that? Editing shaders means editing .glslp, does cnc-ddraw use these?

That's not supported currently, only 1 shader can be used at a time. But you can let cnc-ddraw handle th upscaling and use reshade to add additional effects such as sharpening/film grain etc

2mg commented 5 months ago

Thanks.

I forgot that 4k rez would be downscaled always to monitor's native rez (1080p in my case). Things are so tiny on 1080p anyway, I don't have much use of downscaling from 1440p/4k, heck I thought the downscaling wasn't working and that I was staring at 4k :D

Sorry for off-topic, but is there a reason TSLauncher uses a way older version (per details section of .dll) od cnc-draw?

I see that your current version, under the [Game] section, doesn't have gameticks at all, so things are faster, well at least the mouse panning is with default settings (is it okay if I find ~350 ticks enough, because lower can be felt when for example the Ion Cannon destroys something, it's not listed with Configurator, so am I breaking some game logic?), and maintas and boxing are disabled by default, which is kinda bad if you wanna try 540p/720p integer (for FHD/QHD), or 1066x600 or similar out of the box.

FunkyFr3sh commented 5 months ago

Sorry for off-topic, but is there a reason TSLauncher uses a way older version (per details section of .dll) od cnc-draw?

I don't know about that, I guess just no one spent the time to update it. Old version still works fine, so there wasn't any need to do it

I see that your current version, under the [Game] section, doesn't have gameticks at all, so things are faster, well at least the mouse panning is with default settings (is it okay if I find ~350 ticks enough, because lower can be felt when for example the Ion Cannon destroys something, it's not listed with Configurator, so am I breaking some game logic?), and maintas and boxing are disabled by default, which is kinda bad if you wanna try 540p/720p integer (for FHD/QHD), or 1066x600 or similar out of the box.

Yeah the presets are a bit problematic. For the original game without fan patches you need maxgameticks to slow down the scroll speed. For patched games you didn't need it since I made a patch for it back then. My default settings in ddraw.ini are optimized for my patched version of the game and not the original game (I may have to change that though, for better compatibility). You shouldn't need maxgameticks to slow down the game logic though (unless you play at unlimited speed). Not sure why you're having such issues with the Ion Cannon (maybe it's a new patch that someone made that broke it?). I think I've been using 250 before, but I'm not sure. Will do some testing soon and update the presets.

maintas/boxing were never supported by the game, the menus break if you enable them, they must be disabled

2mg commented 5 months ago

Hm, I booted a new Skirmish, dumbest AI, built Ion Cannon, no slowdown, same map I noticed it before - 250 ticks.

But I fiddled so much with ddraw.ini, dunno if I changed anything specific that might've changed Ion Cannon's slowdown, like CPU affinity (just tested it on/off, no effect). I don't have the first savegame when that happened, so test environment might be different.

300 felt fine, but I still had the slowdown, so I put 350, but that's when I noticed that mouse panning was a bit too fast (I'm on 540p scaled).

maintas/boxing, I mean, by default they aren't necessary as you say, but I wanted to fiddle with 16:9 around 500-720p to see what felt good, and Configurator by default will actually trick you into not changing anything since [Game] section always overrules global settings. Custom AR and rez > broken windows IMHO. Maybe adding a note/indicator that it's being overruled would help, or an option so that it writes in the [Game] section instead (and comment out that section so it isn't totally lost)?

Also, I'm using the TSlaunch with TSpatch, on one hand it comes with gameticks ini file and older dll, on other hand you said that gameticks aren't necessary anymore, on the third hand I had to use 350 (will play more with 250) because the mouse was way too fast.

I'm dropping my ddraw.ini if you wanna take a look, currently playing at 960x540. ddraw.zip

PS: is it possible to "fine-tune" the Fast/Faster in-game setting with gameticks, I find Fast too slow and Faster just a tad too fast.

PSS: I've noticed that mouse cursor isn't as smooth as it is in say desktop, it's nothing game breaking.

FunkyFr3sh commented 5 months ago

Hm, I booted a new Skirmish, dumbest AI, built Ion Cannon, no slowdown, same map I noticed it before - 250 ticks.

But I fiddled so much with ddraw.ini, dunno if I changed anything specific that might've changed Ion Cannon's slowdown, like CPU affinity (just tested it on/off, no effect). I don't have the first savegame when that happened, so test environment might be different.

300 felt fine, but I still had the slowdown, so I put 350, but that's when I noticed that mouse panning was a bit too fast (I'm on 540p scaled).

Yeah, you'll have to test and find a good value, I don't remember exactly how it works in TS now. In some games you can just set to the refresh rate of your monitor (e.g. 60) and in some games you'll have to use a value that's much higher because the game ticks limiter triggers multiple times in 1 frame

Maybe adding a note/indicator that it's being overruled would help, or an option so that it writes in the [Game] section instead (and comment out that section so it isn't totally lost)?

Yep, good idea. I'll think about a solution

Also, I'm using the TSlaunch with TSpatch, on one hand it comes with gameticks ini file and older dll, on other hand you said that gameticks aren't necessary anymore, on the third hand I had to use 350 (will play more with 250) because the mouse was way too fast.

I'm dropping my ddraw.ini if you wanna take a look, currently playing at 960x540. ddraw.zip

Looks good, should be fine

PS: is it possible to "fine-tune" the Fast/Faster in-game setting with gameticks, I find Fast too slow and Faster just a tad too fast.

You can slow down the game with it yeah, but I'm not sure how well it will work with TS. Just play around with it a bit