Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 [3]

Author Topic: FPS woes  (Read 3111 times)

soulsource

  • Bay Watcher
    • View Profile
Re: FPS woes
« Reply #30 on: January 29, 2016, 05:49:41 am »

Dwarf Fortress is a x86 (32-bit) programme. Without adding any fluff, any game/programme/system that runs on 32-bit can only handle a maximum of 3.4gb of RAM, never anything more. So it doesn't matter if you have 8, 16, 32, or even 64GB, there won't be any speed difference when you run something that's based on 32-bit. Another example is the operating system Windows XP, which also runs on X86 architecture, which means that XP doesn't utilize more than 3.4GB ever, even if you have more available. Many internet browsers have the same issue too.
That's not exactly true. 32bit programs running on 64bit Linux can address up to 4 GB (minus 8 KB) of memory (source). Also, Windows XP technically would support much larger amounts of memory by using PAE, but Microsoft decided to disable this feature for economic reasons. Anyhow, the limitation of memory per process would still apply, even with PAE enabled.

Now as I've said, somewhere in the next dev-cycle Tarn wants to release a test-version running on 64-bit, which many of us are very hyped about because this could mean FPS-deaths might become a thing of the past, and maybe become extinct altogether (unless you cycle-pump every drop of magma back and forth the map or something insane like that).
64bit does two things: It doubles the length of the pointer (and on UNIX also the long) data type, and gives access to additional CPU registers. While the latter will have a beneficial effect on performance, the former will have quite a negative effect, more than compensating the gain from the additional registers for memory heavy applications. So, don't expect any improvements performance-wise when switching to a 64 bit version of dwarf fortress, except for the very, very unlikely case that Toady doesn't allow the 32 bit executable to contain SIMD instructions for whatever reason.

But it's not as simply as just altering a few lines of codes, or flicking a switch, or changing an option here and there. We're talking about the infrastructure of the game itself, the building blocks. You can't simply start chipping away at the base of a house to replace it with newer stronger bricks. You need to do it one brick at a time to make sure the house doesn't topple over.

It takes time, and it's not an easy process.

TL;DR - There's not much a fancy PC will improve about DF's speed than a system that's 8 years old. Be patient, they're working on it.
If the code is well written, doesn't rely on dirtyhorribly ugly hacks and doesn't contain assembly segments, then it should indeed be as easy as changing a compiler option.
What can (and given the complexity of dwarf fortress probably also will) happen is that bugs surface on 64bit which were hidden by the (by chance) interchangeable data types on 32bit platforms.
On Windows 32bit and 64bit data types are the same size, except for pointers, which are 64bit. As long as the code never stores a pointer value in a non-pointer data type (what I'd consider a bug...) everything should work just fine. On UNIX like operating systems the situation is more difficult, as 32 bit systems use the ILP32 memory model, while AMD64 programs use the LP64 model (source), so that the long data type is twice as long for 64bit. While on 32bit systems it'd in principle work to store data from a long data type in a variable of int data type, on 64bit this could lead to loss of data. Still this should not happen, as also on 32bit systems the compiler would complain in such a case (if one has compiler warnings enabled, but not having them enabled would require a quite a bit of masochism).
Anyhow, if one needs to rely on data type sizes, the UNIX inttypes.h file is part of the C standard since C99.

i have 16 gb of ddr3 ram, you are telling me that's not enough? plus my memory utilization right now is 25%. come on this has to be fixable or at least worked on.
Above a certain limit, which is reached when dwarf fortress and all background tasks fit into RAM, it's not the amount of RAM that's part of the low FPS problem, it's the speed of the RAM. Try to get memory with the highest clock rate supported by your CPU/mainboard combination - I'd trust the CPU specs more than the mainboard specs, as modern CPUs have the memory controller on die, and if your mainboard manufacturer claims to support faster memory, that means the board is overclocking of a part of the CPU possibly causing instability and reducing the lifetime of the CPU.
If you want to spend a lot of money, you can then try to get memory with low latencies, but the main performance effect for RAM is from the RAM clock rate.

The hard drive also makes a huge difference. I'm playing on an Intel i7 laptop, and can easily reach 147 dwarves, temperature and cave-ins on, without crippling lag. The only difference I can think of is that I have an ssd, which can read much faster than a spinning disc. If you also have an ssd, then consider your fortress layout: Lots of open space and convoluted paths can hurt FPS like nothing else.
Dwarf Fortress doesn't use the disk at all, except for loading/saving, or when having so little RAM available that the computer has to swap data from RAM to disk.


Regarding CPU speed, dwarf fortress only benefits from single thread performance. CPU cache would also have an impact, but is generally much too small on regular desktop processors to be noticeable. So, within a single generation of processors what's relevant is the clock rate. A Skylake Pentium with the same clock rate as a Skylake Core i7 will give nearly the same performance in dwarf fortress... When comparing different CPU generations or architectures one has to look up benchmark numbers, or even better, load the same dwarf fortress save game on those processors and compare the FPS. For instance at the moment it's a pain to play dwarf fortress on AMD processors, as the Bulldozer architecture and those derived from it have horribly low single thread performance.

But anyhow, no matter what computer one uses to run dwarf fortress, FPS will go down to a crawl over time if one doesn't take lots of precautions gameplay-wise. I'm currently at 7-9 fps on my AMD FX-6350, and at about 14 fps when loading the same save on my girlfriend's Haswell Core i5...
Logged
Quote from: Porkins Windu
Really, DF and Metal are practically the same. Drunkenness, Death, Depression, Depravity, Despondence, Demons, Dementia, Darkness. And thats just the D's!
Pages: 1 2 [3]