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

It's not smooth vs D2DX #151

Closed weili0677 closed 1 year ago

weili0677 commented 2 years ago

when I use the cnc-ddraw in Diablo2,render is OpenGL,and the FPS is 60,but seem not smooth.

I use the D2DX in Diablo2,FPS also is 60,and play very smooth.(but D2DX have some bug will let game crash)

so can you fix it?

the D2DX project url: https://github.com/bolrog/d2dx

Mitradis commented 2 years ago

show you config.

weili0677 commented 2 years ago

show you config. this is my config:


; cnc-ddraw - https://github.com/CnCNet/cnc-ddraw - https://cncnet.org

[ddraw] ; ### Optional settings ### ; Use the following settings to adjust the look and feel to your liking

; Stretch to custom resolution, 0 = defaults to the size game requests width=1738 height=976

; Override the width/height settings shown above and always stretch to fullscreen ; Note: Can be combined with 'windowed=true' to get windowed-fullscreen aka borderless mode fullscreen=false

; Run in windowed mode rather than going fullscreen windowed=true

; Maintain aspect ratio maintas=true

; Windowboxing / Integer Scaling boxing=false

; Real rendering rate, -1 = screen rate, 0 = unlimited, n = cap ; Note: Does not have an impact on the game speed, to limit your game speed use 'maxgameticks=' maxfps=0

; Vertical synchronization, enable if you get tearing - (Requires 'renderer=auto/opengl/direct3d9') ; Note: vsync=true can fix tearing but it will cause input lag vsync=true

; Automatic mouse sensitivity scaling ; Note: Only works if stretching is enabled. Sensitivity will be adjusted according to the size of the window adjmouse=false

; Preliminary libretro shader support - (Requires 'renderer=opengl') https://github.com/libretro/glsl-shaders ; 2x scaling example: https://imgur.com/a/kxsM1oY - 4x scaling example: https://imgur.com/a/wjrhpFV shader=Shaders\cubic.glsl

; Window position, -32000 = center to screen posX=98 posY=41

; Renderer, possible values: auto, opengl, gdi, direct3d9 (auto = try direct3d9/opengl, fallback = gdi) renderer=direct3d9

; Developer mode (don't lock the cursor) devmode=true

; Show window borders in windowed mode border=true

; Save window position/size/state on game exit and restore it automatically on next game start ; Possible values: 0 = disabled, 1 = save to global 'ddraw' section, 2 = save to game specific section savesettings=1

; Should the window be resizable by the user in windowed mode? resizable=true

; Enable linear (D3DTEXF_LINEAR) upscaling filter for the direct3d9 renderer d3d9linear=true

; Enable upscale hack for high resolution patches (Supports C&C1, Red Alert 1 and KKND Xtreme) vhack=false

; cnc-ddraw config program language, possible values: auto, english, chinese, german, spanish, russian, hungarian, french configlang=auto

; Where should screenshots be saved screenshotdir=.\Screenshots\

; ### Compatibility settings ### ; Use the following settings in case there are any issues with the game

; Hide WM_ACTIVATEAPP and WM_NCACTIVATE messages to prevent problems on alt+tab noactivateapp=false

; Max game ticks per second, possible values: -1 = disabled, -2 = refresh rate, 0 = emulate 60hz vblank, 1-1000 = custom game speed ; Note: Can be used to slow down a too fast running game, fix flickering or too fast animations ; Note: Usually one of the following values will work: 60 / 30 / 25 / 20 / 15 (lower value = slower game speed) maxgameticks=-1

; Windows API Hooking, Possible values: 0 = disabled, 1 = IAT Hooking, 2 = Microsoft Detours, 3 = IAT+Detours Hooking (All Modules), 4 = IAT Hooking (All Modules) ; Note: Change this value if windowed mode or upscaling isn't working properly ; Note: 'hook=2' will usually work for problematic games, but 'hook=2' should be combined with renderer=gdi hook=4

; Force minimum FPS, possible values: 0 = disabled, -1 = use 'maxfps=' value, -2 = same as -1 but force full redraw, 1-1000 = custom FPS ; Note: Set this to a low value such as 5 or 10 if some parts of the game are not being displayed (e.g. menus or loading screens) minfps=-1

; Disable fullscreen-exclusive mode for the direct3d9/opengl renderers ; Note: Can be used in case some GUI elements like buttons/textboxes/videos/etc.. are invisible nonexclusive=false

; Fixes issues where the pitch of a surface is not a multiple of 4 ; Note: Enable this if some parts of the screen are being displayed diagonally fixpitch=false

; Force CPU0 affinity, avoids crashes/freezing, might have a performance impact singlecpu=true

; Available resolutions, possible values: 0 = Small list, 1 = Very small list, 2 = Full list ; Note: Set this to 2 if your chosen resolution is not working, set to 1 if the game is crashing resolutions=0

; Child window handling, possible values: 0 = Disabled, 1 = Display top left, 2 = Display top left + repaint, 3 = Hide ; Note: Disables upscaling if a child window was detected fixchilds=2

; Set the precision for Direct3D9 floating-point calculations to the precision used by the calling thread ; Note: Enable this if there are desyncs in online games fpupreserve=false

; ### Hotkeys ### ; Use the following settings to configure your hotkeys, 0x00 = disabled ; Virtual-Key Codes: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

; Switch between windowed and fullscreen mode = [Alt] + ??? keytogglefullscreen=0x0D

; Maximize window without frame = [Alt] + ??? keytogglemaximize=0x22

; Unlock cursor 1 = [Ctrl] + ??? keyunlockcursor1=0x09

; Unlock cursor 2 = [Right Alt] + ??? keyunlockcursor2=0xA3

; Screenshot keyscreenshot=0x2C

; ### Game specific settings ### ; The following settings override all settings shown above, section name = executable name

; Atomic Bomberman [BM] maxgameticks=60

; Age of Empires [empires] renderer=opengl nonexclusive=true fixpitch=true adjmouse=true resolutions=2

; Age of Empires: The Rise of Rome [empiresx] renderer=opengl nonexclusive=true fixpitch=true adjmouse=true resolutions=2

; Age of Empires II [EMPIRES2] renderer=opengl nonexclusive=true fixpitch=true adjmouse=true

; Age of Empires II: The Conquerors [age2_x1] renderer=opengl nonexclusive=true fixpitch=true adjmouse=true

; American Conquest [DMCR] minfps=-2

; Age of Wonders [AoWSM] windowed=true fullscreen=false renderer=gdi hook=2

; Age of Wonders 2 [AoW2] windowed=true fullscreen=false renderer=gdi hook=2

; Anstoss 3 [anstoss3] renderer=gdi adjmouse=true

; Anno 1602 [1602] adjmouse=true

; Alien Nations [AN] adjmouse=true

; Amerzone [AMERZONE] renderer=opengl

; Atlantis [ATLANTIS] renderer=opengl maxgameticks=60

; Airline Tycoon Deluxe [AT] fixchilds=0

; Blade & Sword [comeon] fixchilds=3 fixpitch=true

; Blood II - The Chosen / Shogo - Mobile Armor Division [Client] checkfile=.\SOUND.REZ noactivateapp=true

; Casino Empire [CasinoEmpire] hook=2

; Carmageddon [CARMA95] renderer=opengl noactivateapp=true

; Carmageddon [CARM95] renderer=opengl noactivateapp=true

; Carmageddon 2 [Carma2_SW] renderer=opengl noactivateapp=true

; Captain Claw [claw] noactivateapp=true

; Command & Conquer: Sole Survivor [SOLE] maxgameticks=120 maxfps=60 minfps=-1

; Command & Conquer: Sole Survivor [SoleSurvivor] maxgameticks=120 maxfps=60 minfps=-1

; Command & Conquer Gold - CnCNet [cnc95] maxfps=125

; Command & Conquer Gold [C&C95] maxgameticks=120 maxfps=60 minfps=-1

; Command & Conquer: Red Alert - CnCNet [ra95-spawn] maxfps=125

; Command & Conquer: Red Alert [ra95] maxgameticks=120 maxfps=60 minfps=-1

; Command & Conquer: Red Alert [ra95_Mod-Launcher] maxgameticks=120 maxfps=60 minfps=-1

; Command & Conquer: Red Alert [ra95p] maxfps=60 minfps=-1

; Command & Conquer: Tiberian Sun / Command & Conquer: Red Alert 2 [game] checkfile=.\blowfish.dll tshack=true noactivateapp=true adjmouse=true maxfps=60 minfps=-1 maintas=false boxing=false

; Command & Conquer: Tiberian Sun Demo [SUN] noactivateapp=true tshack=true adjmouse=true maxfps=60 minfps=-1 maintas=false boxing=false

; Command & Conquer: Tiberian Sun - CnCNet [ts-spawn] noactivateapp=true tshack=true adjmouse=true maxfps=60 minfps=-1 maintas=false boxing=false

; Command & Conquer: Red Alert 2 - XWIS [ra2] noactivateapp=true tshack=true maxfps=60 minfps=-1 maintas=false boxing=false

; Command & Conquer: Red Alert 2 - XWIS [Red Alert 2] noactivateapp=true tshack=true maxfps=60 minfps=-1 maintas=false boxing=false

; Command & Conquer: Red Alert 2: Yuri's Revenge [gamemd] noactivateapp=true tshack=true maxfps=60 minfps=-1 maintas=false boxing=false

; Command & Conquer: Red Alert 2: Yuri's Revenge - ?ModExe? [ra2md] noactivateapp=true tshack=true maxfps=60 minfps=-1 maintas=false boxing=false

; Command & Conquer: Red Alert 2: Yuri's Revenge - CnCNet [gamemd-spawn] noactivateapp=true tshack=true maxfps=60 minfps=-1 maintas=false boxing=false

; Command & Conquer: Red Alert 2: Yuri's Revenge - XWIS [Yuri's Revenge] noactivateapp=true tshack=true maxfps=60 minfps=-1 maintas=false boxing=false

; Caesar III [c3] nonexclusive=true adjmouse=true

; Chris Sawyer's Locomotion [LOCO] adjmouse=true

; Cultures 2 [Cultures2] adjmouse=true

; Cultures 2 MP [Cultures2MP] adjmouse=true

; Close Combat 2: A Bridge Too Far [cc2] adjmouse=true fixpitch=true renderer=opengl nonexclusive=true

; Close Combat 3: The Russian Front [cc3] adjmouse=true fixpitch=true renderer=opengl nonexclusive=true

; Close Combat 4: The Battle of the Bulge [cc4] adjmouse=true fixpitch=true renderer=opengl nonexclusive=true

; Close Combat 5: Invasion: Normandy [cc5] adjmouse=true fixpitch=true renderer=opengl nonexclusive=true

; Commandos [Comandos] fixpitch=true

; Call To Power 2 [ctp2] maintas=false boxing=false

; Corsairs Gold [corsairs] adjmouse=true renderer=gdi hook=2

; Dune 2000 [dune2000] fpupreserve=true

; Dune 2000 - CnCNet [dune2000-spawn] fpupreserve=true

; Dragon Throne: Battle of Red Cliffs [AdSanguo] maxgameticks=60 noactivateapp=true

; Dark Reign: The Future of War [DKReign] renderer=opengl maxgameticks=60

; Dungeon Keeper 2 [DKII] maxgameticks=60 noactivateapp=true

; Deadlock 2 [DEADLOCK] fixchilds=0 adjmouse=false maintas=false boxing=false

; Eggsucker [eggsucker] fixpitch=true

; Economic War [EcoW] maxgameticks=60 fixnotresponding=true

; Future Cop - L.A.P.D. [FCopLAPD] adjmouse=true fixchilds=3

; G-Police [GPOLICE] maxgameticks=60

; Gangsters: Organized Crime [gangsters] adjmouse=true renderer=opengl nonexclusive=true

; Grand Theft Auto [Grand Theft Auto] fixwndprochook=true singlecpu=false

; Grand Theft Auto: London 1969 [gta_uk] fixwndprochook=true singlecpu=false

; Grand Theft Auto: London 1961 [Gta_61] fixwndprochook=true singlecpu=false

; Heroes of Might and Magic II: The Succession Wars [HEROES2W] adjmouse=true

; Hard Truck: Road to Victory [htruck] maxgameticks=25 renderer=opengl noactivateapp=true

; Invictus [Invictus] adjmouse=true fixwndprochook=true renderer=opengl

; Interstate 76 [i76] adjmouse=true renderer=opengl

; Infantry Online [infantry] devmode=true resolutions=2 infantryhack=true

; Jagged Alliance 2 [ja2] fixmousehook=true noactivateapp=true releasealt=true novidmem=true

; Jagged Alliance 2: Wildfire [WF6] fixmousehook=true noactivateapp=true releasealt=true novidmem=true

; Jagged Alliance 2 - UC mod [JA2_UC] fixmousehook=true noactivateapp=true releasealt=true novidmem=true

; Jagged Alliance 2 - Vengeance Reloaded mod [JA2_Vengeance] fixmousehook=true noactivateapp=true releasealt=true novidmem=true

; Kings Quest 8 [Mask] renderer=opengl

; Konung [konung] fixchilds=0

; Konung 2 [Konung2] fixchilds=0

; KKND Xtreme (With high resolution patch) [KKNDgame] vhack=true

; KKND2: Krossfire [KKND2] noactivateapp=true renderer=gdi hook=2

; Lionheart [Lionheart] locktopleft=true

; Majesty Gold [Majesty] minfps=-2

; Majesty Gold HD [MajestyHD] adjmouse=true

; Majesty Gold HD [MajestyHD - Old] adjmouse=true

; Mech Warrior 3 [Mech3] renderer=opengl nonexclusive=true

; Moorhuhn [Moorhuhn] renderer=opengl dinputhook=true

; Moorhuhn 2 [Moorhuhn2] dinputhook=true

; Outlaws [olwin] noactivateapp=true maxgameticks=60 adjmouse=true renderer=gdi

; Pharaoh [Pharaoh] adjmouse=true

; Pacific General [PACGEN] renderer=opengl

; Pax Imperia [Pax Imperia] renderer=opengl nonexclusive=true

; Railroad Tycoon II [RT2] adjmouse=true

; ROAD RASH [RoadRash] adjmouse=true

; Septerra Core [septerra] hook=2

; Settlers 3 [s3] renderer=opengl nonexclusive=true

; Star Trek - Armada [Armada] armadahack=true renderer=opengl nonexclusive=true adjmouse=true maintas=false boxing=false

; Star Wars: Galactic Battlegrounds [battlegrounds] fixpitch=true adjmouse=true

; Star Wars: Galactic Battlegrounds: Clone Campaigns [battlegrounds_x1] fixpitch=true adjmouse=true

; Stronghold Crusader HD [Stronghold Crusader] adjmouse=true

; Space Rangers [Rangers] locktopleft=true

; Stronghold Crusader Extreme HD [Stronghold_Crusader_Extreme] adjmouse=true

; Stronghold HD [Stronghold] adjmouse=true

; Steel Panthers: World At War [MECH] renderer=opengl

; Sim City 3000 [SC3] renderer=opengl minfps=-2

; Shadow Watch [sw] fixpitch=true adjmouse=true

; Shadow Flare [ShadowFlare] renderer=opengl nonexclusive=true adjmouse=true maintas=false boxing=false

; Three Kingdoms: Fate of the Dragon [sanguo] maxgameticks=60 noactivateapp=true

; Twisted Metal [TWISTED] renderer=opengl nonexclusive=true maxgameticks=25 minfps=5

; Twisted Metal 2 [Tm2] renderer=opengl nonexclusive=true maxgameticks=60 adjmouse=true fixchilds=1 maintas=false boxing=false

; Tzar: The Burden of the Crown ; Note: Must set 'DIRECTXDEVICE=0' in 'Tzar.ini' [Tzar] adjmouse=true

; Uprising [uprising] renderer=opengl fixpitch=true adjmouse=true

; Uprising 2 [Uprising 2] renderer=opengl adjmouse=true

; Warlords 3 [Darklord] renderer=gdi

; Wizardry 8 [Wiz8] fixmousehook=true noactivateapp=true releasealt=true novidmem=true

; Worms Armageddon [WA] adjmouse=true width=0 height=0 resizable=false

; Wizards and Warriors [deep6] renderer=gdi hook=2

; War Wind [WW] renderer=opengl

; Zeus and Poseidon [Zeus] adjmouse=true

Fyred commented 2 years ago

D2DX using motion prediction

Mitradis commented 2 years ago

why maxgameticks=-1 and singlecpu=true

weili0677 commented 2 years ago

why maxgameticks=-1 and singlecpu=true because vsync=true so I set maxgameticks=-1 and singlecpu=true because I find out cpu higher then =false

FunkyFr3sh commented 1 year ago

You have vsync and windowed mode enabled both at the same time, this is not a good idea (it will add a lot of input lag).

On windows 11, 10, 8 Do never enable vsync and windowed mode at the same time.

On windows 7, vista If aero is enabled: Do never enable vsync and windowed mode at the same time.

If aero is disabled: You can enable both at the same time if you want

On windows xp You can enable both at the same time if you want