Bay 12 Games Forum

Dwarf Fortress => DF Modding => Topic started by: RoaryStar on January 31, 2016, 06:23:22 pm

Title: Familiar Instruments Mod [WIP] v0.0.4.2
Post by: RoaryStar on January 31, 2016, 06:23:22 pm
While the new update with instruments is wonderful, I have a few problems with their procedural generation:

The last point, for me, is the most important part. So I've searched for an instrument mod, to no avail, and the old raws literally have five instruments.
That's why I've decided to make one myself.

Note: my modding is dabbling at best, and I only really know how string instruments work. Suggestions, thoughts, and corrections are not only welcome, they are encouraged.

RAW download from DFFD (v0.0.4.2) (http://dffd.bay12games.com/file.php?id=11756)
Spoiler: Changes (click to show/hide)



Completed Files (not yet tested)
Spoiler: item_instrument_violin (click to show/hide)
Spoiler: item_instrument_viola (click to show/hide)

Entity Edits



To install or test what's here so far:

To uninstall:



Planned Features (under construction)
Spoiler: Strings (click to show/hide)
Spoiler: Winds (click to show/hide)
Spoiler: Brass (click to show/hide)
Spoiler: Keyboard (click to show/hide)
Spoiler: Percussion (click to show/hide)
Spoiler: Other (click to show/hide)
Title: Re: Familiar Instruments Mod [WIP]
Post by: IndigoFenix on February 01, 2016, 12:13:16 am
Finally!  I knew someone would make something like this eventually.  Procedurally generated instruments is a neat programming trick, but for immersion purposes I'd much rather see people playing instruments I can imagine on sight rather than having to read a whole description and picture them as they are described.
Title: Re: Familiar Instruments Mod [WIP]
Post by: Putnam on February 01, 2016, 01:47:17 am
Huh. You went with violin first too?

I never really bothered making this since I figured someone else would, too.
Title: Re: Familiar Instruments Mod [WIP]
Post by: Meph on February 01, 2016, 04:12:52 am
I can be mistaken, but in the medieval times, shouldnt violins have cat-gut strings instead of metal strings?
Title: Re: Familiar Instruments Mod [WIP]
Post by: thatkid on February 01, 2016, 05:52:58 am
Serious question, that i think needs to be answered for this: If a civilization doesn't generate an instrument as per the random generation tag does it even still make music for that instrument and produce bards? Will dance forms still work correctly?
For some reason I could see issues coming up. I'm all for this, but it might be a good idea to make sure that the Generation tags aren't required for certain things to work, first.

Also: Lutes, brah
Title: Re: Familiar Instruments Mod [WIP]
Post by: sv-esk on February 01, 2016, 07:02:04 am
Civ will make forms even with only user defined instruments. Bards will carry these instruments and use them, world taverns will have instruments in chests.
But if you create adventurer you cant put points in instrument skill if civ have not generated this type of instrument.

Spoiler (click to show/hide)
Title: Re: Familiar Instruments Mod [WIP]
Post by: Bearskie on February 01, 2016, 07:09:49 am
Going to wish you good luck for this :). Also, feel free to lift any of the instruments in SLADE (http://www.bay12forums.com/smf/index.php?topic=153947.0); normal things include the triangle, didgeridoo, accordion, bagpipe, slide whistle. You could probably adapt the player piano into an normal piano pretty easily (just remove the piano roll), and things like the balalaika and the daxophone are also real life instruments.
Title: Re: Familiar Instruments Mod [WIP]
Post by: RoaryStar on February 01, 2016, 12:34:06 pm
I can be mistaken, but in the medieval times, shouldnt violins have cat-gut strings instead of metal strings?

I'm a fairly new modder; I'm not quite sure how to do that or even if it's possible.

Spoiler (click to show/hide)

That's a good idea. It's been done.

Going to wish you good luck for this :). Also, feel free to lift any of the instruments in SLADE (http://www.bay12forums.com/smf/index.php?topic=153947.0); normal things include the triangle, didgeridoo, accordion, bagpipe, slide whistle. You could probably adapt the player piano into an normal piano pretty easily (just remove the piano roll), and things like the balalaika and the daxophone are also real life instruments.

Ooh, thanks!
Title: Re: Familiar Instruments Mod [WIP]
Post by: Ghills on February 02, 2016, 10:44:36 am
I can be mistaken, but in the medieval times, shouldnt violins have cat-gut strings instead of metal strings?

I'm a fairly new modder; I'm not quite sure how to do that or even if it's possible.

As another fairly new modder, the options I see are:

1) Ignore it - these are dwarfs, of course they use metal
2) Add an option to use leather to create the strings
3) Try to mod in using nervous tissue, which might be impossible
4) Try to change butchering to create gut strings, which might be impossible
Title: Re: Familiar Instruments Mod [WIP]
Post by: Vattic on February 02, 2016, 01:00:22 pm
Funnily enough catgut was usually from sheep or goats not cats, but many domesticated animal's intestines are suitable and were used. Personally I'd just make all intestines suitable to simplify things; It's more interesting too in that you could use the guts of beasts that attack your fort.
Title: Re: Familiar Instruments Mod [WIP]
Post by: Grimlocke on February 02, 2016, 02:29:19 pm
Changing guts to be a material for strings is entirely possible, however I'm not sure if worldgen will pick up on the change and use the right material.
Title: About gut strings
Post by: sv-esk on February 02, 2016, 03:05:59 pm
material_template_default.txt contains material templates, including gut template
Spoiler: gut template (click to show/hide)
[BUTCHER_SPECIAL:MEAT:NONE] - butcher will convert guts to MEAT item.
[MEAT_NAME:prepared:intestines:intestines] - created MEAT item will be called "prepared intestines"
But you cannot specify something like [REAGENT:guts:1:MEAT:NONE:CREATURE_MAT:NONE:GUT] - so all guts can be used, not just cat guts.
Game will read CREATURE_MAT:NONE and ignore GUT

You can add [REACTION_CLASS:GUT] to gut template or concrete material (in the creature definition add [SELECT_MATERIAL:GUT][REACTION_CLASS:GUT] after [BODY_DETAIL_PLAN:STANDARD_MATERIALS])
And then use class in reaction:
[REAGENT:guts:1:MEAT:NONE:NONE:NONE] [REACTION_CLASS:GUT]

Worldgen will ignore reaction materials for tools.
Worldgen will use material specified by token ([THREAD_PLANT_MAT] or so) in tool definition (http://dwarffortresswiki.org/index.php/Tool_token).
Title: Re: Familiar Instruments Mod [WIP]
Post by: IndigoFenix on February 03, 2016, 10:30:20 am
While you can alter material templates to use animal organs, I would advise against it.  If you want this mod to play well with other mods, changing base files is a bad idea.

Keep it simple, keep it standard.  Or at the very least, if you want to use altered materials in reactions, put those reactions in a separate file and make them an optional alternative path for producing the instruments.  That way if someone wants to use this mod's instruments alongside other mods, it will minimize the extra work they have to do.
Title: Re: Familiar Instruments Mod [WIP]
Post by: Meph on February 03, 2016, 12:08:30 pm
While you can alter material templates to use animal organs, I would advise against it.  If you want this mod to play well with other mods, changing base files is a bad idea.

Keep it simple, keep it standard.  Or at the very least, if you want to use altered materials in reactions, put those reactions in a separate file and make them an optional alternative path for producing the instruments.  That way if someone wants to use this mod's instruments alongside other mods, it will minimize the extra work they have to do.
Good point. It is probably more user-friendly if done with metal too, because most people would assume that violin strings should be made of metal, not gut.
Title: Re: Familiar Instruments Mod [WIP]
Post by: Urist McGoombaBrother on February 05, 2016, 03:54:08 pm
I like this mod idea, but I am not really familiar with musical instruments and never modded them before. However as big fan of the Legend of Zelda series, I couldn't resist modding an ocarina. It is a simple one piece instrument. But to make up for that simplicity, you can create it from various different materials: Wood, Stone, Metal, Bone, Clay, Glass and even Shells. Maybe you have good use for it?

A few notes: There seems to be some weird issue regarding bones. I butchered a cow to have some bone available. But instead of just picking 1 bone and making 1 ocarina, my bone carver took the whole stack of 16 bones and made 16 ocarinas out of it. Then I butchered another animal and the same thing happened with the stack of 14 bones. Not sure if there is an error in the reaction or if that is a side effect of the carry more than one unit feature. Also I could not test the shell reaction as I had no shells available. But should be the same as with the bone reaction. The rest is working just fine.

Spoiler: item_instrument (click to show/hide)

Spoiler: Reactions (click to show/hide)

Spoiler: entity_default.txt (click to show/hide)
Title: Re: Familiar Instruments Mod [WIP]
Post by: RoaryStar on February 05, 2016, 10:16:20 pm
A few notes: There seems to be some weird issue regarding bones. I butchered a cow to have some bone available. But instead of just picking 1 bone and making 1 ocarina, my bone carver took the whole stack of 16 bones and made 16 ocarinas out of it. Then I butchered another animal and the same thing happened with the stack of 14 bones. Not sure if there is an error in the reaction or if that is a side effect of the carry more than one unit feature. Also I could not test the shell reaction as I had no shells available. But should be the same as with the bone reaction. The rest is working just fine.

Add [MAX_MULTIPLIER:1] to your reactions.

I'll be working on the mod over the weekend; hopefully I can get the orchestral strings done by Monday.
Title: Re: Familiar Instruments Mod [WIP]
Post by: Urist McGoombaBrother on February 06, 2016, 03:27:11 am
Thx, that tag solved the issue. Tested now all the reactions, also the shells by amending cows yielding them. All ocarina variants are properly built and stored in the stockpile menus and tavern as intended. So I consider that as finished. There is only one thing bothering me. I never had a dwarf actually using an ocarina despite 5 points at skill Wind Instrumentalist and no other instruments available. Unsure, if there is something more to consider or if it is just bad luck.

Please find the new raws:

Spoiler: item_instrument (click to show/hide)

Spoiler: Reactions (click to show/hide)

Spoiler: entity_default.txt (click to show/hide)
Title: Re: Familiar Instruments Mod [WIP]
Post by: Putnam on February 06, 2016, 03:32:04 am
Ocarina should use STOPPING_HOLE for pitch choice, not HARMONIC_SERIES (https://en.wikipedia.org/wiki/Harmonic_series_%28music%29), which is for stuff played by stopping a string at a harmonic point (https://en.wikipedia.org/wiki/Harmonic#Harmonics_on_stringed_instruments).

60 dB actually seems real quiet for an ocarina—I'd go with 70-80.

No way an ocarina goes two octaves below middle C. The very lowest Ocarina, the contrabass ocarina, goes one octave below it. I'd go with Alto C ocarina, PITCH_RANGE:1200:2400.

"Full" and "resonant" I wouldn't really give to an ocarina. It's a lot more, uh, focused.
Title: Re: Familiar Instruments Mod [WIP]
Post by: Urist McGoombaBrother on February 06, 2016, 04:08:02 am
Many thx for your input. Amended it above.
Title: Re: Familiar Instruments Mod [WIP]
Post by: sv-esk on February 06, 2016, 04:33:25 pm
I noticed that caravan brings parts of generated instruments. And will not bring parts of custom instruments unless you add tool tokens to entity.
And leaving bards will sometimes steal your glass assembled from imported parts on the map without sand instruments. Just like leaving scholars will steal books.
Spoiler: ENTITY tokens (click to show/hide)
Title: Re: Familiar Instruments Mod [WIP]
Post by: Urist McGoombaBrother on February 07, 2016, 09:37:38 am
I think I am going to mod an organ next. It will become a little more complex. We will see how it turns out. Might take me a few days.
Title: Re: Familiar Instruments Mod [WIP]
Post by: Urist McGoombaBrother on February 08, 2016, 02:40:46 pm
I do like to create instrument parts created from other instrument parts. The basic reaction works, but the problem is the assembled instrument part does not list the sub-parts as improvement tokens like a finished instrument does. Should be "This is a pear wood large flue pipes. The large organ pipe resonator is made from pear wood. The large organ pipe labium is made ... etc." And ideally the finished organ lists all parts and sub-parts.

Sizes and value are placeholders so far.

Spoiler: item instrument (click to show/hide)

I tried to amend the reaction in various different ways, like [IMPROVEMENT:100:tool:INSTRUMENT_PIECE:LARGE_RESONATOR:GET_MATERIAL_FROM_REAGENT:large resonator:NONE] or [IMPROVEMENT:100:tool:ORGAN_PIPE_RESONATOR_LARGE:LARGE_RESONATOR:GET_MATERIAL_FROM_REAGENT:large resonator:NONE]. But none of them seemed to work. Any ideas what's wrong or if that can be done at all?

Spoiler: reaction instrument (click to show/hide)
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.1
Post by: RoaryStar on February 08, 2016, 03:57:00 pm
Here's the first release. (http://dffd.bay12games.com/file.php?id=11756)

We have the four orchestral strings and a link to DFFD for easy installing now.

I think I'll go with keyboard instruments next.
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.1
Post by: milo christiansen on February 08, 2016, 04:06:14 pm
This is just what I need for First Landing! Your work is greatly appreciated!

(I assume it is OK to bundle this in my mod? If not let me know...)
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.1
Post by: RoaryStar on February 08, 2016, 04:24:15 pm
This is just what I need for First Landing! Your work is greatly appreciated!

(I assume it is OK to bundle this in my mod? If not let me know...)

That's perfectly fine! :)

(though you might want to test it a bit first)
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.1
Post by: sv-esk on February 08, 2016, 11:17:26 pm
Code: (errorlog.txt) [Select]
*** Error(s) finalizing the entity MOUNTAIN
Unrecognized entity instrument token: ITEM_INSTRUMENT_CELLO
Unrecognized entity tool token: PART_CELLO_BODY
Unrecognized entity tool token: PART_CELLO_NECK
Unrecognized entity tool token: PART_CELLO_BOW
Unrecognized entity tool token: PART_CELLO_OTHER
Unrecognized entity tool token: PART_CELLO_STRINGS 
Checkout errorlog before releasing.
It is VIOLONCELLO in the item_instrument_violoncello.txt, not CELLO
----------
Elves will make metal strings from wood, just like any other normally metal object. Weird thing. Not as weird as divine cloth bayan bags though(game will not check material availability for civ. It will pick up random given type(divine cloths are [THREAD_PLANT_MAT]) material).
----------
[SIZE:14820] - this token means volume in ml. Double bass is roughly 115*50*15 = 86250 at least, I think. It is bigger than human (https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Ron_plays.JPG/220px-Ron_plays.JPG)(~70000). I dont think this value excludes air inside - vanilla generated [SIZE:19000] stringed instruments are "mid-size hand-held"
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.1
Post by: RoaryStar on February 09, 2016, 02:21:31 pm
Code: (errorlog.txt) [Select]
*** Error(s) finalizing the entity MOUNTAIN
Unrecognized entity instrument token: ITEM_INSTRUMENT_CELLO
Unrecognized entity tool token: PART_CELLO_BODY
Unrecognized entity tool token: PART_CELLO_NECK
Unrecognized entity tool token: PART_CELLO_BOW
Unrecognized entity tool token: PART_CELLO_OTHER
Unrecognized entity tool token: PART_CELLO_STRINGS 
Checkout errorlog before releasing.
It is VIOLONCELLO in the item_instrument_violoncello.txt, not CELLO
----------
Elves will make metal strings from wood, just like any other normally metal object. Weird thing. Not as weird as divine cloth bayan bags though(game will not check material availability for civ. It will pick up random given type(divine cloths are [THREAD_PLANT_MAT]) material).
----------
[SIZE:14820] - this token means volume in ml. Double bass is roughly 115*50*15 = 86250 at least, I think. It is bigger than human (https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Ron_plays.JPG/220px-Ron_plays.JPG)(~70000). I dont think this value excludes air inside - vanilla generated [SIZE:19000] stringed instruments are "mid-size hand-held"

The errors will be fixed ASAP.
I guess wooden strings would work.
The game multiplies size by density, which gives weight; if we include the air inside as volume, they wouldn't be able to carry it.
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.2
Post by: swampwater on February 09, 2016, 03:21:26 pm
thanks a lot for this- something i'm pretty sure anybody who's tried to get a music industry going in their fort has wished for! i hope you don't mind i started trying to fill out the rest of the orchestra, as it were... i'm just impatient to have this fleshed out enough to get rid of the generated monstrosities for good!

instrument_item_shawm.txt
Spoiler (click to show/hide)
reaction_instrument_shawm.txt
Spoiler (click to show/hide)
entity.txt
Spoiler (click to show/hide)

item_instrument_clarinet.txt
Spoiler (click to show/hide)
reaction_instrument_clarinet.txt
Spoiler (click to show/hide)
entity.txt
Spoiler (click to show/hide)
Title: Re: Familiar Instruments Mod [WIP]
Post by: Urist McGoombaBrother on February 09, 2016, 04:04:14 pm
I do like to create instrument parts created from other instrument parts. The basic reaction works, but the problem is the assembled instrument part does not list the sub-parts as improvement tokens like a finished instrument does. Should be "This is a pear wood large flue pipes. The large organ pipe resonator is made from pear wood. The large organ pipe labium is made ... etc." And ideally the finished organ lists all parts and sub-parts.

Sizes and value are placeholders so far.

Spoiler: item instrument (click to show/hide)

I tried to amend the reaction in various different ways, like [IMPROVEMENT:100:tool:INSTRUMENT_PIECE:LARGE_RESONATOR:GET_MATERIAL_FROM_REAGENT:large resonator:NONE] or [IMPROVEMENT:100:tool:ORGAN_PIPE_RESONATOR_LARGE:LARGE_RESONATOR:GET_MATERIAL_FROM_REAGENT:large resonator:NONE]. But none of them seemed to work. Any ideas what's wrong or if that can be done at all?

Spoiler: reaction instrument (click to show/hide)

Ideas anyone?  :-\

Also within the Menu building, there is Instruments listed for bigger stationary instruments. How do I define the instrument, so it is used as such building? Can I even alter the size of the instrument, so it uses up more space like 2x3 instead of 1x1?

thanks a lot for this- something i'm pretty sure anybody who's tried to get a music industry going in their fort has wished for! i hope you don't mind i started trying to fill out the rest of the orchestra, as it were... i'm just impatient to have this fleshed out enough to get rid of the generated monstrosities for good!

The ocarina is done as well, just in case you would like to use it for this mod. (raws in this posting: http://www.bay12forums.com/smf/index.php?topic=155972.msg6793282#msg6793282).
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.2
Post by: Urist McGoombaBrother on February 14, 2016, 02:11:06 am
Finished the organ. Building an organ was always a huge undertaking, so it is in Dwarf Fortress. It consists of not less than 10 main parts, created from 30 sub parts, created from 125 raw materials. Many different materials like wood, metal, stone, glass, bone and even leather, mechansims and pipe sections can be used or are even required in some cases. For easier reference I added in-game information about all the required ingredients to each of the 166 different reactions. Also all the instrument parts and sub-parts have a custom description.

When there is a musician around, please have a brief view on the values [VOLUME_mB], [SOUND_PRODUCTION], [PITCH_CHOICE], [TUNING], [PITCH_RANGE] and [REGISTER] of the main instrument defintion. I hope those make sense.

Spoiler: organ definition (click to show/hide)

Also when someone knows, how to define the organ as a stationary instrument available via the building menu, please let me know. Bonus, when you can tell me, if it can be made so it uses up more space e.g. 2x3 instead of standard 1x1.

I upped the complete raws including the ocarina here: http://dffd.bay12games.com/file.php?id=11772
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.2
Post by: Putnam on February 14, 2016, 02:12:22 am
The example tells you how? [PLACED_AS_BUILDING] or similar IIRC

also, can't make it bigger IIRC
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.2
Post by: Urist McGoombaBrother on February 14, 2016, 02:25:41 am
Must have complete overseen it. Fixed it. Thx.
Title: Re: Familiar Instruments Mod [WIP] v0.0.4.2
Post by: Tachytaenius on March 31, 2022, 09:09:41 am
Any intent to continue with this mod?