New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for musical instruments (scale off perception) #11468
Add support for musical instruments (scale off perception) #11468
Conversation
// Check for worn or wielded - no "floating"/bionic instruments for now | ||
// TODO: Distinguish instruments played with hands and with mouth, consider encumbrance | ||
const int inv_pos = p->get_item_position( it ); | ||
if( inv_pos > 0 || inv_pos == INT_MIN ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inv_pos == 0
is inventory, too.
} else if( morale_effect < 0 && int(calendar::turn) % 10 ) { | ||
// No musical skills = possible morale penalty | ||
desc = _("You produce an annoying sound"); | ||
sounds::ambient_sound( p->posx(), p->posy(), volume, desc ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That prints the sounds twice, it's printed below again.
void musical_instrument_actor::load( JsonObject &obj ) | ||
{ | ||
moves_cost = obj.get_int( "moves_cost", 25 ); | ||
volume = obj.get_int( "volume", 99 ); // Make it huge to alert the modder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it huge to alert the modder
I don't get this. If it's mandatory, why not omit the default value and let the json parser throw an error when it's missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know parser drops errors on missing fields with no defaults.
When it costs moves, maybe a use function isn't the right thing to do. This can be very confusing for players, for example when they were used to one attack per turn (because their weapon attack speed matched their character speed). With instrument it's suddenly lower. And there is no obvious hint about this. I expect many bug reports. Maybe this is better implemented as a player activity. You could re-install the instruments from data/recycling/instruments.json, but you probably know this already.
Ignore everything I said, I can now roleplay as zombie slashing Bob Dylan. My life is complete (-: |
Yeah, that move cost thing is not ideal. I though about how to do it, but I have no better idea. I don't want to make it an activity, because it is supposed to be used when reading books, waiting for soup to boil, traveling around etc. Lowering speed maybe? Would make it less of a no-brainer when reading and crafting |
I like that. At the end of An idea (may not work):
|
fun_bonus = obj.get_int( "fun_bonus", 0 ); | ||
description_frequency = obj.get_int( "description_frequency" ); | ||
|
||
JsonArray jarr = obj.get_array( "descriptions" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use JsonObject::get_string_array
to get the full array at once.
Would effects be suited to adding slowdown? I'd add a "occupied" effect every turn with duration 1 or 2 and intensity dependent on some parameter. It would reduce speed based on intensity. |
Effects might work as well. |
I like adding an effect, it also provides a reminder that you're playing
the instrument in the player info menu.
|
OK, managed to do it using effects. It's a tiny bit ugly - I didn't find a way to re-apply an effect with lower intensity without overwriting current intensity, so I check for existing intensity before applying the new one. It is possible to play many instruments at once with no ill effects, but also no benefits. |
This looks great! Perhaps the playing an instrument effect should also tell that the morale is being improved by playing the instrument? |
On behalf of everyone who ever played an instrument (recorder & saxophone in my case), you build skill by playing it repeatedly, in horrible grindy fashion. It's boring as hell to do scales, Au Claire De La Lune, Imperium, The theme from Jurassic Park, etc repeatedly for hours on end. But in this case, grindy gameplay would be eminently realistic. I'm asking that music capability be tied to a new skill, rather than permanently tied to one's general perceptual abilities. |
Is it really that important to measure if the character is actually good at playing? If the effect remains the same, what's the purpose of a new (and very limited) skill? |
I'd imagine folks would want to play for NPCs (better musician = improved faction relations?) and/or feel that their music should improve with practice, no? |
Perhaps it could actually result in a loss of morale until you have a sufficiently high skill? The amount scaling with skill, too (ex: 1 Skill = -10 morale, 5 skill = 5 morale, 10 skill = 20 morale). |
The last one, it should probably be frustrating (demoralizing) until you
get good, then it turns the corner to being pleasurable.
|
I'd suggest morale-neutral at something like 3-4, so folks can feel like they're making progress. Minor stamina drain (varies by instrument) as playing does take energy. |
I picked a stat instead of skill, because in this case realism doesn't translate into good gameplay well. With a skill, it would just mean all survivors become great musicians later on. A rock star zombie apocalypse may sound cool at first, but then you're left with the typical DDA midgame power creep, except now with extra purely time-dependent factor. IRL skill grinding is bad for games, because here you just activate the grind and it "does itself". This adds nothing to the game, except yet another factor that distinguishes established survivors (who can wreck anything and anyone) from the new ones. In DDA, everyone becomes an independent, self-learned expert on everything after a while. EDIT: Anyway, listening to own music for the n-th time would get boring, even with tons of skills - or maybe especially with tons of skills, because you don't have that reassuring progress and "noob gains". |
OK, then perhaps have the morale peak at 4-5, then drop off and plateau at 6ish? Depending on the PC's taste for experimentation, etc (which would be good to base on a stat/stats; weighted 2 or 3 parts PE to one part IN, perhaps?) the morale bonus gets better as the char enjoys changing things up and otherwise finds music rewarding. George Carlin: "Jazz musicians are the only people I know who put in a full shift for pay, then go elsewhere and continue working for free." Results to others would be largely skill-based, providing an incentive to practice and skill-up. |
Ha, he didn't know me, did he? :P |
No, I guess not, and sorry I missed the release. Megamerge GO. |
Conflicts: src/item_factory.cpp src/iuse_actor.cpp src/iuse_actor.h
Support for modable instruments.
Instruments are active items that produce sound and morale effect. This morale effect maxes out at (configurable)
fun + fun_bonus * player->per_cur
. Perception, because it's a bad stat, no other stat/skill makes sense here (plus grinding skills just by playing music would be horrid design) and because musical skill has a lot to do with hearing.At low morale this can be a penalty - this is handled too.
Instruments consume some move points, so that they aren't totally free to use. If the player is too slow to play the instrument, it "turns off" to prevent players getting soft-locked and starving to death. They also turn off when the player goes to sleep, gets under water or drops the item.
Configurable stats are: sound volume, moves_cost, fun, fun_bonus, description_frequency and descriptions. Descriptions are strings that will be randomly picked from to describe the sound. description_frequency is the number of turns to wait between printing descriptions.
Instruments need to be wielded or worn to be played.
I added only one instrument (mostly for testing): harmonica with holder.
I had to add charges to the instrument, because otherwise it would disappear as soon as it got processed. Any better solution that doesn't involve having
(1)
in item name?