Bay 12 Games Forum

Please login or register.

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

Author Topic: Multhreading Dwarf fortress  (Read 13467 times)

Guedez

  • Bay Watcher
    • View Profile
Multhreading Dwarf fortress
« on: March 27, 2011, 08:20:39 pm »

After getting slow downs during year 3 i wanted to check how much of my cpu the game was using and it surprised me to see 25%

Is there any plans to make this game mult-thread? something like:

in a single thread: define what each dwarf will do
mult thread afterwards: calcule pathfind
in single thread again: move the dwarfs

etc...
Logged

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: Multhreading Dwarf fortress
« Reply #1 on: March 27, 2011, 08:21:30 pm »

At this time Toady has no plans to multithread.
Logged

Jeoshua

  • Bay Watcher
  • God help me, I think I may be addicted to modding.
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #2 on: March 27, 2011, 08:24:47 pm »

... unfortunately.
Logged
I like fortresses because they are still underground.

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #3 on: March 27, 2011, 08:35:53 pm »

Multithreading is something that is suggested fairly often and by a good number of people.  Toady has been lobbied many times about the notion, but he isn't particularly interested in taking it up. 

There are several technical reasons for why simply using all four cores isn't really going to be able to quadruple the speed of the game, and why it would cause a tremendous potential for bugs while doing it, and there are more low-hanging fruits that Toady can still reach for in improving performance. 
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

sockless

  • Bay Watcher
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #4 on: March 27, 2011, 10:41:45 pm »

Multi threading would require a lot of work. Like a couple of months to even get it working I'd imagine. All the while, he wouldn't be developing new gameplay features.

Gameplay features mean donations. They are also a lot more fun for Toady to program, he DF for himself, not for others. Multithreading wouldn't get many donations.

Also multithreading would create a lot of bugs, which people would incessantly complain about, more than they currently do.

Multithreading would have rather marked improvements, even if they aren't proportional. If we had temperature on one core, path-finding on another, fluids on another and then the rest on another, we could probably get a 200% performance improvement at least.

One of the main difficulties with multithreading is that really, it would run as slow as the slowest process. e.g. If pathfinding was the slowest process, then in order to remain synced, the temperature etc. processes would have to wait for pathfinding to finish before starting another tick.

This could be fixed by a new system instead of ticks, but that would probably require almost a complete rewrite of the code.
Logged
Iv seen people who haven't had a redheaded person in their family for quite a while, and then out of nowhere two out of three of their children have red hair.
What color was the mailman's hair?

Maklak

  • Bay Watcher
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #5 on: March 28, 2011, 06:10:21 pm »

I don't have a quote from Toady One at hand, but he mentioned that he is not doing multithreading, and even if he decides to di it, it will be stuff, like fork / join over a loop, or something simple, like that. So no separate threads for pathfinding, temeretaure, or whatever, and no task / thread pools.
Logged
Quote from: Omnicega
Since you seem to criticize most things harsher than concentrated acid, I'll take that as a compliment.
On mining Organics
Military guide for FoE mod.
Research: Crossbow with axe and shield.
Dropbox referral

Sordid

  • Bay Watcher
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #6 on: March 28, 2011, 06:15:48 pm »

Well that's a damn shame. Multi-core CPUs are already the industry standard, and we're only going to get more of the same in the future. Refusing to multithread in this situation is kinda like stubbornly insisting on using the good ol' telegraph instead of this newfangled invention called email.
*sigh*
Logged

Chocolatemilkgod

  • Bay Watcher
  • Flooding fortesses with magma since 2010
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #7 on: March 28, 2011, 06:53:26 pm »

Multi-threading would be a major pain...I don't blame him for not doing it. Doing it to a small degree might work.
Logged
Dwarf 1: This is the worst part... The calm before the battle.
Dwarf 2: And then the battle is not so bad?
Dwarf 1: Oh...right. I forgot about the battle.

Artanis00

  • Bay Watcher
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #8 on: March 29, 2011, 01:49:39 am »

Multi-threading would be a major pain...I don't blame him for not doing it. Doing it to a small degree might work.

I agree, and further, I think sockless is understating the work involved in this suggestion. Essentially, what is being asked is a redesign and rewrite from the ground up.

I am not kidding about the redesign part: multi-threaded applications are completely different from single-thread applications. You can't just fork a random function call onto a new thread (at least not in C/C++).
Logged
Git - fast, efficient, distributed version control system
Github - Free public repositories, issue tracking, wikis, downloads...

Untelligent

  • Bay Watcher
  • I eat flesh!
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #9 on: March 29, 2011, 01:51:19 am »

Well that's a damn shame. Multi-core CPUs are already the industry standard, and we're only going to get more of the same in the future. Refusing to multithread in this situation is kinda like stubbornly insisting on using the good ol' telegraph instead of this newfangled invention called email.
*sigh*

The problem with this logic is that everyone has access to email whereas multithreading is apparently very hard, especially for something as complicated as DF.
Logged
The World Without Knifebear — A much safer world indeed.
regardless, the slime shooter will be completed, come hell or high water, which are both entirely plausible setbacks at this point.

Uristocrat

  • Bay Watcher
  • Dwarven Railgunner
    • View Profile
    • DF Wiki User Page
Re: Multhreading Dwarf fortress
« Reply #10 on: March 29, 2011, 03:08:43 am »

I don't have a quote from Toady One at hand, but he mentioned that he is not doing multithreading, and even if he decides to di it, it will be stuff, like fork / join over a loop, or something simple, like that. So no separate threads for pathfinding, temeretaure, or whatever, and no task / thread pools.

The rendering code is already multithreaded.  But adding multithreading to the rest of the code would cause lots of bugs and crashes, not to mention redesign work.  That said, it doesn't really matter to us how he speeds the game up, only that it speeds up, right?  He *has* been looking for other things he can make more efficient and will continue to, I'm sure.

I'd worry more about hitting the wall with RAM first, honestly.  You can already crash by attempting too large an embark.  Maybe we'll have to have a "buy Toady a 64-bit dev machine" fundraiser someday.
Logged
You could have berries on the rocks and the dwarves would say it was "berry gneiss."
You should die horribly for this. And I mean that in the nicest possible way.

Sordid

  • Bay Watcher
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #11 on: March 29, 2011, 04:59:17 am »

The problem with this logic is that everyone has access to email whereas multithreading is apparently very hard, especially for something as complicated as DF.

Isn't that all the more reason to do it, and do it as quickly as possible? DF is only ever getting more and more complex, the longer he puts it off the harder it's going to be. And he's going to have to do it eventually.
Logged

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: Multhreading Dwarf fortress
« Reply #12 on: March 29, 2011, 05:03:44 am »

And he's going to have to do it eventually.

This isn't actually true.  And I myself personally agree that multithreading would be a good thing.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #13 on: March 29, 2011, 05:07:28 am »

Toady hasn't had any formal programming lessons. That doesn't mean he isn't able to understand and sue multi threading, but rather it means that right now there is a very good chance he's code is a mess of spaghetti. If Toady wants to start multi threading now, I think he would be better of with making Slaves III, rather then spending a year or three working just on fixing it up as it is now.

Even without taking this into account, Dwarf Fortress is not a work of profit, nor is it a banner to set the standard for what games should be. Rather, it is a work of love. Toady makes this game for one simple reason, it brings him happiness. If, one day, Toady thought decided he was done making games, then we would never see another update, and would have no right to demand one.

And I, for one, wouldn't have it any other way.

sockless

  • Bay Watcher
    • View Profile
Re: Multhreading Dwarf fortress
« Reply #14 on: March 29, 2011, 05:31:03 am »

How exactly would 64-bit make DF run faster?
Logged
Iv seen people who haven't had a redheaded person in their family for quite a while, and then out of nowhere two out of three of their children have red hair.
What color was the mailman's hair?
Pages: [1] 2 3 4