Page 1 of 1

Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Feb 09, 2020 5:12 pm
by labc133
Hello,

I've been experiencing low FPS at certain times during the game, especially when there's alot of lasers at the same time. I hit escape and go to menu and that seems to help, as soon as I come back the animation goes really fast for a split second and then it comes back to normal. Any way to fix?

Thanks!

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Mon Feb 10, 2020 1:40 am
by blue_max
Something similar happens to me (low FPS) when I've got a browser running at the same time XWA is running. In my case, it stays low even after pressing Escape. If I reboot my machine this usually solves the problem.

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Mon Feb 10, 2020 3:40 pm
by labc133
That unfortunately doesn't fix the issue for me :/

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Wed Feb 12, 2020 7:35 pm
by labc133
Anyone might have a fix for this? :(

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Wed Feb 12, 2020 7:38 pm
by Darksaber
With the lack of people responding to your post you can conclude for yourself that the answer is no

Though saying that a few details about your computer may be helpful, such as OS, Ram, CPU anything else you can think of

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Wed Feb 12, 2020 8:02 pm
by labc133
Well, maybe someone with an answer hasn't seen it yet? :?

OS: Win10
Ram: 16GB 4266 (PC 34100) (Max XMP Profile I got was to 4000)
CPU: Intel i9 9900k - 3.6 stock - OC to 5.2ghz
GPU: GTX 2080

I have several patches activated... including the one you gave me to resolve the target window out of range crash. 0x000d332d I think it was.

I have the latest craftpack and latest ddraw.dll

I have tried installing all the hooks. Nothing fixes it. :(

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Wed Feb 12, 2020 9:07 pm
by JeremyaFr
Hello,
There is not yet a patch to fix low FPS issues.

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sat Feb 22, 2020 8:16 pm
by JeremyaFr
Hello,
Here is a WIP hook to improve a bit the fps.

EDIT: link removed

To enable it, set "IsHookD3DEnabled = 1" in "hook_d3d.cfg".
The hook requires a modified DDraw.dll (included in the zip).

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sat Feb 22, 2020 9:34 pm
by blue_max
This is very interesting, Jeremy. I haven't tried it yet myself; but could you share a few details of what you did in the hook above?

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Feb 23, 2020 1:50 pm
by JeremyaFr
The following functions are hooked:

Code: Select all

L00594E6C Xwa3dDeviceBeginScene
L00594EF8 Xwa3dDeviceEndScene
L00595006 XwaD3dExecuteBufferLock
L00595095 XwaD3dExecuteBufferAddVertices
L00595106 XwaD3dExecuteBufferProcessVertices
L00595191 XwaD3dExecuteBufferAddTriangles
L005954D6 XwaD3dExecuteBufferUnlockAndExecute
Between begin and end scene, the tringles are not immediately drawn. The vertices and triangles are stored in a buffer. When the EndScene method is called, the triangles are rendered.
Doing that, the vertex and index buffers are mapped, written, and unmapped only one time per frame.
When the execute buffer is locked, the pointers to the execute buffer, the vertex buffer and the index buffer are stored in the D3DEXECUTEBUFFERDESC structure. Then the game writes the vertices and the indices directly to the vertex and index buffers, without an extra copy.

The DDraw dll is modified to not copy the vertices and indices to the vertex and index buffers when the execute buffer is executed.

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Feb 23, 2020 9:16 pm
by blue_max
So, in the current version of ddraw, the vertex/index buffers are mapped/copied/unmapped every time an execute buffer is executed. The execute buffers are executed several times per frame.

If I understood what you're saying, in the new version the vertex/index buffers are only mapped/copied/unmapped *once* per frame. So we get better performance. Have you ran a benchmark to see how big is the improvement in performance?

I'm looking forward to seeing the new ddraw code!

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Feb 23, 2020 9:57 pm
by keiranhalcyon7
Nice. Some additional questions: does this constitute draw call batching, or would that be a further optimization? (Is it even feasible/applicable to a game as old as XWA?)

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Mon Feb 24, 2020 5:24 pm
by JeremyaFr
UPDATE
Hello,
I've uploaded the code of the d3d hook and the updated DDraw dll:

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Mon Feb 24, 2020 5:27 pm
by JeremyaFr
blue_max wrote:
Sun Feb 23, 2020 9:16 pm
Have you ran a benchmark to see how big is the improvement in performance?
I haven't. I've run the game without and with the hook, and I've compared the fps.

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Mar 29, 2020 6:04 pm
by labc133
JeremyaFr wrote:
Mon Feb 24, 2020 5:24 pm
UPDATE
Hello,
I've uploaded the code of the d3d hook and the updated DDraw dll:
Hey Jeremy, I couldn't find ddraw.dll in that zip. :/

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Mar 29, 2020 6:34 pm
by JeremyaFr
:kopfwand:

Hello,
I've done some changes and forgot to update the links.

I've updated the links in the above post.

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Mar 29, 2020 7:32 pm
by labc133
JeremyaFr wrote:
Sun Mar 29, 2020 6:34 pm
:kopfwand:

Hello,
I've done some changes and forgot to update the links.

I've updated the links in the above post.
FPS improvement worked! But now I can't view the new hyperspace or the new laser bloom that was currently in my ddraw.dll :(

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Mar 29, 2020 7:37 pm
by JeremyaFr
The latest version of blue_max's DDraw dll is now compatible with the d3d hook.
Intall it and the effects will be back.

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Sun Mar 29, 2020 8:40 pm
by labc133
JeremyaFr wrote:
Sun Mar 29, 2020 7:37 pm
The latest version of blue_max's DDraw dll is now compatible with the d3d hook.
Intall it and the effects will be back.
Woohoo... Do you have a link for that? Sorry to be a drag, but I have no idea where that might be! :?

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Mon Mar 30, 2020 8:46 am
by JeremyaFr

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Tue Mar 31, 2020 11:28 am
by JeremyaFr
Hello,

There is now an installer for the new effects:
Installers for New Shaders, Effects (Bloom, SSAO, SSDO) and VR/TrackIR Support

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Tue Mar 31, 2020 11:23 pm
by labc133
JeremyaFr wrote:
Tue Mar 31, 2020 11:28 am
Hello,

There is now an installer for the new effects:
Installers for New Shaders, Effects (Bloom, SSAO, SSDO) and VR/TrackIR Support
Thanks Jeremy.

FPS is better, the problem is with the new ddraw.dll the shadows are off, because light from the backdrop lightsource loses intensity. Is there anyway to make blue_max 's original ddraw.dll compatible with this hook? I like that ddraw so much more. Alot of my missions are very dependent on these lights for specific ambience in the mission, and that is all lost with the new ddraw.dll.

I really appreciate your help.

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Wed Apr 01, 2020 6:41 am
by blue_max
Just wanted to post that labc133 and I worked this out offline. The settings that fixed the visuals for the VR mod were "ssao_enabled = 0" and "disable_xwa_diffuse = 0".

Re: Low FPS - Hit Escape - Come back - Fixes itself

Posted: Thu Apr 02, 2020 3:13 pm
by labc133
blue_max wrote:
Wed Apr 01, 2020 6:41 am
Just wanted to post that labc133 and I worked this out offline. The settings that fixed the visuals for the VR mod were "ssao_enabled = 0" and "disable_xwa_diffuse = 0".
Yes. Just to clarify:

Jeremy, I was able to use your hook with the Blue_Max's newest ddraw.dll and keep the older ddraw.dll settings by changing ssao_enabled to 0. The hooked worked fine with the new textures, I just preferred the old settings, basically because of the xwa light sources.

I will wait patiently for the new shaders to come out. :)

Blue_max was awesome help and so have you, Jeremy.