The Fog of War
-
Many games have a "fog of war" and thought mine should too. It seems so obvious: blacken the screen (somehow). While I came up with a plan I decided to let (Bing) AI have a go:
Quote:
Here are some ways to implement fog of war in a game: Create a layer for the fog of war and cache a version of the world map (or sections) image(s) with a black+alpha rectangle applied to it. You can also apply a blur filter in this stage. Use a tablet or laptop for each player, which tracks which parts of a common map the player uncovers. Use a set of color-coded flip tokens with abstract symbols. Every area of the game board gets one token per player.
(That's what I thought.) Instead, in the frame update cycle, when I look at each control, I vary their opacity based on the vicinity of foes and limits of sight (distance and contour) and which team is currently active (selected POV). About 20 minutes to implement using my existing targeting routine, and looks amazingly well as troops "come into view". You suddenly realize you have a functional framework.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
Many games have a "fog of war" and thought mine should too. It seems so obvious: blacken the screen (somehow). While I came up with a plan I decided to let (Bing) AI have a go:
Quote:
Here are some ways to implement fog of war in a game: Create a layer for the fog of war and cache a version of the world map (or sections) image(s) with a black+alpha rectangle applied to it. You can also apply a blur filter in this stage. Use a tablet or laptop for each player, which tracks which parts of a common map the player uncovers. Use a set of color-coded flip tokens with abstract symbols. Every area of the game board gets one token per player.
(That's what I thought.) Instead, in the frame update cycle, when I look at each control, I vary their opacity based on the vicinity of foes and limits of sight (distance and contour) and which team is currently active (selected POV). About 20 minutes to implement using my existing targeting routine, and looks amazingly well as troops "come into view". You suddenly realize you have a functional framework.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
Gerry Schmitz wrote:
and thought mine should too.
What is your game? Is it available somewhere that we can see it? What kind of game is it? War simulation, I'm guessing. Tell us more. :)
It's a UWP implementation of the rules of Kriegsspiel (1824-1882). I plan to release it in the Windows Store. It's a question of where to stop. It's a simulator; teaching tool (strategy; tactics; evolutions); a war "game"; etc. Looking to add Bluetooth multi-player. [Kriegsspiel – How a 19th Century Table-Top War Game Changed History - MilitaryHistoryNow.com](https://militaryhistorynow.com/2019/04/19/kriegsspiel-how-a-19th-century-war-game-changed-history/)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I