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

Add CBM Artificial Night #1724

Merged
merged 4 commits into from
Jun 27, 2013
Merged

Add CBM Artificial Night #1724

merged 4 commits into from
Jun 27, 2013

Conversation

ejseto
Copy link
Contributor

@ejseto ejseto commented Jun 24, 2013

CBM artificial night blocks out the sun, eliminating all natural light. In testing, in combination with olfactory mask and night vision, I observed zombies wander aimlessly in my vicinity. If I moved, they followed, presumably from sound. If I deactivated artificial night, they came straight for me.

It has the same rarity/installation difficulty as CBM cloak and is listed with cloak in mapitemsdef.cpp, but only costs 1/4 the power to sustain (1 per 2 turns).

@atomicdryad
Copy link
Contributor

This is stretching suspension of disbelief into the realm of Vampire the Masquerade.

@ejseto
Copy link
Contributor Author

ejseto commented Jun 24, 2013

Hey, it wasn't my idea. It was actually in the list of planned but never implemented bionics. Ok, they called it a "generator" but that's even more implausible. At least a satellite blocking the sun is actually possible, even if it's in the realm of Mr. Burns-type fatcat villians.

@Stevensonz
Copy link
Contributor

I wonder.... how many tiles does this darkness occupy? mmmm vampire mode activate..

@ejseto
Copy link
Contributor Author

ejseto commented Jun 24, 2013

Heh, it completely turns off natural light, that's why it was only 4 lines of code.

@oddbjol
Copy link
Contributor

oddbjol commented Jun 24, 2013

It covers the entire world in darkness? Sounds a bit over the top!

@kevingranade
Copy link
Member

Also it does nothing to artificial light? I'm thinking a simple way to implement would be to patch in a chunk of code at the end of map::cache_light_level() that resets nearby tiles to 0 light.

@ejseto
Copy link
Contributor Author

ejseto commented Jun 25, 2013

Well it is called "artificial night" after all. And if it just destroyed all light around you in a radius, that would basically just be a poor man's cloaking device (well, I suppose night time is also). Also, where is cache_light_level()? I couldn't find it in map.cpp or lightmap.cpp, and a full project search in code::blocks failed too (sometimes it fails searching for something that does exist though).

@i2amroy
Copy link
Contributor

i2amroy commented Jun 25, 2013

If you look at the original description making a circle of darkness is exactly what it was planned to do (to be exact it would cause darkness in a 100' radius), which personally I find a lot more believable then making it dark everywhere. :P

@Stevensonz
Copy link
Contributor

how big is a 100' radius though? 100 tiles?

@ejseto
Copy link
Contributor Author

ejseto commented Jun 25, 2013

The problem as far as I can tell is, monsters see as far as the return value of light_level(). I can't think of an easy way to do what you're asking, which is to not allow monsters to see into the player vicinity, since, as far as I can tell, the lightmap is purely cosmetic and monsters don't use it. I could simply blind them and cosmetically darken only the nearest squares around the player, but wouldn't that be kind of hacky (and also basically the same as bio_cloak)?

OK, they do also see the player if he's emitting any light or if the lightmap on his square is at LL_LOW or higher, increasing their sight range to 60. But their sight range is set to light_level() first so that would only matter at night.

@ejseto
Copy link
Contributor Author

ejseto commented Jun 25, 2013

Ok, since nobody liked the last version, I made a new one. Seeing as how monster vision doesn't consider the lightmap in daytime, this new one does 2 things: a) it returns false in game::sees_u(), the exact same way cloak does, and b) it prevents all light sources from affecting the lightmap in a 15 tile radius, which of course, only really affects the player. Now you'll have a 15 tile radius "cloud" of darkness following you around, with a 1-tile circle of vision (default night sight range), unless you have night vision (mutations/goggles/cbm), in which case it'll be larger.

@KA101
Copy link
Contributor

KA101 commented Jun 25, 2013

Great. Probably should have a notification that it's on, just for those Full Night Vision folks who wouldn't see the circle.

(Maybe have the "POW" light up when there's an active bionic draining power?)

@@ -39,16 +39,21 @@ void map::generate_lightmap(game* g)
// the lightmap when in less than total sunlight.
lm[sx][sy] = natural_light;
}
if (g->u.has_active_bionic("bio_night") && rl_dist(sx, sy, g->u.posx, g->u.posy) < 15)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this into its own loop? This is one of the few performance-sensitive pieces of code in the game, and I'm wary of having an additional branch for each square. Also has_active_bionic does a surprising amount of work.

@ejseto
Copy link
Contributor Author

ejseto commented Jun 26, 2013

Ok, added a message every 5 turns when it's active (if that's not enough, there's the fact that your vision will be surrounded by a ring of blackness (even with full night vision it'll be 3 tiles wide, assuming your window is large enough to see it) and your power will be draining very fast, second only to cloak itself), and took out all the checks and just added a loop at the end to zero out the lightmap.

@KA101
Copy link
Contributor

KA101 commented Jun 26, 2013

Ah. I'd found that FNV made it practically impossible to tell night from day (granted...) without consulting the clock back in 02Feb, and haven't yet gotten a character to the Mutagen-making point in these new versions. Thanks, in any event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants