0
\$\begingroup\$

I'm currently developing a 2D top down game and recently implemented clipping.

I understand clipping in a 2D top down game as rectangle or any other geometrical form which defines a viewport for the player of what exactly he sees and what is technically rendered from the engine. As I'm centering the clipping area around the player I recognized that it is similiar to the fog of war concept. So the player has a limited view perspective depending on his current position.

My questen is what is the concrete difference to the fog of war concept? Is this concept usually using clipping? I often recognized that for example the map is rendered but simply not the objects which are on that map. Are these objects rendered and simply invisible or are they not rendered at all because of the clipping? Could clipping be defined as a way to achieve fog of war?

Would be cool if anyone could shed some light on this topic.

\$\endgroup\$
2
\$\begingroup\$

Clipping and fog of war are not very related.

In a fog of war system, we track which objects or portions of the map the player has knowledge of. They might gain this knowledge by directly observing the object in their current camera view (ie. an object that passes the clipping test), but in many games it's collected in other ways too/instead:

  • Knowledge can be accumulated from many perspectives (eg. each unit/building reports knowledge of units and terrain visible to it). Clipping is specific to one viewpoint.

  • Gaining knowledge may depend on line of sight: if a solid wall blocks sight from a given viewpoint, many games won't confer knowledge of the objects/terrain on the other side of that wall. Clipping has no knowledge of obstacles, so this is closer to a related rendering optimization called occlusion culling.

  • Knowledge may be persistent. In a game with fog of war, I might gain knowledge of a particular area of the map and units/buildings there, then travel elsewhere so they're no longer in my current vision zone. But the terrain and stationary objects like buildings will often remain visible on my map (often greyed/darkened to show they're not currently in sight), because fog of war system has memory of the knowledge there. Clipping shows no such memory over time. It's just a method to exclude objects/geometry outside the current bounds.

  • Fog of war is sometimes even "chunked, " where the map reveals a whole room or province at a time, based on whether the player has crossed a threshold/trigger. In cases like this, the fog can be completely separated from visibility bounds checks, revealing an object that never passed a clip check for any viewpoint.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Note that for some games, clipping may be used to not draw things that are under said fog. \$\endgroup\$
    – Ed Marty
    Sep 6 '18 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.