"Fog of War" aka Monster/Trap Reveal Upon Room Entry?

pizle

New member
Title is self explanatory, but could you possibly darken-out "sectors" or rooms of a dungeon, that ONLY reveal themselves once the player has either walked through or triggered them by opening a door???

I can logically think of how this might be done, but I'm not brainiac enough to implement it in ANY way. I was seriously hoping you fine folks might have a clue! Also would love to understand how it works.
Thanks!
 

SciNEStist

Well-known member
The rare NES game Die Hard accomplished this, so its certainly possible.

I would use 3 custom tiles and have it so that when the player is in contact with a tile, only monsters/game objects that are also touching the same tile type show up on screen. You then group the tile types in different rooms, and there you have it, you can have 3 rooms in each screen, but only see the monsters in the ones you are in!

if you want to hide the tiles/rooms themselves, that is a bit more complicated. you could do a sort of pallete change to an all black pallete for the other rooms, or even use the bank switching like animating the tiles and have only room 1 show up in bank 1, only room 2 tiles show in bank 2, etc.

either method would have a drawback, maybe someone else has a better idea.
 

Goaterby

Member
Apologies for the necro, but in the hopes some enterprising individual finds this handy or somewhat inspiring in the future:

ON FOG OF WAR:
In my experimentation thus far I tend to favor selective palette swapping with a code loop. Two important caveats though:
1) This is far easier in NesMaker v4.1.5 than in more modern iterations (purely based on personal experience, others may differ)
2) This is kind of a stupid and CPU-heavy approach to it, but I absolutely adore the resulting visual effect.

In short-- If you know how to palette swap individual tiles, then you can simply loop through relevant proximal tiles to remove light and add light as appropriate by quickly swapping from a colorful palette to a darkened palette. The tricky part is doing so in a manner consistent with the movement of your character (i.e. when you move to the right the 3 tiles 32px behind you go dark and the 3 tiles 32px ahead of you go light etc.). You can slim this down by skipping irrelevant tiles using their X/Y bounds, and by making shorthand functions of the 'Darken' and 'Lighten' values for using in the palette swap function / script.

For enemies, if they are objects you can simply make sprite sets for dark / half lit / fully lit and adjust it based on their proximity to the player character. This allows some interesting art possibilities, like having glowing eyes when they are half lit in the dark tiles surrounding the player etc. Having a proximity script of this kind in your subroutines could also allow multiple light sources, as you could integrate such a function into the palette swap loop to skip tile values already overlapping other light radii.

I have a lot going on in my life at present and have larger projects I am way behind on that are not NES-related, so I won't likely be able to illustrate all these concepts working 100% or provide code unfortunately, but I have included a brief gif of some of these things in action on a prototype I made a while ago in 4.1.5 so folks can see an example of what I mean, and maybe see the potential merits to such an odd approach. I love tile-constrained roguelike movement and ZX-esque aesthetics, but you could easily adapt such an approach to smoother movement with prettier lighting.

 
Last edited:
Top Bottom