Flashlight bug fix

Before:

After:

Bug was introduced in January 20. release. Relevant code is in map.cpp and the change is to comment out the lines you can see highlighted in the above screenshots:

   // Don't display area as shadowy if it's outside and illuminated by natural light
   else if (dist <= g->u.sight_range(g->natural_light_level())) 
   {
       lowlight_sight_range = std::max(g_light_level, natural_sight_range);
   } 

This is my first look at the source code so I have no idea what else could be impacted by this change. Anyway, I find it strange something that modifies range would manifest only on one side of the character. So the the real question for me here is what was that piece of code supposed to achieve in the first place?

In one way or another it apparently has something to do with a rim of grey dots around light edges, I guess that’s what you call “gradual night light”. Maybe not, but in any case I could not figure out what is “gradual night light” option supposed to do, I don’t see any difference.

There is another light related feature that got lost somewhere between January 20. and February release. Perhaps it was done on purpose, but I’d like it back, what’s the relevant part of the code? I think I can make some improvements with the whole light/shadows thing, so I’d like to know where in the code should I be looking at.

At the top is January 20. release and you can see a light cone from the window turns otherwise grey floor and wall tiles to blue, while terminal below runs more recent release and the effect is gone. What is relevant block of code that handles that? It’s rather obvious change so I don’t see how could that end up in a release build, was it done on purpose? Also, ground and door tiles changed from yellow to brown, where can I change those?

I think this game is pretty good as it is, but has even greater potential. So for that I’d like to improve and make some additions to light/shadows system. For the best results I’d need 256 colors, has anyone maybe looked into it and knows how simple or complicated would be to introduce some new console library that supports at least 256 colors, if such thing exists?

But more importantly I’d need to familiarize myself with the code a little bit better, to know where to even begin with, so give me some pointers how to navigate through those files. Just some basics directions, for example, I want to change dark/night tile from “#” to empty " ", where is the code for that?

And one more thing. In windows version I can adjust font width and height in FONTDATA file to 16x16 which gives me nice square output, but on Linux doesn’t seem to work. Any hints? It’s particularly nice to have square characters for vehicles and driving as 8x16 makes it look terribly distorted.

I spent 5 mins comparing the code in the before and after screenshots. I hate you.

Anyway looks nice, ill have to try it out. The weird lighting bugs in this game need to be fixed, gj.

As for the font in linux, only windows uses FONTDATA, you’ll have to change the terminal (profile) options to your desired font. Just right click the title bar in rxvt.

Tip, Ideally make a “Roguelike” profile with square font and other relevant settings so you dont have square fonts everywhere. When you will start a terminal it will be the “Default” normal profile, if you want to play a roguelike, you’ll be able to change to the “Roguelike” profile in a click or two.

As for the window-light-casting, that looks interesting, I wasn’t here when that was in, I don’t see why it would be removed (unless someone didn’t like the fact that your character had a light “halo” around him, or it was buggy)

hte34po[quote=“Tase, post:2, topic:343”]I spent 5 mins comparing the code in the before and after screenshots. I hate you.

Anyway looks nice, ill have to try it out. The weird lighting bugs in this game need to be fixed, gj.[/quote]

I made nothing new, just deleted few lines, but I have no idea if those lines are actually necessary for something else. On the other hand in the meantime I was getting familiar with the code and now I have indeed made something new, something to “try out”. It’s automatic “distance view” when driving. It shifts view forward in front of the vehicle (depending on current speed and bearing), so you can see more road in the direction the car is facing. I’ve been doing that manually to avoid traps. It feels I bit weird until you get used to it, especially if going fast since then the shift moves in more coarse steps, but I certainly find it useful since it saves me a lot of time of manually looking around.

Screenshots on the left show how it normally looks, i.e. when a car is centred on the screen, and on the right it’s the same map and situation but with ‘auto distance view’ turned on.

As for the font in linux, only windows uses FONTDATA, you'll have to change the terminal (profile) options to your desired font. Just right click the title bar in rxvt.

My console doesn’t have any such fancy options. Maybe I should try to update or something. I tried setting “VGA” boot option to 80x50 and 80x60 resolution but that didn’t work as it should and produced overlapping letters. I’ll stick with Windows for now.

Tip, Ideally make a "Roguelike" profile with square font and other relevant settings so you dont have square fonts *everywhere*. When you will start a terminal it will be the "Default" normal profile, if you want to play a roguelike, you'll be able to change to the "Roguelike" profile in a click or two.

Are you too using square fonts? I haven’t seen anyone else does it, and I’m surprised why not since 8x16 looks terribly distorted, especially vehicles.

As for the window-light-casting, that looks interesting, I wasn't here when that was in, I don't see why it would be removed (unless someone didn't like the fact that your character had a light "halo" around him, or it was buggy)

Basically I want do more gradual light drop off, with at least three colors/shades, and make it rounded. The first step to make it look better I think is to paint completely dark tiles with actual “black” instead of grey “#”, like this on the right:

Beside those I have few more changes/addition in mind and then I’ll go back to playing the game. I’d also like to include sounds and background music, and if someone can provide media files (sound effects) I’ll do it, at least for basic actions like shooting, reloading, picking up items, opening doors/crates, breaking windows, and some scary zombie sounds.