I'm interested in what happens when you have structures/buildings on a 2D tilemap that are tall enough to block the view of the player. AFAIK, there's a few approaches:

  1. Do nothing to display the location of the player and force the user to infer where the player is. Pokémon, for example, uses this to its advantage and hide secret items behind buildings.
  2. Make the blocking structure invisible or translucent. This feels like a canonical approach but an obvious disadvantage is that you now have to worry about displaying additional information to show the transparency. e.g. displaying a stump of the tree that was made transparent to show that there's a tree infront.
  3. Never make structures tall enough that could fully block the location of the player.
  4. Disable pathing behind these tall buildings.
  5. Always put tall structures to the corners of the map so that no one even thinks about going behind. These buildings are then effectively corner/edge decorations.
  6. [Exploring] Show the player sprite but use a shader around the player to convey transparency. This is similar to 2), except instead of making the entire building transparent. You simply render the player in front but trick the user into thinking that they're looking at the player from a special lens that can see through buildings.

My question is, is 6) possible? Are there examples of games that does this? Furthermore, are there other possibilities I've missed?

  • 2
    \$\begingroup\$ Yes, 6 is possible. I don't have an example off the top of my head. Other possibilities? Sure, whatever you come up with, as there are Turing complete and Tetris complete solutions (although there might be performance tradeoffs, for example the solution might require to render the player twice). A notable exception is making the behind of tall buildings another map, and only have such buildings when that makes sense. We cannot make an exhaustive list of alternatives, and beyond that, I believe the answer is mostly "yes", barring any limitations of the tools you might be using. \$\endgroup\$
    – Theraot
    Dec 17, 2023 at 7:39
  • \$\begingroup\$ For 6) the name of the technic would be an outline shader. Age of Empire 2 used this for example already \$\endgroup\$
    – Zibelas
    Dec 17, 2023 at 11:12
  • \$\begingroup\$ And there is a 7) a cutout shader, that makes a hole thorugh something like in Divinity. gamedev.stackexchange.com/questions/152824/… \$\endgroup\$
    – Zibelas
    Dec 17, 2023 at 11:50
  • \$\begingroup\$ Here's another example of 6 in a 3D game, though you can use similar tricks by drawing your "2D" tiles in 3D to take advantage of depth information. \$\endgroup\$
    – DMGregory
    Dec 17, 2023 at 15:20


You must log in to answer this question.

Browse other questions tagged .