Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Poll

Having tested both 2D and STANDARD, how is 40d19 compared to 40d?

Faster, no (unknown) problems
Faster, problematic
Same speed, no (unknown) problems
Same speed, problematic
Slower, no other (unknown) problems
Slower, problematic
Doesn't work at all

Pages: 1 ... 19 20 [21] 22 23 ... 34

Author Topic: FotF: Dwarf Fortress 40d19  (Read 163294 times)

zxcvmnb

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #300 on: March 15, 2010, 07:00:49 pm »

Well, it would be quite nice to be able to modify the raws ???:'( Also, I presume that the different versions would create their own $HOME (or $HOME/.df) folders, especially as "making DF properly installable is something that will be done after not too long," presumably while there are still testing builds around and utilities which don't work with them.
Logged

bombcar

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #301 on: March 15, 2010, 09:32:16 pm »

In theory, it wouldn't be to hard to make DF take an MD5sum or similar of the RAWs and even warn you if something is out of date when trying to load a save.

But this is all fancy-stuff; it's not necessary; but a bit of it, done right, could make life simpler for newer players.
Logged

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: FotF: Dwarf Fortress 40d19
« Reply #302 on: March 16, 2010, 02:19:18 am »

Please, just don't break the 'portable' part:
Spoiler (click to show/hide)

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #303 on: March 16, 2010, 04:17:51 am »

Relax, I wasn't going to.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

vyznev

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #304 on: March 16, 2010, 09:59:23 am »

Notice how "x * dimy * 4 + y * 4" is used over and over.  My initial code was full of stuff like that as well.  But probably half my optimization gains came from simply calculating values like that into a local variable ahead of time:
Whatever compiler you're using is amazingly horrible if what you said is indeed true.  Compilers are supposed to do *exactly* what you describe on their own.  You'd have to post the assembly code associated with the C code piece as proof.  I'm pretty certain that if you're using Intel, Microsoft (VC), or gcc 3.2.x+ that the code in question would be optimised to do what you describe (very likely shoving the contents of the "base" calculation into a register if possible/available, otherwise into a temporary variable).  This is, of course, assuming you're building with -O or -O2.  And likely with gcc, there's probably an -f argument which affects the optimisation behaviour in cases like this (can't be bothered to look it up).

The relevant -f option here may well be -fstrict-aliasing.  The problem is that if, say, any of x, y and dimy are globals and screen is a pointer, then the compiler cannot be entirely sure that
Code: [Select]
screen[x * dimy * 4 + y * 4] = 0;will not change the values of x, y or dimy (since screen might point to the same area of memory they occupy), which means it will have to refetch them from memory the next time they're used.  In a tight loop, this can really kill performance.

(Rest of longish post spoilered for brevity, feel free to skip.)
Spoiler (click to show/hide)
Logged
Climbing is a strength-based skill. Elephants are very strong. Why are you surprised?

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #305 on: March 16, 2010, 11:42:25 am »

I.. see. That's kind of disturbing.

Okay, point taken. I'll make sure to do that in performance-critical code, then.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #306 on: March 16, 2010, 06:15:57 pm »

Yep. Careful micro-management cut the critically important graphicst::display function's cost by 4x.

I am most disturbed. Compilers are supposed to be smarter. Like GHC.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

bluea

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #307 on: March 16, 2010, 07:53:02 pm »

Compilers are Dwarves with the beards abstracted away.

They can pull completely amazing maneuvers, yet manage to die of thirst in the river.
Logged

Rafal99

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #308 on: March 17, 2010, 11:01:24 am »

Yeah I noticed some time ago that there parts of the code which can be possibly easily optimized.
Unfortunately I couldn't get the whole stuff to compile, and also my tests with small parts of code called separately in the long loop didn't give me any significiant results, so I gave up.

Now the code in github in file graphics.cpp is as bad as then,
except that instead of screen[x ][y][3] it is screen[x2*dimy*4 + y2*4 + 3]...
The compiler may optimize it or may not, I wouldn't count of it.
Adding some local variables here and there is a quick task and requires very little effort. Imo it is better to do it just to be sure it is efficient.

Also things like this:
Spoiler (click to show/hide)

It could be better to make a simple struct and copy one pointer instead of three.
Since all this code is inside a nested loop I would try to get as much optimization as possible.

Edit: Just noticed this code is inside the graphicst::display you posted about, it seems I was right ;)
« Last Edit: March 17, 2010, 11:09:32 am by Rafal99 »
Logged
The spinning Tantrum Spiral strikes The Fortress in the meeting hall!
It explodes in gore!
The Fortress has been struck down.

random51

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #309 on: March 17, 2010, 11:02:07 am »

Yep. Careful micro-management cut the critically important graphicst::display function's cost by 4x.

I am most disturbed. Compilers are supposed to be smarter. Like GHC.

While you're disturbed, can we throw a party assuming 40d20 will be faster? :)
Logged

Andir

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #310 on: March 17, 2010, 11:12:02 am »

Yep. Careful micro-management cut the critically important graphicst::display function's cost by 4x.

I am most disturbed. Compilers are supposed to be smarter. Like GHC.

While you're disturbed, can we throw a party assuming 40d20 will be faster? :)
That would depend if you have idle folks here and a meeting hall assigned...
Logged
"Having faith" that the bridge will not fall, implies that the bridge itself isn't that trustworthy. It's not that different from "I pray that the bridge will hold my weight."

PencilinHand

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #311 on: March 17, 2010, 12:23:04 pm »

Yep. Careful micro-management cut the critically important graphicst::display function's cost by 4x.

I am most disturbed. Compilers are supposed to be smarter. Like GHC.

While you're disturbed, can we throw a party assuming 40d20 will be faster? :)
That would depend if you have idle folks here and a meeting hall assigned...

Well, I am idle, and I have a table over here.... Now where is that Strawberry wine.
Logged

kuaera

  • Escaped Lunatic
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #312 on: March 17, 2010, 12:52:32 pm »

Just an FYI: the linux version links to libjpeg.so.8, and only libjpeg.so.62 is available on my system; making a symbolic link from libjpeg.so.8 to libjpeg.so.62 appears to work without problems, but linking to libjpeg.so would probably allow those of lesser troubleshooting skills on linux to use the game.
Logged

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #313 on: March 17, 2010, 01:52:15 pm »

The code under active development is in the "matrix" branch of the git repository; you need to look at that if you want to see how it actually works.

And yes, 40d20 should be slightly faster.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

vyznev

  • Bay Watcher
    • View Profile
Re: FotF: Dwarf Fortress 40d19
« Reply #314 on: March 17, 2010, 02:31:46 pm »

While you're disturbed, can we throw a party assuming 40d20 will be faster? :)
That would depend if you have idle folks here and a meeting hall assigned...
Well, I am idle, and I have a table over here.... Now where is that Strawberry wine.

Fun off-topic fact: If you let your dwarves do nothing but hang around in a fancy meeting hall and hold parties all the time, the socialization will keep them so happy that they'll be permanently ecstatic even if you don't give them any booze at all!  Or beds or chairs or tables, for that matter.

(In fact, my recent experiences suggest that if a bunch of idle dwarves run out of both booze and water, they may still continue happily slacking off together until they drop dead of dehydration, still ecstatic.  I haven't confirmed this in a controlled experiment yet, though.  Also, the last ones to survive might eventually become unhappy after enough of their friends have croaked.)

After a few years of non-stop partying they'll also end up superdwarvenly strong, tough and agile.  The exact mechanism by which social interaction causes them to gain these stats is unknown, but it seems reasonable to presume that it must involve more than just standing around and talking.

...we now return to your scheduled, um, programming.
Logged
Climbing is a strength-based skill. Elephants are very strong. Why are you surprised?
Pages: 1 ... 19 20 [21] 22 23 ... 34