Revealing rooms as the player explores

My current project is a side-scrolling game involving a (hopefully) significant amount of exploration on the player’s part. To this end, I want unexplored regions - and especially those that are to some degree hidden - to be invisible to the player until discovered.

Since my gameplay is 2D, I see a few options here, but am not sure of which is likely to be the best and quickest to render, and am thus hoping for some advice on the matter.

I have, as I recall, done some forum searching, but found little beyond a suggestion (rdb’s response towards the bottom, I believe) that for a full-screen fade an overlaid quad might be better than fading render.

My ideas thus far:

  1. I could arrange my objects into “rooms”, with objects that are considered to be in a room being arranged as children of it in the scene graph. I could then lerp the room’s colour scale to- and from- black, and its children should follow. While agreeably accurate, this might conflict to some degree with my already-implemented grid system for assigning lights and (hopefully) improving the efficiency of certain searches and checks.

  2. I could use a grid of cards, fading them to- and from- black as called for. This could be done with only enough to just more than cover the screen by moving and re-using the cards to create the impression of a static grid covering the entire play area. I don’t know how efficient this might be, but worry about having a potentially large number of semi-transparent objects (excluding those that are entirely transparent, which could be hidden) over my screen. This method would also presumably be limited in how closely it would represent the area being covered.

  3. I could use a single large card, and update its texture as I go. I think that I’ve seen similar suggested for “fog of war” effects - but I think that I’ve also seen suggestions that updating textures in this manner can be slow, and that seems to correlate with my findings in an earlier experiment with something similar. In terms of accuracy, this should sit between the two above, I imagine (depending on the texture size), but as with the second above I worry about having a large semi-transparent object covering my entire screen.

Does anyone have any suggestions and advice for me on this?

My thanks for any help given. :slight_smile: