Bay 12 Games Forum

Please login or register.

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

Author Topic: Viewing Source Code  (Read 5487 times)

Gandalf

  • Escaped Lunatic
    • View Profile
Viewing Source Code
« on: July 24, 2011, 09:28:15 pm »

Wouldn't it be awesome to go through the source code of Dwarf Fortress?  I enjoyed reading the NY Times article, just downloaded it and I bet it's one hell of a program.  I was looking for it on the site but I only saw the compiled version.  Does anyone know if the developers have released the code, and if not, why not?
Logged

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: Viewing Source Code
« Reply #1 on: July 24, 2011, 09:30:35 pm »

Toady hasn't released the source code because the game is pretty much his life's project.   Further, his livelihood depends on the game's donation model.  If spinoffs started popping up, his donations would decrease.
Logged

Sphalerite

  • Bay Watcher
    • View Profile
    • Drew's Robots and stuff
Re: Viewing Source Code
« Reply #2 on: July 24, 2011, 09:45:57 pm »

Honestly, I expect that by this time the source code for DF is something like a million lines of undocumented spaghetti code, the mere attempt to read and comprehend would drive anyone but Toady insane.
Logged
Any intelligent fool can make things bigger and more complex... It takes a touch of genius --- and a lot of courage to move in the opposite direction.

Untelligent

  • Bay Watcher
  • I eat flesh!
    • View Profile
Re: Viewing Source Code
« Reply #3 on: July 24, 2011, 10:11:55 pm »

Sort of like the necronomicon with while loops.
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.

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: Viewing Source Code
« Reply #4 on: July 24, 2011, 10:25:42 pm »

Hehe Baughn is probably the only one to have ever even seen parts of the DF code.

I suppose Battle Champs is still around on the site someplace.  That had all of DF's old graphics code from the 40d versions and I'm pretty sure the soul purpose of that game was to make some source available for optimizing by the community.  The result is the DF SDL versions. 

Though that code was from way back in 2008.  Don't know how much is still used.

EDIT: Link found.
« Last Edit: July 24, 2011, 10:34:15 pm by Greiger »
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

Urist_McArathos

  • Bay Watcher
  • Nobody enjoys a good laugh more than I do.
    • View Profile
Re: Viewing Source Code
« Reply #5 on: July 24, 2011, 11:23:31 pm »

Toady hasn't released the source code because the game is pretty much his life's project.   Further, his livelihood depends on the game's donation model.  If spinoffs started popping up, his donations would decrease.

True, but I agree that it would be pretty amazing to get a peek under the hood.  I always knew Dwarf Fortress was complex, and even considered getting more into coding as a result, but in an odd twist the NY Times article put me right off that thought.

I mean, just the description of how powerful the game is was staggering, and I can't imagine that after a good decade of work the code is anything less than gargantuan and (given Tarn's clear affinity for mathematics and logic) extremely well written compared to the average.  No, best to sit back and enjoy what he's built, and maybe cobble together a mod to do what I want one day instead...
Logged
Current Community/Story Projects:
On the Nature of Dwarves

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: Viewing Source Code
« Reply #6 on: July 24, 2011, 11:27:00 pm »

extremely well written compared to the average.

There's a lot of evidence against this, especially Toady's own comments on the relative clarity of the code.  He's a math guy by trade, not a computer science guy.
Logged

Urist_McArathos

  • Bay Watcher
  • Nobody enjoys a good laugh more than I do.
    • View Profile
Re: Viewing Source Code
« Reply #7 on: July 24, 2011, 11:32:06 pm »

extremely well written compared to the average.

There's a lot of evidence against this, especially Toady's own comments on the relative clarity of the code.  He's a math guy by trade, not a computer science guy.

That makes it all the more staggering given what the game can accomplish.  I would assume that Toady is merely being humble, but your statement implies there's OTHER evidence, so I'll take your word.
Logged
Current Community/Story Projects:
On the Nature of Dwarves

Jake

  • Bay Watcher
  • Remember Boatmurdered!
    • View Profile
    • My Web Fiction
Re: Viewing Source Code
« Reply #8 on: July 24, 2011, 11:57:33 pm »

Hmmm. Perhaps a screenshot of a small part of the source-code could be an alternative to an art gift for people donating more than, say, $1000 in one year? Assuming said source code doesn't have similar properties to the Langford fractal basilisk by now, of course.
Logged
Never used Dwarf Therapist, mods or tilesets in all the years I've been playing.
I think Toady's confusing interface better simulates the experience of a bunch of disorganised drunken dwarves running a fort.

Black Powder Firearms - Superior firepower, realistic manufacturing and rocket launchers!

MetalSlimeHunt

  • Bay Watcher
  • Gerrymander Commander
    • View Profile
Re: Viewing Source Code
« Reply #9 on: July 25, 2011, 12:04:47 am »

I'd like to see Toady troll people by releasing the source in pure, virtually-unreadable machine code, but even that might be somewhat risky as there are people out there who can make some sense of machine code.

In any case, DF is so massive now that any addition to the source will almost certainly have unexpected effects to the overall game. It's like trying to pile blocks into a higher and higher structure: Eventually you'll get to the point of putting one on and having three fall off each time.
Logged
Quote from: Thomas Paine
To argue with a man who has renounced the use and authority of reason, and whose philosophy consists in holding humanity in contempt, is like administering medicine to the dead, or endeavoring to convert an atheist by scripture.
Quote
No Gods, No Masters.

Untelligent

  • Bay Watcher
  • I eat flesh!
    • View Profile
Re: Viewing Source Code
« Reply #10 on: July 25, 2011, 12:17:50 am »

I'd like to see Toady troll people by releasing the source in pure, virtually-unreadable machine code, but even that might be somewhat risky as there are people out there who can make some sense of machine code.


He could give a screenshot of a small fraction of the machine code.

Probably the bit with yog-sothoth to troll the people who try to translate it.
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.

MetalSlimeHunt

  • Bay Watcher
  • Gerrymander Commander
    • View Profile
Re: Viewing Source Code
« Reply #11 on: July 25, 2011, 12:27:56 am »

It would take forever. Machine code is crazy.


I have no idea what any of that means. I don't even know how a computer could make heads or tails of that, much less a human.
Logged
Quote from: Thomas Paine
To argue with a man who has renounced the use and authority of reason, and whose philosophy consists in holding humanity in contempt, is like administering medicine to the dead, or endeavoring to convert an atheist by scripture.
Quote
No Gods, No Masters.

Urist_McArathos

  • Bay Watcher
  • Nobody enjoys a good laugh more than I do.
    • View Profile
Re: Viewing Source Code
« Reply #12 on: July 25, 2011, 03:04:39 am »

Hmmm. Perhaps a screenshot of a small part of the source-code could be an alternative to an art gift for people donating more than, say, $1000 in one year? Assuming said source code doesn't have similar properties to the Langford fractal basilisk by now, of course.

I don't actually want to see the code, I just agreed that it would probably be an amazing experience to get to see it.  Hell, the game itself is jaw-dropping, the stuff under the hood must be insane.

Maybe when DF hits 1.0 Toady might release the source code to the community to create mods and such, if he feels the game is truly complete and his work is finished.

....knowing Toady though, IF the game reaches 1.0 in the next few decades, he'll probably just be like "Alright, Dwarf Fortress is ready for beta testing.  While the community does that, I'd better get to work on this expansion pack Zach and I thought up over the past 17 years and bring the game to 1.3!"  And then we will wait another 10 years to play the alpha of the expansion:

Slaves to Armok: God of Blood
Chapter 2: Dwarf Fortress: Mines of the Elders
Logged
Current Community/Story Projects:
On the Nature of Dwarves

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: Viewing Source Code
« Reply #13 on: July 25, 2011, 03:22:53 am »

Actually, you can see small parts of the code in the libgraphics library Baughn works on: https://github.com/Baughn/Dwarf-Fortress--libgraphics-

Caldfir

  • Bay Watcher
    • View Profile
Re: Viewing Source Code
« Reply #14 on: July 25, 2011, 03:55:07 am »

I'd like to see Toady troll people by releasing the source in pure, virtually-unreadable machine code [...]
Well, actually he has.  You can crack open the .exe with any old disassembler, but it wouldn't do you much good.  Not unless you happen to be a computer anyway. 

A person can read and write small sections of machine language, but actually going backwards and decompiling a compiled program is madness.  There exist programs set up to do this, but the code they write is almost certainly not the code that was originally written.  For all intents and purposes, compiled code is safe from prying eyes (to say nothing of the moral and legal issues with reverse-engineering).  The bottom line is that DF isn't an open-source project.  What The Toad does with The Toad's Code is a decision for (you guessed it) The Toad. 

I myself often think that it would be fun stuff to poke around with, but it isn't going to happen, and DF wouldn't be what it is today as an open-source project.  <this is an opinion>
Logged
where is up?
Pages: [1] 2 3