r/shogun2 • • Oct 26 '26

Shogun 2 Original Performance / Renderer Fixes, +50% FPS boosts

I almost forgot to post it here, thanks to u/Alien_Racist for reminding me. Copy pasta post from r/totalwar since I'm on my phone.

tl;dr s2fix (latest version) has many more updates) should now work with both Shogun 2 OG and CE, for me, it's improved my FPS by around 50% across all p50, p90, and p95 frames in a head-to-head comparison in multiple scenes and hundreds of samples per scene. Just drag and drop into your game folder (make sure to download the right version, complete-edition or original).

I made my s2 original performance fix for Shogun 2 CE after discovering that their rendering pipeline hasn't really been updated since Shogun 2 OG. I had a suspicion that most of the fixes that I found in CE could be applied to Shogun 2 OG pretty cleanly and I was right, the fundamental fixes remain the same. I've gone and applied the CE fixes onto Shogun 2 OG.

Mods should all be compatible as long as they don't touch the core game binaries since this is a rendering engine patch. I tested this with the Unofficial Shogun 2 Patch, Ultimate Expanded Field Command 2.0, Strongholds of the Samurai, and other small / assorted mods.

This ONLY works with dx11, you shouldn't be using dx9 anyway.

Original post + Github link:

https://www.reddit.com/r/shogun2/s/hId8qjA6QL

https://github.com/DudeCmonMan/s2fix

Technical tl;dr

In both Shogun 2 CE and OG, the fundamental issue is that one main thread bottlenecks the GPU, since that one thread is responsible for submitting the draw calls. The main thread calculates what to draw and then submits the draw calls to the GPU. Unfortunately, there are a lot of inefficiencies in calculating what to draw, causing the CPU to submit the draw calls much slower than the GPU can handle - leaving so much performance on the table.

The core drawing engine has a lot of duplicated calls, sorts, and artifacts from an older time. Even if the game itself has multiple worker threads, only one is used for rendering.

The fixes are usually some form of shedding main thread work onto other threads, implementing more efficient sorting and caching, or more efficient core placement to reduce context switching. Each fix is run against the expected outcome of the original game to make sure it works.

I'm actually not going to bash on OG Shogun 2's pipeline that much. To be fair to them, a lot of graphics engines in the early-2010's era were just starting to get better at async / pipeline / multi-threading methods for graphics. My gripe was not improving it from 2011 -> 2026.

The funny thing about these fixes is that they're not actually making the GPU render any faster, they're moreso getting the CPU out of the way of the GPU.

I measured performance boost across a few scenes. 30 measurements of p50, p90, and p95 per each scene. All p-values across all scenes show an improvement of around ~50%. One of those scenes for example: Avg of 142 -> 210 fps. In this same scene, we went from 40% GPU usage up to 70-80%, quite impressive - it's a lot more than I thought I would get.

For those of you interested in my setup / background

I'm a senior software developer by trade and I'm fully leaned into AI workflows / deployment. A lot my work / ideas come out of leveraging different AI's (especially local or open source ones) to do more efficiently work. This particular fix was done with a mix of different AIs.

I used Claude to plan the main approaches and various other AI's to implement the fixes (with Claude as the judge). My favorite nowadays is to use local LLMs like Flash Next to write code. Since it's local, it is 100% private - my favorite.

For harnesses, what I do is I mock the game logic via a test harness and have a replay harness that allows my AI to REPL on its own - this ensures that the fixes do what they intend to do. There's still a decent amount of manual work, but for the most part the harnesses allow the agents to grab the info they need themselves. Everything is then benchmarked with detailed metrics for A/B testing. Most of these harnesses and tooling is not included with the repo. The repo itself are only the fixes.

My favorite clients are: Claude Code, Claude Code with custom endpoints, and OpenCode.

Tangentially, I'm very happy to see so much work interest and work has been directed at making games perform better. Especially when things are so expensive, it's so great we're squeezing out what we can from what we have. I love it. My contributions will likely end at Shogun 2, it's one of my favorite games and I just don't have the time to work on it all the time. I may contribute, but I cannot lead an effort to retrofit all games.

u/SerBenDover has been doing great work on the other titles and I hope he continues it. I would prefer if all of these performance fixes were licensed under GPL-3.0, forcing them to be open source and use-with-attribution-and-always-open, but that's up to the authors.

75 Upvotes

32 comments sorted by

7

u/CaptainMarder Oct 26 '26

I wonder if Claude can find performance room in warhammer 3 too lol.

2

u/Meisgoot312 Oct 26 '26

Maybe you’re the one to find out next hah, I’m stuck in time with Shogun 2

21

u/Rusher_vii Oct 26 '26

Damn we're eating good for these last few pre skynet years

5

u/Meisgoot312 Oct 26 '26

I deliver you optimized Shogun 2, Skynet delivers Shogun 2077

4

u/Seedthrower88 Oct 26 '26

Now I don´t know what black magic you are doing, but this shit doubles my fps dude. You´re a legend!!!

1

u/Meisgoot312 Oct 26 '26

Glad to hear! Enjoy the frames 😎

3

u/liaminwales Oct 26 '26

That's so cool, good work.

2

u/Meisgoot312 Oct 26 '26

Thanks for your encouragement

2

u/ris_delucem Oct 26 '26

thanks man, gonna gave this a try tonigh

1

u/Meisgoot312 Oct 26 '26

Enjoy the new frames!

2

u/WorkerAlternative415 Oct 26 '26

You deserve a medal for all this effort!

2

u/Meisgoot312 Oct 26 '26

No need for medals, but I will take a star on my github 😉

1

u/WorkerAlternative415 Oct 26 '26

Aiight, you got it. Maybe one day we'll decompile and improve this game as a community ✌️

2

u/No-Debate-3403 Oct 26 '26

FYI for everyone involved, OG 0.2.1 release https://github.com/DudeCmonMan/s2fix/releases/download/v0.2.1/s2fix_shogun2_original_v0.2.1.zip get's flagged as virus -> `Trojan:Win32/Wacatac.C!ml`

8

u/Meisgoot312 Oct 26 '26

Not surprised, my code has memory scanning / DLL proxies / other types of injection methods into Shogun2. If you’re concerned, you can check the source code itself, it’s all there, god bless open source

OG Shogun2 has more “aggressive”patches since it uses older dx11 methods. The newest version uses switches out the dx11 swap chain with a newer approach

1

u/swagpresident1337 Oct 26 '26 edited Oct 26 '26

Awesome! Do I I just copy the extracted files from the folder in my main folder? No overwrites is correct?

3

u/Meisgoot312 Oct 26 '26

Yes correct, unless you're updating an existing version 👍 It does not overwrite anything native

1

u/kcazthe1st Oct 26 '26

Forgive my technical ignorance, but does this have any impact on the siege pathfinding freeze issue?

1

u/Meisgoot312 Oct 26 '26

Nothing to forgive. I'm not aware of that issue, so probably not. This fix is not an S2EX type fix, so it purposely does not touch game logic, only the rendering path.

1

u/Jackal93D Oct 28 '26

Great work! Is this compatible with JakeTheRipper's engine fixes?

4

u/Meisgoot312 Oct 28 '26

Yes, it should be. In my most recent update, I updated the signature checks for my fixes so that they can be applied on top of other peoples' binary fixes. It does its best to apply as many fixes as it can. Give the v0.3.0 a shot!

1

u/pizzaman6 Oct 28 '26 edited Oct 28 '26

I'm using JakeTheRipper's patch for the original game + your patch for the original game, and it gives me a message about not running with the targeted Shogun 2 build and empire.retail.dll not matching. Is that normal?

2

u/Meisgoot312 Oct 28 '26

Yeah that’s normal, it’s just telling you that the patch is being applied to a game that was modified. It’s going to try its best to apply the fixes, they may not all work. You can suppress that message with the ini option

1

u/Smugness1917 Oct 28 '26

Thanks for this.

Have you tried it on Linux with Proton?

1

u/Meisgoot312 Oct 28 '26

I don't have an easy way to test Linux yet, but I do eventually plan on doing it. Proton should work though, as long as .dlls are loaded.

1

u/djtkt0n3z Oct 26 '26

Would this fix also lead to lower GPU temperatures?

3

u/Alien_Racist Oct 26 '26

Likely higher temperatures. The mod allows the GPU to do more work (produce more frames) since it isn’t as heavily bottlenecked by the CPU. Unfortunately more work also means higher temps.

2

u/Meisgoot312 Oct 26 '26

Alien's got it exactly right 👍

1

u/Tafferwocky Oct 27 '26 edited Oct 27 '26

Does this fix improve loading times in the original too?

This mod seems to:

https://www.nexusmods.com/totalwarshogun2/mods/28?published=1

1

u/MrMxylptlyk Oct 30 '26

How did you do this? Do you have access to s2 source code?

0

u/[deleted] Oct 28 '26

[deleted] — view deleted comment

2

u/Meisgoot312 Oct 28 '26

It's not a trojan, I've explained it a few times and its written in the github releases. The release can be picked up by AV because it injects itself into Shogun 2 and patch it in realtime. All .dll based mods are at risk of being picked up by AV. All of the source code is on github and is auto-built from github. You can check it yourself.