lethal-guitar / RigelEngine

A modern re-implementation of the classic DOS game Duke Nukem II
GNU General Public License v2.0
914 stars 60 forks source link

Add an option to darken the background (leaving solid tiles, enemies and items unaffected) #833

Open Calinou opened 2 years ago

Calinou commented 2 years ago

When playing, I find it hard to focus on enemies and items since the background is just as bright as foreground elements. This is noticeable right away in the very first level of episode 1, but it's something I experienced on several levels.

Would it be possible to have an option that darkens the background tiles and parallax skies by 50%, but leaves solid tiles, enemies and items unaffected? Combined with the smooth movement option, this could provide better accessibility for the game.

I have a WIP implementation which is working well, but it darkens solid tiles as well: https://github.com/Calinou/RigelEngine/tree/add-darken-background-option It might not be a problem in practice, but I still need to make it a toggleable option before I can open a PR.

Without darkening With darkening
2022-03-14_01 25 27 2022-03-14_01 23 21

Edit: The way I'm doing it also doesn't catch nonsolid tiles with partial transparency:

image

lethal-guitar commented 2 years ago

Ah that's a nice idea! Sounds good, I'm happy to look into it. Thanks for sharing your WIP implementation, I'll check it out as soon as I have time!

lethal-guitar commented 2 years ago

@Calinou

Edit: The way I'm doing it also doesn't catch nonsolid tiles with partial transparency:

Ah, the semi-transparent portions of the animated flames in that level are actually actors, not tiles. So to have them included in the darkening would require some kind of tagging as "background element", and then applying the darkening in the sprite rendering system.

See https://github.com/lethal-guitar/RigelEngine/blob/71161705a15122d729b527df71ac1120df6f57a8/src/game_logic/entity_configuration.ipp#L1959

To avoid darkening foreground tiles, you could have the color modulation in MapRenderer::renderBackground instead of renderTiles. Which tiles are solid doesn't always correspond to them being in the foreground necessarily but hopefully it does most of the time.