Skip to content
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

Rebalance workbench stats #30489

Merged
merged 1 commit into from
May 16, 2019

Conversation

ifreund
Copy link
Contributor

@ifreund ifreund commented May 13, 2019

Summary

SUMMARY: Balance "Rebalance workbench stats."

Purpose of change

Workbenches currently have very hand-wavy stats since I didn't put a lot of time into trying to figure out how they should work in the initial PR. This PR aims to make them somewhat more accurate and consistent, though I still don't have a solid source of real world info to draw from.

Closes #29925

Describe the solution

Furniture benches:

type multiplier mass volume
f_fake_bench_hands 1.0 30kg -> 5kg 30L -> 10L
f_fake_bench_ground 0.75 -> 0.70 50kg -> 1000kg 100L -> 1000L
f_desk 1.0 -> 1.1 100kg->200kg 100L -> 75L
f_table 1.0 -> 1.1 100kg->200kg 100L -> 75L
f_counter 1.0 -> 1.1 100kg->200kg 100L -> 75L
f_lab_bench 1.1 -> 1.15 150kg->300kg 150L -> 100L
f_workbench 1.2 250kg->500kg 250L -> 200L

The values for f_fake_bench_ground are intended to represent there not really being a limit. I would do this through a negative value, but I think that might cause errors with json loading.

Vehicle benches:

type multiplier mass volume
veh_table 1.0 -> 1.1 80kg -> 150kg 80L -> 20L
veh_table_wood 1.0 -> 1.1 80kg -> 150kg 80L -> 20L
workbench 1.2 150kg -> 300kg 150L -> 30L

The capacity of the vehicle parts has also been increased to match these volume limits.

Additional context

See issue #29925 for discussion

@ifreund ifreund added Game: Balance Balancing of (existing) in-game features. [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. labels May 13, 2019
@esotericist
Copy link
Contributor

Bit belated, but a 5kg limit for crafting with your hands seems a little bit low to me?

@kevingranade
Copy link
Member

kevingranade commented May 16, 2019

Crafting "in hands" means you're holding both the workpiece and any tools necessary in your hands, as such 5kg / 11lbs seems pretty reasonable to me. Much larger than that and you're going to start running into some pretty steep fatigue problems in short order.

Re fake_bench_ground, there's no max mass, but a single tile can't hold more than 1,000 L

https://github.com/CleverRaven/Cataclysm-DDA/blob/master/src/mapdata.cpp#L26

@Rivet-the-Zombie Rivet-the-Zombie merged commit 510a637 into CleverRaven:master May 16, 2019
@Mecares
Copy link
Contributor

Mecares commented May 16, 2019

What happens if someone tries to craft something with more than 1000L of Volume or 1000kg of weight theoretically?

@ifreund ifreund deleted the workbench-balance branch May 16, 2019 08:25
@ifreund
Copy link
Contributor Author

ifreund commented May 16, 2019

Re fake_bench_ground, there's no max mass, but a single tile can't hold more than 1,000 L

That's right, I knew there was a reason I choose that number when I wrote the initial workbench code.

What happens if someone tries to craft something with more than 1000L of Volume or 1000kg of weight theoretically?

More than 1000kg will result in the calculated speed multiplier from workbenches being 0.25. As Kevin said, 1000L is the max volume a tile can hold, so I'm not sure exactly how larger crafts would work out. We may need to consider putting a hard cap of 1000L on in progress craft size.

If anyone wants to know exactly how the multipliers are calculated, the relevant code should be pretty readable:

template<typename T>
static float lerped_multiplier( const T &value, const T &low, const T &high )
{
// No effect if less than allowed value
if( value < low ) {
return 1.0f;
}
// Bottom out at 25% speed
if( value > high ) {
return 0.25f;
}
// Linear interpolation between high and low
// y = y0 + ( x - x0 ) * ( y1 - y0 ) / ( x1 - x0 )
return 1.0f + ( value - low ) * ( 0.25f - 1.0f ) / ( high - low );
}
static float workbench_crafting_speed_multiplier( const item &craft, const tripoint &loc )
{
float multiplier;
units::mass allowed_mass;
units::volume allowed_volume;
if( loc == tripoint_zero ) {
// tripoint_zero indicates crafting from inventory
// Use values from f_fake_bench_hands
const furn_t &f = string_id<furn_t>( "f_fake_bench_hands" ).obj();
multiplier = f.workbench->multiplier;
allowed_mass = f.workbench->allowed_mass;
allowed_volume = f.workbench->allowed_volume;
} else if( const cata::optional<vpart_reference> vp = g->m.veh_at(
loc ).part_with_feature( "WORKBENCH", true ) ) {
// Vehicle workbench
const vpart_info &vp_info = vp->part().info();
if( const cata::optional<vpslot_workbench> &wb_info = vp_info.get_workbench_info() ) {
multiplier = wb_info->multiplier;
allowed_mass = wb_info->allowed_mass;
allowed_volume = wb_info->allowed_volume;
} else {
debugmsg( "part '%S' with WORKBENCH flag has no workbench info", vp->part().name() );
return 0.0f;
}
} else if( g->m.furn( loc ).obj().workbench ) {
// Furniture workbench
const furn_t &f = g->m.furn( loc ).obj();
multiplier = f.workbench->multiplier;
allowed_mass = f.workbench->allowed_mass;
allowed_volume = f.workbench->allowed_volume;
} else {
// Ground
const furn_t &f = string_id<furn_t>( "f_fake_bench_ground" ).obj();
multiplier = f.workbench->multiplier;
allowed_mass = f.workbench->allowed_mass;
allowed_volume = f.workbench->allowed_volume;
}
const units::mass &craft_mass = craft.weight();
const units::volume &craft_volume = craft.volume();
multiplier *= lerped_multiplier( craft_mass, allowed_mass, 1000_kilogram );
multiplier *= lerped_multiplier( craft_volume, allowed_volume, 1000000_ml );
return multiplier;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Game: Balance Balancing of (existing) in-game features. [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revise and Balance Workbench stats
6 participants