How can Skyrim be so unoptimized? Modders do better job than

Post » Sun May 27, 2012 8:13 pm

A new mod just came out, giving up to 40% performance increase on CPU-dependent situations, like in big cities like infamous Markath and Whiterun.
People who previously had around 20-25 FPS now get closer to 30-37 FPS. In villages like Riverwood, the FPS is a lot higher as well.

This mod does this by "rewriting some x87 FPU code and inlining a whole ton of useless getter functions along the critical paths because the developers at Bethesda, for some reason, compiled the game without using any of the optimization flags for release build."
"Part of the acceleration is changing un-optimized FPU code from basic x87 instructions (mid 1990s) to SSE (1999), which was introduced with the Pentium III, and which modern compilers generally optimize for you unless you specifically tell them not to."

Here's the mod: http://www.gamesas.com/topic/1321575-rel-tesv-acceleration-layer/

The discussion topic is now: How can Skyrim be so unoptimized? Why are Bethesda using ancient, unoptimized slow code that makes the game run a lot worse? Are Bethesda's programmers simply incompetent/lazy/overlooking or do they actually have a valid reason for making the game run a lot slower?

Plea to Bethesda: It would be very appreciated if you follow through with what this mod is trying to do in a patch. Apparently, according to the modder, there's also a lot more room for optimization, but that requires an optimization compiler. The modder Arisu's words:
Spoiler
Things I'd like to note here:
  • Only a fraction of the speedup comes from using SSE2 code. The original exe also uses SSE2 code, just not in the right places where it is truly needed. This could've been prevented by using automated SSE2 vectorization and/or another math library. Interestingly, in this case, it's the dot product function that has been rewritten, which is somewhat ironically the #1 textbook example for automated vectorization in compiler demos.
  • Much of the speedup is gained by manually eliminating (only possible if the entire function can be reduced to 5 bytes or less), or at least simplifying calls along the critical code paths as far as possible. This doesn't even produce nearly as good results as an optimizing compiler could have because of many restrictions a compiler doesn't have to deal with in the first place, so every optimizing compiler can do and usually does an excellent job at this if told to do it. Skyrim would probably experience an execution speed gain of over 100% just by applying this single optimization, as it has drastic consequences to the amount of code that could be detected as being redundant and thus completely eliminated. I know that sounds exaggerated, and normally would be, but it isn't when you've read and profiled enough of the code to know just how bad the compiled code is.
  • Just 3 functions have truly been rewritten, everything else is either a variant form or an instruction-level simplification of functions consisting of things like "return *this;" which are at the very top in the profiled list because the compiler was obviously told not to inline it. So, every time a certain kind of pointer needs to be dereferenced, the game will call a lengthy function to do what can be (and is) replaced by a single instruction. Fixing this manually isn't feasible after a certain point, but the compiler can do this for the whole binary at the cost of just a few seconds extra compiling time and much better than ever possible by a human (at least at these code dimensions).
  • In general, the TESV code has pretty high register pressure. A huge part of this is simply due to the completely missing optimizations which would otherwise eliminate the unneeded allocations, but an x86_64 build would also definitely help improving this condition.
  • Jump targets are completely unaligned, including the so-called hot targets which are hit millions of times in short periods, leading to cache stress due to multiple fetches being required to execute a jump, whether correctly predicted or not. Optimizing compilers can automatically align them properly.
  • I guess I don't have to mention how bad the threading is; this isn't trivial to fix though. Just sad that it's almost 2012 and this thing can't even properly use two threads. Besides all the other obvious flaws, this is the main reason why the game is so strongly limited by the CPU. Single-core speed didn't grow nearly as much as the number of cores did. Everyone knew it 10 years ago, but back then they could still just wait for the hardware to provide the additional power needed to run the sloppy code - this trick doesn't work anymore.
Yeah, Skyrim is a nice game, but many obstacles we've got here have trivial fixes compared to the size of their respective payoffs (little to none extra coding required). Especially with over 10 million copies already sold, I somewhat expect that it will at least run on recent hardware without sub-30 framerates.

Question: Thanks for explaining (and of course for making the awesome mod). Interesting to read. Do you think you will be able to do more optimization fixes like this?
Theoretically, yes, of course. I'd currently estimate that an additional +10% could be achieved in the game executable itself using the same procedure as before. However, to fix a problematic function using only a normal person's tools, it has to be detected and isolated from the call graph, then its assembly code has to be reverse engineered, rewritten and tested until it can be replaced by a better performing variant.

Now that many of the biggest CPU hogs have been softened, there still is a lot of potential gains ahead, but acquiring them would require multiple times the work already invested for a smaller amount of additional performance. It all has to be hand-crafted - there are no tools to automate this. Worse yet, some of the work has to be redone when porting the changes to a different game version. This way, only very simple optimizations are even possible at all, due to the sheer amount of places where a call must be inlined. Most function calls suitable for inlining have a varying amount of setup and cleanup code for that function call and I just can't go through each of the (tens of!) thousands of references to figure out the optimal replacement at each point. A compiler does all this for free, within seconds - and not only for the first dozen of hottest targets, but for the whole game, which consists of millions of lines of assembly code.

My true hope is therefore that this little demo will create a demand that Bethesda must answer. Much like what happened with the LAA patch. This would be the best outcome for all and also the best base for any further optimizations that can only be hand-crafted.


Question: And did I understood you right that you said that if an optimization compiler would have been used by Bethesda from the start, we would have experienced over 100% better performance?
Yeah, pretty sure about that. The current patch doesn't modify even nearly 1% of the code, but still manages to cut the cycles per frame by 30-40%. The whole binary is full of redundant code, it's just way too much to ever do manually, but sums up quickly when eliminated by an optimizing compiler.

I'm personally really starting to doubt Bethesda's professionalism technically. I think this mod shows that modders can do a better job than Bethesda, who don't even have access to the source code. This is something Bethesda could have done themselves easily, and they could have done even more massive optimization improvements by doing this, but they didn't do it. Why? An answer from Bethesda would be appreciated, but most importantly: an active action in including something like this in a future patch would be most appreciated and welcomed.
User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Sun May 27, 2012 6:22 pm

I disagree. I have no fps problems and I believe the graphics to be astounding
User avatar
Ria dell
 
Posts: 3430
Joined: Sun Jun 25, 2006 4:03 pm

Post » Sun May 27, 2012 10:57 pm

I disagree. I have no fps problems and I believe the graphics to be astounding
So you're saying you have 60 FPS looking in the infamous places in Markath and Whiterun? Nice lie fan boyism. You're playing on a 360, and not even the people with the best rigs that money can buy get 60 FPS in these situations .
User avatar
Robert Devlin
 
Posts: 3521
Joined: Mon Jul 23, 2007 2:19 pm

Post » Sun May 27, 2012 7:08 pm

I disagree. I have no fps problems and I believe the graphics to be astounding

The graphics are astounding. I was just comparing dragons in games like Zelda and DDO compared to Skyrim to another guy and we were in agreement that Skyrim had it best.

But graphics are not code. I love Beth games, but even I won't deny that they're raw coding prowess is...less than spectacular.
User avatar
Smokey
 
Posts: 3378
Joined: Mon May 07, 2007 11:35 pm

Post » Sun May 27, 2012 5:37 pm

Simply put, release date.

Modders have all the time in the world, although seeing as how this was released so soon and without the CK, well....

I think Bethesda just overlooked a lot of things before releasing the game.
User avatar
cassy
 
Posts: 3368
Joined: Mon Mar 05, 2007 12:57 am

Post » Mon May 28, 2012 6:56 am

Simply put, release date.

Modders have all the time in the world, although seeing as how this was released so soon and without the CK, well....

I think Bethesda just overlooked a lot of things before releasing the game.
I'm not sure how long it took to for the modders to do this mod, but my guess is not that long. The game hasn't been out long either.

Having one guy work with something like this to give up to 40% performance increase in the worst situations for a few days is something a release time of 3 years simply can't justify, sorry.

Stuff like this just makes me lose complete faith in Bethesda's professionalism.
User avatar
Jessica Lloyd
 
Posts: 3481
Joined: Fri Aug 25, 2006 2:11 pm

Post » Sun May 27, 2012 5:53 pm

The graphics are astounding. I was just comparing dragons in games like Zelda and DDO compared to Skyrim to another guy and we were in agreement that Skyrim had it best.

you need to check out dark souls dragons

they have the cream of the dragon crop with great models, animations( dark souls dragons are how dragons should fly) , and diversity

I agree skyrim has better dragons than those games u mentioned
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am

Post » Mon May 28, 2012 6:22 am

Cool, I bought my wife a new laptop to play Skyrim on, so I can hog the PS3 all day, she doesn't seem to have any problems with FPS anywhere, but I'll download it for her just to be certain. Although I'v never heard of this issue until now.
User avatar
Kay O'Hara
 
Posts: 3366
Joined: Sun Jan 14, 2007 8:04 pm

Post » Sun May 27, 2012 5:10 pm

Well, considering both oblivion and skyrim were designed for the same console hardware, it's obvious the beth coding team did a spectacular job; skyrim looks leaps and bounds better than unmodded oblivion. If that mod does improve framerate so drastically though, it does make you wonder how a team of professionals can overlook something so basic.
User avatar
Sarah Knight
 
Posts: 3416
Joined: Mon Jun 19, 2006 5:02 am

Post » Sun May 27, 2012 4:11 pm

Well, considering both oblivion and skyrim were designed for the same console hardware, it's obvious the beth coding team did a spectacular job; skyrim looks leaps and bounds better than unmodded oblivion. If that mod does improve framerate so drastically though, it does make you wonder how a team of professionals can overlook something so basic.
I doubt the whole team worked on porting it to the PC, I'm suspicious as to how many PC programmers Bethesda actually employs at the moment.
User avatar
Farrah Lee
 
Posts: 3488
Joined: Fri Aug 17, 2007 10:32 pm

Post » Mon May 28, 2012 5:00 am

Really, I mean what is the purpose of a thread like this?

A mod was created that made things better for you. Be happy. Why do you have to find blame in something else or slam Bethesda as subpar coders? It is much easier to go back in hindsight and modify code than it is to originally write billions of lines.

Maybe you are right and they did make a mistake.

Maybe you are wrong and have no clue what you are talking about.

Either way the post is useless.
User avatar
Kat Ives
 
Posts: 3408
Joined: Tue Aug 28, 2007 2:11 pm

Post » Mon May 28, 2012 6:15 am

I think they are more than capable, just they are underappreciated. So just like the fireman who commits arson so he can come and save the day and be the hero. The devs do this intentionally to release a patch later on and recieve the praise of the community. Now though a modder has taken that away from the poor souls, for shame.

Or there is a reason they couldn't do it too many stability issues, time constraints, they were building an xbox game and made a PC port the safest, quicket way they could, leaving optimisation/testing across tens of thousands of possible hardware/software combinations for later.

Or marketing realised they had sold enough pre-orders and said screw it take the rest of the afternoon off guys. We'll probably never know I doubt the devs just clock in and do as they please, they have people they have to answer to aswell, manager says stick a fork in it, svcks to be a PC user.

Great mod though, thanks for the effort guys.
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Post » Mon May 28, 2012 2:11 am

One word will sum up the reason why.

CONSOLES.

The PC version is a CONSOLE PORT. It was never designed for the PC, it was just ported from the Console and then a little bit of optimization. It just shows that don't put time into the PC version because they know that when they release the game the modding community will do their work for them.

Another word will also sum it up. LAZY.
This
User avatar
Jonathan Windmon
 
Posts: 3410
Joined: Wed Oct 10, 2007 12:23 pm

Post » Sun May 27, 2012 7:50 pm

I'm confused.

Do I still need to copy the dinput8.dll to the root directory or just the TESVAL.dll to the plugins directory? Or both?
User avatar
Sweet Blighty
 
Posts: 3423
Joined: Wed Jun 21, 2006 6:39 am

Post » Mon May 28, 2012 4:33 am

Really, I mean what is the purpose of a thread like this?

A mod was created that made things better for you. Be happy. Why do you have to find blame in something else or slam Bethesda as subpar coders? It is much easier to go back in hindsight and modify code than it is to originally write billions of lines.

Maybe you are right and they did make a mistake.

Maybe you are wrong and have no clue what you are talking about.

Either way the post is useless.
This thread questions what the heck Bethesda really are doing and some problems that A LOT of people are complaining about. It's fundamental because those who can run the PC-specs wise most demanding game BF3 on smooth FPS on maxed settings can't even run Skyrim at half the FPS-rate. It's ridiculous.
This code has been in Beth's engine for over 10 years and is old as hell, even though this is a "new engine".
This thread is not pointless, but your post is.
User avatar
Kit Marsden
 
Posts: 3467
Joined: Thu Jul 19, 2007 2:19 pm

Post » Sun May 27, 2012 3:25 pm

Really, I mean what is the purpose of a thread like this?

A mod was created that made things better for you. Be happy. Why do you have to find blame in something else or slam Bethesda as subpar coders? It is much easier to go back in hindsight and modify code than it is to originally write billions of lines.

Maybe you are right and they did make a mistake.

Maybe you are wrong and have no clue what you are talking about.

Either way the post is useless.
No. You just need to stop defending laziness. The game should have been optimized for pc. Not just lazily ported. People like you need to stop blindly defending Bethesda everytime someone has a valid complaint.
User avatar
x_JeNnY_x
 
Posts: 3493
Joined: Wed Jul 05, 2006 3:52 pm

Post » Sun May 27, 2012 3:32 pm

Well, I'm sure the mod is good, but I'm struck by this quote:
and which modern compilers generally optimize for you unless you specifically tell them not to."

Which doesn't sound to me like forgetting, it sounds to me like a decision. As such, I have to presume there's a reason for that decision. Can I think of one? No, I'm not a developer.

It all comes down very clear to me: Bethesda is really bad at technology.

I wouldn't say that. I should say that Bethesda make design decisions that others might not, for reasons we don't know.
User avatar
Melanie
 
Posts: 3448
Joined: Tue Dec 26, 2006 4:54 pm

Post » Sun May 27, 2012 10:54 pm

Well, I'm sure the mod is good, but I'm struck by this quote:


Which doesn't sound to me like forgetting, it sounds to me like a decision. As such, I have to presume there's a reason for that decision. Can I think of one? No, I'm not a developer.

[u]

I wouldn't say that. I should say that Bethesda make design decisions that others might not, for reasons we don't know.
I know, that's why I want Bethesda to answer why. So far all this just makes me really doubt Bethesda's professionalism, and it's very understandable as explained above. I want answers to why the heck Bethesda hasn't done this and left unoptimized code that is over 10 years old that makes the game a lot slower in a so called "new engine".

If Bethesda steps in and says there's a valid reason, good. Until then, as said before, it just really makes me doubt Bethesda's professionalism.

Also, you shouldn't take that quote literally like that. It was just a comment from one of the people who knows about the mod. Bethesda may have neglected it completely or have a valid reason.
User avatar
Trish
 
Posts: 3332
Joined: Fri Feb 23, 2007 9:00 am

Post » Sun May 27, 2012 11:29 pm


This thread questions what the heck Bethesda really are doing and some problems that A LOT of people are complaining about. It's fundamental because those who can run the PC-specs wise most demanding game BF3 on smooth FPS on maxed settings can't even run Skyrim at half the FPS-rate. It's ridiculous.
This code has been in Beth's engine for over 10 years and is old as hell, even though this is a "new engine".
This thread is not pointless, but your post is.

No you made a lot of assumptions on parameters that you have no idea about, sighting as evidence 1 mod.

Either way not here to argue, just wanted you to know that there just may be a lot more to the big world than what you believe to be fact.

Enjoy your day ?
User avatar
Carlos Vazquez
 
Posts: 3407
Joined: Sat Aug 25, 2007 10:19 am

Post » Sun May 27, 2012 11:05 pm

No you made a lot of assumptions on parameters that you have no idea about, sighting as evidence 1 mod.

Either way not here to argue, just wanted you to know that there just may be a lot more to the big world than what you believe to be fact.

Enjoy your day ?
Which is probably why he wants to discuss it
User avatar
Alister Scott
 
Posts: 3441
Joined: Sun Jul 29, 2007 2:56 am

Post » Sun May 27, 2012 10:59 pm

Also, you shouldn't take that quote literally like that. It was just a comment from one of the people who knows about the mod. Bethesda may have neglected it completely or have a valid reason.

Well, if I can turn this back around, you used the same quote to support the conclusion that "Bethesda is really bad at technology". So are you now reducing your accusation to something more reasonable, bearing in mind the real possibility that Bethesda have a valid reason? :smile:
User avatar
Miss Hayley
 
Posts: 3414
Joined: Tue Jun 27, 2006 2:31 am

Post » Sun May 27, 2012 8:57 pm

So you're saying you have 60 FPS looking in the infamous places in Markath and Whiterun? Nice lie fan boyism. You're playing on a 360, and not even the people with the best rigs that money can buy get 60 FPS in these situations .
yes.
User avatar
Conor Byrne
 
Posts: 3411
Joined: Wed Jul 11, 2007 3:37 pm

Post » Sun May 27, 2012 6:45 pm

yes.
Are you playing on ultra/high graphics though?
User avatar
Sam Parker
 
Posts: 3358
Joined: Sat May 12, 2007 3:10 am

Post » Sun May 27, 2012 7:33 pm

He's on xbox, the platform the game was designed for. He gets an optimised game off the shelf, I get this mod, balance/crafting mods and sailor moon armors later on. Swings and roundabouts.
User avatar
Anna Watts
 
Posts: 3476
Joined: Sat Jun 17, 2006 8:31 pm

Post » Sun May 27, 2012 3:23 pm

I think they are more than capable, just they are underappreciated. So just like the fireman who commits arson so he can come and save the day and be the hero.

Worse comparison ever. As a firefighter myself what you just described is a criminal act and that guy among peers is no longer a hero... Oh and be the way, 95+% of firefighters don't do it for the glory or to be recognized as a hero. It's a very small group that think they need to be heroes to be appreciated.
User avatar
Cartoon
 
Posts: 3350
Joined: Mon Jun 25, 2007 4:31 pm

Next

Return to V - Skyrim