Bay 12 Games Forum

Dwarf Fortress => DF General Discussion => Topic started by: Mephistopheles on January 11, 2023, 07:19:35 am

Title: DF and learning to develop games
Post by: Mephistopheles on January 11, 2023, 07:19:35 am
Hi,

Long time lurker, first time poster ( I think)

I'm trying to learn how to code and have some questions.
When you download df it's compiled I believe. Is it possible somehow to look into the code for research?
Or is that impossible when compiled (sorry if I'm using terminology wrongfully).
Df's logic is almost magical to me in that regard. And I only know math not code, and figured I could reverse engineer a bit to learn c++/

Thx,

M
Title: Re: DF and learning to develop games
Post by: Mephistopheles on January 11, 2023, 07:40:07 am
Also I've just learned about SDML for ascii but obviously I need to learn C++ too
Title: Re: DF and learning to develop games
Post by: Bumber on January 11, 2023, 09:12:52 am
DF is closed-source. Only Toady and Putnam have access to the code.

The only way to figure out what's going on is to run it through a disassembler, which requires knowing assembly and is a painful slog. There is DFHack (https://github.com/DFHack/dfhack), though, where others have already reverse engineered parts so they can hack DF to do stuff. Here's (https://github.com/DFHack/dfhack/blob/v0.47.05/library/modules/Maps.cpp#L765) a function that returns the plant/tree at a given tile coordinate.

I'd say DF is not a good way to learn C++, given its complexity.