Some dumb sims 3 updates/stuf
Or, how to develop severe brain damage in 10 easy steps.
Sooo… This is going to be more of a blog post than anything of any real substance, more of a whinge with maybe a few teasers for some stuff I may or may not release (probably not). Feel free to skip if you're after hot tips or coherent writing.
Stutter "fixer"
Sooooo…. The sims 3 has some stutter issueeesss… Incredible discovery, I know! I started looking at remedying them with settings, found some hidden settings that help reduce some of the issues but that can only do so much when the game was made in 2009 for 2009 computers.
So I had a looky at some things I thought could be causing it, mainly WinAPI functions because that's the easier route (h-haha…), and started to try to "optimize" some of the more common ones:
ReadFile:
Was the first, and looking at the sheer volume of like 12783972198 calls a milisecond every time you move the camera, I thought surely I can speed it up a little r-right. Not really. I tried all sorts of… interesting things, file caching in memory, implementing the overlapped flag (took ages), etc. Oh and the performance increase? Literally nothing. It's called weirdly from wherever it's called and so we must suffer.
Threads:
So, I had a look at other areas that were potential targets for speedup, ran an actual profile and it showed a problem areas namely threads and some other stuff I don't remember. ZwWaitForMultipleObjects and WaitForSingleObject take up a lot of time, so I very poorly attempted to optimize them, adding some timeout optimizations (and a bunch of other failed attempts). Despite being the most insane, this actually worked, and I got like a 40% speed increase in a very very niche metric that did not noticeably effect the game one single bit. I plan to combine all my failures into a single script eventually, maybe once combined they'll do something…
Actual insanity - Memory IPC:
Then I had an idea, everyone hates e12, why don't we shove the games memory into another process and that'll fix it.
No brain moment. No clue what past me was thinking, for some reason I thought you could like, access another processes memory if it was spawned from it, but uhh.. no, that's not how things work…
I tried a few other things in a similar vein but it just crashed and crashed, so for now I'm just gunna work on:
Alloc/free mee - Current insanity:
Currently, I'm still working on VirtualAlloc and VirtualFree (which is what I was redirecting to another process), but more from an optimizing memory usage standpoint than a… whatever the IPC thing was.
There's a lot of things to try, and I've had some luck in some areas and some abysmal failures in others. There's a few promising functions calling VirtualAlloc/Free that seem to be potentially pointing towards memory leaks (004e54d0), but I'm too dumb to investigate that. At the moment, I'm going mostly just gathering more logs which takes forever and hurts my brain real bad.. On testing there's like 180 allocs that we could probably yeet no problem, which is like 750mb saved… Maybe idk.
I have plenty of ideas for deduplication, memory pool implementations to reduce churn/fragmentation, shoving things aggressively into pagefiles if they're not being used, etc. etc. Basically, there's a lot of avenues to explore, and I feel like there's potential… though I've definitely said that before and been dead wrong so…
Anyway, rambling over. I plan to release a dumb little renderer settings mod maybe-soon-ish that'll let you do dumb stuff that might be useful for reshade like turn shadows/drop shadows off and post processing off and on. I guess I could add max lots and other settings eventually too since they're static values.... Might also do a mythbusting post for some performance "tweak" stuff I see thrown around that isn't super accurate but I also don't want people to be angry at me so maybe not.
Sorry to whoever read all this, but also thanks :)