So, I had been looking into libraries past week, and I realize now this thread isn't so old, so I'll just post what I have learned.
While a lot of info is from the old Halnoth thread, most of it actually comes from looking at the DFHack data structures, so kudos to them.
The way knowledge works is that you have that knowledge tech-grassland, with it's topics. Each histfig keeps track of which topics they do and don't know, as well as which books they've read. It also keeps track of a knowledge goal for the histfig and how many times they've performed a research action(in the DFHack api reffered to as times pondered, but it also goes up when they participate in a discussion regarding their research goal). After a certain amount of research actions (DFhack comment suggests between 40-60, I myself suspect this is tied to academic skill) the scholar gains research points in said topic(the amount of research points is definitely tied to skill level, with dabbling giving in the thousands, and competent/skilled three times as much, but there's no set numbers). According to the DF hack comments, 100K research points is necessary for a topic to be researched, and the histfig will then write a book about it.
There's still a lot I don't understand, for example, there is a certain amount of variance in how much pondering is necessary to get research points, and the research points themselves also vary for a single scholar. One time a skilled (lvl 4) geographer got 4700 research points, and the subsequent time 3700 research points.
As for skill gain...
- From my own experiments, pondering gives 0 to 5 xp in a given academic skill. Weirdly enough I have had dwarves who gained record keeper from pondering as well, but also dwarves who have not gained any. I am still trying to figure out what is up here. From my tests a scholar will gain about 700xp in their academic field a year if they only ponder. Have not tested the effect of skill yet.
- From Halnoth's thread, discussions give 10-30 xp in a given academic skill. Halnoth also notes this trains speaker, I have not seen this, might be related to my recordkeeper weirdness above.
- Writing a book gave Halnoth 12 xp writer and 6 xp wordsmith, my one scholar got 50 xp writer and 12 xp wordsmith. Maybe the values changed between releases of DF, maybe there's another factor. Writing doesn't go up for scribes, it seems to be about composing a text, much like how I am composing this post.
- Books that aren't academic aren't tied to knowledge, your Dwarves will just occasionally write them. No idea what does affect it.
- Dwarves that get started upon embark with academic skills will not know any topics when play starts. Only histfig immigrants and visitors might know topics without reading.
From this, I can say the following:
- More important to buy/raid books than to write them yourself. Because of the bug 10231 scholars won't rediscover discovered topics (though I have not verified this yet), meaning that writing books might prove tricky, and more importantly, buying/raiding just takes far less time.
- Trying to attract wandering scholars might be a better option than to make a starting dwarf a scholar. Wandering scholars often come with a research goal half-completed, so it takes less time for them to start writing. They also know much more topics and have read far more books than any starting dwarf would. Immigrant scholars are also more useful.
- Research takes a long, long, long time. I haven't ever seen the research progress on a legendary something-or-the-other, so no idea how much effect this has. However, as long as the scholar doesn't die, they keep their research progress, suggesting that you could expel a scholar if you think a siege will end your fort, and then start a new one elsewhere and hope the scholar comes to your new fort.
- While discussions may not increase the research progress for the dwarf who doesn't deal with that topic, it does give both far more xp than pondering does. So while discussions are not useful for a hypothetical legendary scholar to research more quickly, they will speed up lower skilled dwarves much more.
With that said, I'll leave you with my DFHack script to get information about the current academic knowledge of a given dwarf:
-- View knowledge for currently selected unit
--[====[
read-knowledge
==============
View knowledge for currently selected unit
]====]
local i,unit_name
local unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor! Aborting.")
return
end
unit_name=dfhack.TranslateName(dfhack.units.getVisibleName(unit))
print("")
print("Printing data for "..unit_name)
print("======================================")
print("")
histfig = df.global.world.history.figures[(unit.hist_figure_id+1)]
firstname = histfig.name.first_name
print("Books Read:")
print("-----------")
for _,book_id in pairs(histfig.info.secret.read_books) do
for id, book in pairs(df.global.world.written_contents.all) do
if (book.id==book_id) then
bookName = book.title
print("")
print("-\t"..bookName)
style = ""
for x, s in pairs(book.styles) do
sep = " "
if (x>0) then
sep = ", "
end
style = (style..sep..df.written_content_style[s])
end
print("\ta"..style.." ".. df.written_content_type[book.type])
if book.author > -1 then
maker = df.global.world.history.figures[(book.author+1)]
makerName = maker.name.first_name
print("\tby ".. makerName)
end
end
end
end
print("")
print("Knowledge:")
print("----------")
print("")
knowledge = histfig.info.secret.knowledge
if (knowledge==nil) then return end
knowledge_goal_category = knowledge.knowledge_goal_category
knowledge_goal = knowledge.knowledge_goal
research_points = knowledge.research_points
research_percentage = (research_points/100000) *100
print("Times pondered:", knowledge.times_pondered)
print("")
knowledges = {}
knowledgeNames = {}
knowledges[0] = knowledge.philosophy
knowledges[1] = knowledge.philosophy2
knowledges[2] = knowledge.math
knowledges[3] = knowledge.math2
knowledges[4] = knowledge.history
knowledges[5] = knowledge.astronomy
knowledges[6] = knowledge.naturalist
knowledges[7] = knowledge.chemistry
knowledges[8] = knowledge.geography
knowledges[9] = knowledge.medicine
knowledges[10] = knowledge.medicine2
knowledges[11] = knowledge.medicine3
knowledges[12] = knowledge.engineering
knowledges[13] = knowledge.engineering2
for no, knowledge_type in pairs(knowledges) do
entry = 0
for name, known in pairs(knowledge_type) do
entry = entry+1
if (known==true) then
print("- ".. name)
end
if( knowledge_goal_category==no) then
for entry_g, known_g in pairs(knowledge_goal) do
if (known_g == true and entry_g==entry-1) then
print("- "..name.." (Learning: "..research_points.." / 100000 or "..research_percentage.."%)")
end
end
end
end
end
print("")
It might need some tweaking the next DFHack release as I am seeing from the
github some names got changed... It's also the first time I've ever written lua, so my apologies if I commited lua-crimes or something.