Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up[CR]Add night vision from perception, fix flashlight exploit #19010
Conversation
Coolthulhu
added some commits
Sep 20, 2016
This comment has been minimized.
This comment has been minimized.
|
Overall these numbers look too generous, especially those from |
This comment has been minimized.
This comment has been minimized.
I'm trying to keep it conservative with the current generous numbers so that it doesn't result in going back to old (pre-rework) ones. What would be good numbers? Current master has 1 for no NV trait and 6 or so with it.
I'd rather avoid thresholds like that. They encourage dumping stats and create breakpoints, while also removing rewards for bumping stats from "bad" to "mediocre". |
This comment has been minimized.
This comment has been minimized.
|
I see your point about breakpoints but the problem is a typical player ( |
mugling
self-assigned this
Oct 30, 2016
mugling
reviewed
Oct 31, 2016
| float const held_luminance = p.active_light(); | ||
| if( held_luminance > LIGHT_AMBIENT_LOW ) { | ||
| apply_light_source( p.pos(), held_luminance ); | ||
| } | ||
|
|
||
| if( held_luminance >= 4 && held_luminance > ambient_light_at( p.pos() ) - 0.5f ) { | ||
| p.add_effect( effect_haslight, 1 ); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Oct 31, 2016
Author
Contributor
The worst part is that it is in the vision code.
The problem is, there is no callback like "on player's luminance changed", since luminance is recalculated once per turn and involves effects, items and bionics.
This comment has been minimized.
This comment has been minimized.
|
For an existing save if I reduced |
This comment has been minimized.
This comment has been minimized.
|
Lit-up effect works correctly though |
This comment has been minimized.
This comment has been minimized.
Eye encumbrance? |
This comment has been minimized.
This comment has been minimized.
|
Zero encumbrance, pitch black (basement) |
This comment has been minimized.
This comment has been minimized.
|
Try debugging in NV and then removing it. It sometimes fails to update for some reason. |
This comment has been minimized.
This comment has been minimized.
|
No change |
mugling
reviewed
Oct 31, 2016
| // Range 7. | ||
| threshold = 2.65; | ||
|
|
||
| float range = get_per() / 4.0f - encumb( bp_eyes ) / 10.0f; |
This comment has been minimized.
This comment has been minimized.
mugling
Oct 31, 2016
Contributor
Should that not be
float range = get_per() / 3.0f - encumb( bp_eyes ) / 10.0f;
This comment has been minimized.
This comment has been minimized.
Coolthulhu
Oct 31, 2016
Author
Contributor
Should probably be.
But that still doesn't explain the 10 per thing.
Is 10 the threshold or just the first value tested that worked?
This comment has been minimized.
This comment has been minimized.
mugling
Oct 31, 2016
•
Contributor
If you adjust it to 3.0f you get a lower bound of PER 6 for the first increase to two tiles (which makes sense considering you get one point at PER 3 but this is masked by the default lower bound)
This comment has been minimized.
This comment has been minimized.
|
Shit, I'll need to look into it. Is the rest working fine? |
Coolthulhu commentedOct 29, 2016
Night vision was bugged: the formulas used were calculated using wrong constants and also included rounding where none was expected.
The formulas had comments indicating expected ranges, meaning that author probably expected to keep the old (pre light rework) ranges, like 2 tiles for night vision.
New values are expressed through a clean function that takes expected range as argument and use the correct constants.
The ranges in total darkness are currently ([CR]):
1 + (perception / 3) - (eye encumbrance / 10)Night vision traits don't stack - best one applies. Avian eye stacks with everything except low cap.
You can still easily wear sunglasses even if your vision isn't augmented, but if you have "round" (to nearest multiple of 3) perception and no other encumbrance, that will be noticeable in total darkness.
The range here is a radius, meaning it scales really well and NV trait will help both the low perception characters who want to avoid tripping over everything and high perception ones who want to see everything during night raids.
So, for example:
Flashlight exploit is when you apply flashlight twice in the same turn to see without being seen. This is fixed by adding a "lit up" effect if your inventory provides more light than some low constant and also more than the ambient light. The effect in turn low caps your light by that low constant for the rest of the turn.