ndouglas / azymus

An experimental roguelike, written in Rust.
The Unlicense
6 stars 0 forks source link

Improve lighting system. #23

Closed ndouglas closed 5 years ago

ndouglas commented 5 years ago

Currently, the only light source I render is the player's, and I do it by calling a function on the tile.

Instead, I should call e.g. render() on the tile, passing the game, and the tile should render itself based on its local conditions, grabbing all light in the area, etc.

ndouglas commented 5 years ago

I did a quick-and-dirty demo (extremely inefficient [looping through every tile in a 20-tile radius] and incomplete -- no FOV, no mobile light sources) just to see what it'd look like if I did a naïve approach and just transformed tiles with each light source:

Screen Shot 2019-07-06 at 12 53 25 PM

Another screenshot with more random output:

Screen Shot 2019-07-06 at 1 06 48 PM

I think that looks pretty good. I definitely need to create some efficient data structures for handling this, though, because every tile looped through every tile in a 10-tile radius to render itself, which is insane. Also, you can definitely see hard edges on here from the 10-tile radius cutoff with lights with higher radii.

ndouglas commented 5 years ago

This is of course a far more eccentric set of conditions than I expect would ever actually exist in this game. I do have thoughts about e.g. phosphorescent mosses and light from spells, etc.

ndouglas commented 5 years ago
Screen Shot 2019-07-07 at 8 20 13 PM

Some rough edges, but I think this is good enough to move forward with.