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 5221 times)

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: Viewing Source Code
« Reply #15 on: July 25, 2011, 04:04:36 am »

You can view the entire thing in machine code right now.

Just open the .exe in a hex editor. Granted, the code will be in hex and unreadable to most people, but still machine code!
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

thvaz

  • Bay Watcher
    • View Profile
Re: Viewing Source Code
« Reply #16 on: July 25, 2011, 04:43:37 am »

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.

I think Toady is merely being humble. You can go to Something Awful forum where a dozen of people is always saying he is a awful programmer even without seeing the source code. You can even see this some people implying this here sometimes. The only way he could prove otherwise is showing his source code, so we will never know for sure.

However, what he showed from his coding (Kobold Quest and Battlechamps) shows that he is a very organized programmer. And you can't really mantain a program with 250k+ lines of coding without a nice bit of knowledge. 

Logged

ed boy

  • Bay Watcher
    • View Profile
Re: Viewing Source Code
« Reply #17 on: July 25, 2011, 09:07:57 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.
Better solution:
-Convert the source code into morse code
-Convert the morse code into binary
-Convert that number to a 32-bit base
-Use that 32-bit base to convert the number into a file and post it
Logged

ravensword227

  • Bay Watcher
  • Nom nom nom
    • View Profile
Re: Viewing Source Code
« Reply #18 on: July 25, 2011, 09:34:41 am »

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.
Why would it be spaghetti code if Toady switched from C to C++, indicating that he probably took an object oriented programming approach, which is sort of self documenting in itself.  Not to mention how ridiculously big the game is, how regularly it is updated, doing mostly what he wants, pretty much requires it to have been structured probably better than many other programs.

Logged
Dumed Zustashlorbam, Fisherdwarf cancels Fish: Interrupted by Skeletal hammerhead shark.

Tharwen

  • Bay Watcher
    • View Profile
Re: Viewing Source Code
« Reply #19 on: July 25, 2011, 09:58:27 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.

That's not machine code, it's a text editor failing to make sense of machine code.

Really, it's a much neater set of binary instructions. That still doesn't mean humans can read it though.
Logged
[Signature]

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: Viewing Source Code
« Reply #20 on: July 25, 2011, 10:11:56 am »

Humans absolutely can read it, you just need intimate knowledge of each opcode. Most people won't bother and will just use a disassembler and some sort of tracer to find the code they're interested in.


I'm a bit of a rom hacker, so I work with assembly all the time. However, a 16 bit processor is very very very different from a 32 or 64 bit one. I can't read assembly for a windows program like I can for a super nintendo game.
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

Caldfir

  • Bay Watcher
    • View Profile
Re: Viewing Source Code
« Reply #21 on: July 25, 2011, 02:16:15 pm »

However, a 16 bit processor is very very very different from a 32 or 64 bit one. I can't read assembly for a windows program like I can for a super nintendo game.
That's not really an issue with number of bits the processor uses, but more just a result of the fact that different processors use different sets of instructions.  A 32-bit and 64-bit modern PC processor are actually very similar in therms of their public interface.  The shift between 32 and 64 bit processing is (mostly) an internal change about how to deal with memory stuff. 

I do encourage anyone with interest in the subject to go grab a disassembler and see what wacky things they can do to MS paint or whatever.  It can be a lot of fun. 
Logged
where is up?

frodo0800

  • Bay Watcher
  • Son of Ilúvatar
    • View Profile
Re: Viewing Source Code
« Reply #22 on: July 25, 2011, 05:13:34 pm »

To have the code you need to defeat : Scamps,even if you manage to do that when you start reading your eyes would be transformed in slade!
Logged

Proteus

  • Bay Watcher
    • View Profile
Re: Viewing Source Code
« Reply #23 on: July 25, 2011, 05:24:10 pm »

I definitely can understand that Toady isn´t eager to release thr sourcecode ;)

What I for myself would like to know would be simple statistic like LOC (and percentage of comments) 
Logged

Conrad

  • Bay Watcher
    • View Profile
Re: Viewing Source Code
« Reply #24 on: July 25, 2011, 06:47:43 pm »

I can only think that there is an entire comment section organized like a damned encyclopaedia if Dwarf Fortress is that complex.

That's only my second theory, though. My prevailing theory is that Toady One is actually a master-engineer and has perfected neural interfaces some years ago, choosing to create Dwarf Fortress with his mind. That's why we'll never be able to see the code.
Logged
"College? Dude, I played Dwarf Fortress. My diploma menaces with spikes of knowledge."

Drevlin

  • Bay Watcher
  • Geg Fortress
    • View Profile
Re: Viewing Source Code
« Reply #25 on: July 25, 2011, 07:07:09 pm »

But who exactly is this Baughn? Is he in the forums? Is he a Toady friend? Why Toady chose him?
Logged

Aklyon

  • Bay Watcher
  • Fate~
    • View Profile
Re: Viewing Source Code
« Reply #26 on: July 25, 2011, 07:15:05 pm »

But who exactly is this Baughn? Is he in the forums? Is he a Toady friend? Why Toady chose him?
He is the guy Toady chose for help with some graphics code. I think he's fixing the ttf support right now.
Yes he is on the forums.
Don't know why he was chosen, but I'd be interested in knowing too.
Logged
Crystalline (SG)
Sigtext
Quote from: RedKing
It's known as the Oppai-Kaiju effect. The islands of Japan generate a sort anti-gravity field, which allows breasts to behave as if in microgravity. It's also what allows Godzilla and friends to become 50 stories tall, and lets ninjas run up the side of a skyscraper.

Gatleos

  • Bay Watcher
  • Mournhold... City of Light... City of MAGIC!
    • View Profile
    • Someone Sig This
Re: Viewing Source Code
« Reply #27 on: July 25, 2011, 07:26:52 pm »

That's only my second theory, though. My prevailing theory is that Toady One is actually a master-engineer and has perfected neural interfaces some years ago, choosing to create Dwarf Fortress with his mind. That's why we'll never be able to see the code.
It's not that he's created a neural interface, he's just developed telekinesis. Rather than using a coding language, he uses his mind to flip bits directly in memory and alter the executable.
Logged
Think of it like Sim City, except with rival mayors that seek to destroy your citizens by arming legions of homeless people and sending them to attack you.
Quote from: Moonshadow101
it would be funny to see babies spontaneously combust
Gat HQ (Sigtext)
++U+U++ // ,.,.@UUUUUUUU

KaelGotDwarves

  • Bay Watcher
  • [CREATURE:FIRE_ELF]
    • View Profile
Re: Viewing Source Code
« Reply #28 on: July 25, 2011, 07:32:14 pm »

The DF code, as some have gathered from old (and perhaps leaked) portions and Toady's own admission over the years, is not elegant but is a stunning amalgamation of complexity. It is the work of a mathematician.

Quote
How many lines of code is Dwarf fortress (roughly)? What is the most complex part of the code base? Which parts do you most like and which parts do you dread?

Doing a search for semi-colons, I get 260,000 lines containing at least one semi-colon. That overcounts on the comments and undercounts on a lot of the conditionals or lines with multiple statements, but it's the way I know to get a good rough count quickly.

The new equipment management stuff has gotten fairly intricate, which is probably why it has problems. Loading/saving/generating map sections and moving them around has to do quite a bit of bookkeeping. I don't think any of my code is elegant, if I could even tell, and I don't really have favorite parts, but I appreciate my past self when I come to extend a section and it is already prepared for me. Generally, I dislike the oldest sections, especially the pre-OO** stuff which still makes up a good deal of the code and is rooted out over time as I add things.

http://www.reddit.com/r/IAmA/comments/cuvnl/tarn_adams_creator_of_dwarf_fortress_his_response/

Baughn was not chosen, it was more so that he is someone that has shown himself to be trustworthy, having helped Toady on numerous occasions with a bunch of various matters, met Toady in real life, and he has an intimate knowledge of programming in areas that Toady is not a specialist in - which led to the SDL DF version, openGL, and framerate optimisations. It's also worth noting that even Baughn hasn't seen most of the code, just the parts pertinent to the graphical updating and unlike some others in the programming know - has never done anything stupid with his knowledge.

Perhaps some of you were not around at the time, but there do exist people that try to backend DF for the sole point of leeching off game code. One jackass almost got Peterix of DFhack fame banned in the last round of stupidity.

Lysabild

  • Bay Watcher
  • Eidora Terminus Imperii Romani
    • View Profile
    • My Steam!
Re: Viewing Source Code
« Reply #29 on: July 28, 2011, 02:29:51 pm »

I think it's important to just respect Tarn's wishes regarding his game, even though I somehow personally wish he'd find a team to work with for faster updates, I severely doubt the quality would be the same, so just lay back and enjoy, wonders await for the patient.
Logged
Pages: 1 [2] 3