Sep 19, 2010

Darkvision

Inspired by Nihilanth's post about vision modes, and also givin' me tiny share to the Annual Roguelike Release Party, I took a break from designin' quests and implemented darkvision to URLP.

First I had to work out the logic of havin' a light source (or not) and/or darkvision in dungeons, however, and that was more complicated than I expected. I also had to fix a bunch of bugs this caused with permanently lit spots and magical darkness.

Darkvision's visual effects were easy to implement after everything else worked. I wanted it to show stuff in grayscale like it does in D&D's 3rd edition (or was that only black & white...). All it took was a simple function, which converts a color to grayscale. I used the method I found in Wikipedia:

clr.r = clr.g = clr.b = (int)(clr.r * 0.3 + clr.g * 0.59 + clr.b * 0.11);



Also, while bouncin' around fov.cpp's code I found the four lines Ashie added, which remove the ugly nipples from FoV (which Nihilanth's game has ;)...

No comments:

Post a Comment