I have been looking through ranged.cpp but I can’t find anything about what exactly recoil does and how a round’s recoil value affects those calculations. What file is that code in?
Checking ranged.cpp…first sign of gameplay effects is it shows up in the caluclations for switching targets in the aim menu. Not sure if that implies recoil affects switch targets, or the opposite.
Then an effect where spending time aiming will reduce recoil, then…ah.
if( u.recoil <= aim_threshold ||
u.recoil - u.weapon.sight_dispersion( -1 ) == 0) {
// If we made it under the aim threshold, go ahead and fire.
// Also fire if we're at our best aim level already.
werase( w_target );
wrefresh( w_target );
delwin( w_target );
w_target = nullptr;
return ret;
Likely more affects, still trying to find everything.
EDIT: Additional things in player.cpp:
// This is absolute accuracy for the player.
// TODO: push the calculations duplicated from Creature::deal_projectile_attack() and
// Creature::projectile_attack() into shared methods.
// Dodge is intentionally not accounted for.
const double aim_level =
recoil + driving_recoil + get_weapon_dispersion( weapon, false );
// This is a relative measure of how steady the player's aim is,
// 0 it is the best the player can do.
const double steady_score = recoil - weapon->sight_dispersion( -1 );
// Calculates MOC of aim improvement per 10 moves, based on
// skills, stats, and quality of the gun sight being used.
// Using this weird setup because # of MOC per move is too fast, (slowest is one MOC/move)
// and number of moves per MOC is too slow. (fastest is one MOC/move)
// A worst case of 1 MOC per 10 moves is acceptable, and it scales up
// indefinitely, though the smallest unit of aim time is 10 moves.
int player::aim_per_time( item *gun ) const
{
// Account for Dexterity, weapon skill, weapon mods and flags,
int speed_penalty = 0;
// Ranges from 0 - 600.
// 0 - 10 after adjustment.
speed_penalty += skill_dispersion( gun, false ) / 60;
// Ranges from 0 - 12 after adjustment.
speed_penalty += ranged_dex_mod() / 15;
// Ranges from 0 - 10
speed_penalty += gun->aim_speed( recoil );
// TODO: should any conditions, mutations, etc affect this?
// Probably CBMs too.
int improvement_amount = std::max( 1, 32 - speed_penalty );
// Improvement rate is capped by the max aim level of the gun sight being used.
return std::min( improvement_amount, recoil - gun->sight_dispersion( recoil ) );
I’m pretty sure ammo+gun recoil is simply applied to the player’s recoil value each time a gun is fired, with some mitigation for strength and gun skill, I’d guess in fire_gun() somewhere.
Also automatic fire has half recoil applied for each round after the first, no idea if that’s at all reasonable.
Recoil is in the same units as dispersion, i.e. MoA, when it is applied it is treated as one mre source of inaccuracy, in other words we pick a random number between 0 and the dispersion number for each source, and add them together.
I didn’t know that a Meal, Ready to Eat would affect my accuracy. o3o
But still, is enlightening. All I can tell from the code is that accuracy makes taking aim more time-consuming, and that seems to affect dispersion, or at least affects accuracy and other things in the same way.
Recoil is in the same units as dispersion, i.e. MoAThis explains a lot. I'll look through fire_gun() and see what I can find. I should be able to standardize recoil and dispersion values from this.