A Hat in Time

A Hat in Time

95 ratings
Increasing game performance with DXVK
By TannisRoot
A guide on how to improve FPS in "A Hat in Time" with a Direct3D 9 to Vulkan translation layer!
2
   
Award
Favorite
Favorited
Unfavorite
Description
Disclaimer: Please do not report issues or bugs you encounter in-game while using DXVK to Gears for Breakfast, as it's not officially supported by them.

Hey! If you experience performance issues in-game, there is way to fix that with an open source project called DXVK[github.com].
To summarize, it translates Direct3D 9, an outdated high level graphics API from Microsoft that's exclusive to Windows (what A Hat in Time uses), to Vulkan, a universal and open low level graphics API that is not tied to any OS or type of device. Originally, DXVK was developed to make Windows games run faster on Linux, but it turned out that it improves performance on Windows too!
By rough estimates, in some cases, it can boost FPS by 50% or even more!
Technical Requirements
To use DXVK, you have to meet certain requirements first:
1) Your graphics card has to support Vullkan 1.3:
For more information on that, you can check this Wikipedia page[en.wikipedia.org]
2) Your drivers need to be up-to-date:
Note: do not use drivers that laptop vendors have on their websites, as they often only provide very outdated ones.

To be absolutely sure that your machine supports Vulkan, you can use this very simple test program:
World's Smallest Vulkan Compatability Test[github.com]
If the test is successful, you should see a little message that says something like this:


Note: DXVK targets primarily Linux graphics drivers, so in some cases, it may not work as well or as fast on Windows. If you are feeling adventurous, you can try the game on Linux. For beginners, I recommend using Pop!_OS.
Installation
Installation of DXVK for use with A Hat in Time is extremely easy!
  1. First, you need to download DXVK from its release page [github.com]. Pick the latest version, and then download it by clicking on a file with .tar.gz extension
  2. What you've just downloaded is a TAR archive, and you need to extract it. You might need a third party archive extraction tool for that, like 7-Zip [www.7-zip.org].
  3. After you've successfully extracted it, open output directory and find x64 folder. From inside of it, copy a file named d3d9.dll . Then, you have to move that file into the same directory as game's EXE file. For me, it was located in
    C:/Program Files (x86)/Steam/steamapps/common/HatinTime/Binaries/Win64.
    For you, the destination may vary a bit, but the end folder should always be Win64, which is exactly where you need to place d3d9.dll.
And that's it! Now you just need to launch the game and see what happens.
If you've done everything right, after you launch the game, a file named `HatinTimeGame_d3d9.log` should appear near the game's executable and d3d9.dll file you've copied. If it did not and the game started just as usual, it means DXVK is not actually being used.
And if the game did not start at all, it means that you missed some information in the previous section about requirements and that either your graphics card is unsupported or your driver is too old.
Removal
In case DXVK is causing issues for you, removal of DXVK is very simple - you just need to delete d3d9.dll out of the game folder.
Quirks and known issues
The game may stutter slightly at first when loading new locations (due to shader conversion), but after that it should run just fine.
It should be mentioned that there is no guarantee that it will actually improve your performance. Mainly, the improvements come from the fact that for some reason, DXVK is less CPU-intensive than native D3D9. So in some cases, usually when you are limited not by your CPU (processor) but by GPU (graphics card) or in other situations, you might not see any improvements whatsoever, or even get worse performance.
In addition to that, this project might actually bring more issues than benefits. For example, on some machines that only have Intel graphics and not a lot of RAM, a Hat in Time might start crashing on loading screens due to lack of memory, as DXVK uses a bit more RAM than native D3D9.
Also, if you have outdated drivers, it might introduce graphical glitches:
Conclusion
I hope this guide was useful to some you and actually improved performance in A Hat in Time without introducing any issues.
If you have some time, please share your comparisons of native D3D9 vs. DXVK with some specific numbers in the comments, that kind of data is very useful ❤️
57 Comments
MLGBigSmoke35 3 Sep, 2024 @ 8:32pm 
Worth noting as well that AMD added gpl support in a recent driver.
LaserVenom 3 Sep, 2024 @ 1:22am 
Initially I actually used DXVK with A Hat in Time for quite a while, at one point I ended up with about 85 gigabytes of shaders on my system! However eventually problems started to occur due to various weird issues, before long my 16 GB of RAM was not enough to handle DXVK, so I switched back to D3D9.

However, due to some reporting I did, Jonas (Founder of Gears for Breakfast) added a new launch option specifically for DXVK: -IGNOREFATALD3D9

Regardless, whether or not you use D3D9 or DXVK is up to you, enjoy the game.
HunterCZ122 7 Sep, 2023 @ 4:55am 
If you have latest Nvidia or Intel Arc drivers on Windows, then the shaders will start pre-compiling after map load, which can introduce 100% CPU load, so wait until until the CPU usage goes down. Also on Nvidia don't forget to increase shader cache (to at least 15GB) in Nvidia Control Panel otherwise the shaders will get invalid pretty fast. Hat in Time has really huge amount of shaders (blame UE3, not game devs). Unfortunately AMD GPU drivers on Windows will still have shader compilation stutter due to lack of graphics pipeline library Vulkan extension.

@Red Guy Steam Deck has Proton, which uses DXVK already, so it will not make any difference. Actually according to my testing, Steam Deck with Windows runs much worse than SteamOS with Proton in this game.
MLGBigSmoke35 25 Aug, 2023 @ 11:48pm 
It works on windows @Red Guy, but it is intended for linux.
Red Guy 25 Aug, 2023 @ 11:47pm 
This is a must for Steam Deck users unless the software does not work on Steam Deck. i can't check if it does as I don't own one myself.
MLGBigSmoke35 10 Nov, 2022 @ 2:27pm 
How'd you get dxvk 2.0 to work? Did it require a driver update?
~Waffle~ 10 Nov, 2022 @ 9:51am 
https://github.com/doitsujin/dxvk/releases/tag/v2.0

DXVK 2.0 now available, this is a MUST for this game, can now finally keep a consistent 144fps
MLGBigSmoke35 7 Nov, 2022 @ 7:42pm 
Should be noted that in dxvk 2.0 the shader stutter might be eliminated completely. With that version dxvk now compiles shaders when the game compiles them.
TheCatMan1.0 7 Nov, 2022 @ 10:43am 
This use to work but now every time I open the game it crashes, I have updated drivers and updated the computer. Its sad really because it actually made the game run better
Resbit 3 Nov, 2022 @ 6:17pm 
Nevermind, all I had to do was turn off mods. This works wonderfully for me, thank you for the help! :steamhappy: