Bay 12 Games Forum

Please login or register.

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

Author Topic: What language is Dwarf Fortress made in?  (Read 47978 times)

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #30 on: September 10, 2010, 02:36:17 pm »

Professional game developers usually license an engine(that usually has a codebase that predates java). To assume the guts of those engines is not in assembly is absurd. It is hard to tell because the current code behind those engines is not open. Still, the source for engines id software has open sourced are full of assembly and those couldn't be ported to Java or C without a huge performance loss.
I am a professional game developer, with a shipped xbox360/ps3/pc game on my resume. Trust me when I say the only assembly I remember seeing in the engine (UE3 btw, we have a source code license to it) was in the vector/matrix operators.

You could write an engine from scratch. It would suck compared to what is out there, but lets ignore that. If you were starting from scratch, you might as well use Java with opengl bindings. You would finish the project faster and get free portability. The left-over time could be used to profile the code to run faster than the c++ version that just squeaked out the door. It happens all the time in the business world....
Starting from scratch isn't THAT hard. I don't really see much difference between using OpenGL+C++ and using Java (you can be cross-platform either way), except the C++ version is faster, easier to debug, uses less memory...
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

ZCM

  • Bay Watcher
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #31 on: September 10, 2010, 02:40:33 pm »

Here is what it would look like in C as a virtual:
Spoiler (click to show/hide)
Real compilers use a pointer to a table of function pointers* (the vtable), not a switch on an int. But yours is close enough to get the idea.

* And assorted other info used by things like dynamic_cast.
Logged
Badger badgers badger badger badgers badgers badger.

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #32 on: September 10, 2010, 02:56:47 pm »

Incidentally, if you're wondering whether it'd be *possible* to write DF in assembly (regardless of any performance advantages it may bring), note that RollerCoaster Tycoon (http://en.wikipedia.org/wiki/RollerCoaster_Tycoon) was written 99% in assembly, with some C bindings to let the game interface with Windows.

Given that it's a sandbox game that gives the player considerable freedom to build and experiment just like DF, that's... incredible.
Based on the transport tycoon engine, though heavily modified. Both games are a huge favourite of mine.
There's a reason the openttd guys converted transport tycoon to c/c++ though...
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

claer_runway

  • Bay Watcher
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #33 on: September 10, 2010, 04:05:24 pm »

man, rct3 sucked so hard. the first two could run on almost anything, but the third needed a modern (at the time) machine.
Logged
You can't program common sense.

like Skies of Arcadia?:
http://www.youtube.com/user/clearrunway

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #34 on: September 10, 2010, 04:16:34 pm »

Professional game developers usually license an engine(that usually has a codebase that predates java). To assume the guts of those engines is not in assembly is absurd. It is hard to tell because the current code behind those engines is not open. Still, the source for engines id software has open sourced are full of assembly and those couldn't be ported to Java or C without a huge performance loss.
I am a professional game developer, with a shipped xbox360/ps3/pc game on my resume. Trust me when I say the only assembly I remember seeing in the engine (UE3 btw, we have a source code license to it) was in the vector/matrix operators.

So you're saying that the part where speed matters, manipulating the actual wireframes, is done in assembly? The parts where speed doesn't matter is in C++? Color me surprised. Why don't they write those parts in C++? That is because it would be slow as shit.

Reminds me of the early days of ps2 development, where people were doing matrix transformations in C instead of using the facilities the ps2 gave you. Were people too stupid or too lazy to read the attached pdfs and source code examples? I don't know, but their games made the ps2 look bad.

My opinion: you know little about performance, assembly, or java.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

ZCM

  • Bay Watcher
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #35 on: September 10, 2010, 04:41:26 pm »

My opinion: you know little about performance, assembly, or java.

My opinion: John Carmack knows a lot about performance. And you know what he said back in 1994?
Quote
Although it has often been theorized that Id uses a lot of assembly language in its development, the main language used is ANSI C. “Assembly language is almost dead,” declares Carmack. “Doom has only two assembler routines: one to vertically stretch a column and the other to horizontally texture-map a row. Everything else is in C.”

If all of Doom was written in assembler and the programmer could manage the overhead correctly, Carmack theorizes it would only make the game 15 percent faster. And, although the main raycasting trace in Wolfenstein was written in assembly language, Carmack says he could write Wolfenstein faster in C because of today’s better algorithm technology.
Since then I hear that he's given up assembly coding entirely, but I can't find a good source for that.
Logged
Badger badgers badger badger badgers badgers badger.

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #36 on: September 10, 2010, 05:15:17 pm »

Oh really? Doom? That wasn't even a 3d game. It was a 2d game that simulated 3d. Additionally, doom predates SSE.

http://games.slashdot.org/comments.pl?sid=3040&cid=1454804

This all changed when John Carmack actually wrote a 3d game.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #37 on: September 10, 2010, 06:24:22 pm »

So you're saying that the part where speed matters, manipulating the actual wireframes, is done in assembly? The parts where speed doesn't matter is in C++? Color me surprised. Why don't they write those parts in C++? That is because it would be slow as shit.
Just the implementation of the matrix multiply etc functions. Functions where using specific assembly instructions that aren't available as normal c++ operators (e.g. SSE) is beneficial. And even then I'm sure I saw compiler vector intrinsics instead of assembly being used for some of the platforms, I'll check on Monday.
And you're sadly mistaken if you think speed doesn't matter anywhere else...

And for the record, the matrix ops aren't used for "manipulating the wireframes". Transformation of mesh vertices is much better handled by the GPU.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Sowelu

  • Bay Watcher
  • I am offishially a penguin.
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #38 on: September 10, 2010, 06:50:07 pm »

AND VI IS BETTER THAN EMACS!!!!!!!
Logged
Some things were made for one thing, for me / that one thing is the sea~
His servers are going to be powered by goat blood and moonlight.
Oh, a biomass/24 hour solar facility. How green!

h3lblad3

  • Bay Watcher
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #39 on: September 10, 2010, 07:09:30 pm »

Fastest language. Hands down.

And this is coming from a guy who knows nothing about programming at all.  ;)
Logged
I was talking about importing alimunim.
And we were hypothesising about the sexual relations between elves and trees.

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #40 on: September 10, 2010, 11:30:59 pm »

Neat, it has been a few years since I had to work on a visualization project. I didn't know GPUs became  magic wands that handled all intensive tasks.

I should get rid of my i7 and get a p4 since there is no heavy lifting in graphics processing anymore that would benefit from assembly.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

ZCM

  • Bay Watcher
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #41 on: September 11, 2010, 03:25:22 am »

I should get rid of my i7 and get a p4 since there is no heavy lifting in graphics processing anymore that would benefit from assembly.
You are begging the question. There's still heavy lifting, the dispute is whether it would benefit from assembly.
Logged
Badger badgers badger badger badgers badgers badger.

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #42 on: September 11, 2010, 04:08:09 am »

Neat, it has been a few years since I had to work on a visualization project. I didn't know GPUs became  magic wands that handled all intensive tasks.

I should get rid of my i7 and get a p4 since there is no heavy lifting in graphics processing anymore that would benefit from assembly.
These days if you can do it on the GPU you do. The average GPU (excluding integrated chips) is an order of magnitude more powerful than the average CPU, so even if the GPU is less efficient at a particular task it'll likely still run faster. You save the CPU for complex branching problems.


I've found a reference page for SSE intrinsics for the MSVC++ compiler: http://msdn.microsoft.com/en-us/library/708ya3be%28v=VS.71%29.aspx
These largely make assembly (for the purpose of using SSE) redundant. Assembly for speed is debatable, but if you want a C++ vs assembly faceoff then name your challenge!
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

sockless

  • Bay Watcher
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #43 on: September 11, 2010, 04:28:41 am »

Well back in the day, people used to write basically all the games in asm. (Transport Tycoon, Roller coaster Tycoon etc.) This was because the C compiler couldn't make a program optimised enough to run on the current PCs. But now, with better compilers and better computers, the performance gain is far outweighed by the ease of using higher level languages, that's why I use python, because I don't do things too computationally intense.
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?

vlademir1

  • Bay Watcher
    • View Profile
Re: What language is Dwarf Fortress made in?
« Reply #44 on: September 11, 2010, 06:51:41 am »

Well back in the day, people used to write basically all the games in asm. (Transport Tycoon, Roller coaster Tycoon etc.) This was because the C compiler couldn't make a program optimised enough to run on the current PCs. But now, with better compilers and better computers, the performance gain is far outweighed by the ease of using higher level languages, that's why I use python, because I don't do things too computationally intense.

Really?  Funny, since when I was doing it in the early to mid '90s ASM was mainly used fo time critical and low level hardware access functions.  RCT was mostly written in ASM I admit, but that was mostly an exception.
Logged
Pages: 1 2 [3] 4 5 ... 10