Fog of War

Fog of War

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

Fog of War

Post by colorblind »

updated at 21:19 26-8-2005

I know there was a thread on this subject back in the day, although I don't believe it focused much on how to implement the FOW but rather discussed what kind of fog we wanted. I hope this topic will adress some of the difficulties in implementing it, so that we can enjoy a nice FOW sometime before release 1.0.

Why a Fog of War is needed
First of, we need a Fog of War imho. I can see several reasons:
  • In the current situation you can 'scout' for enemy structures by looking for ground deformations, or by trying to build a structure where the enemy has one.
  • You can see all of the map at the beginning. Some consider this a good point, as experienced players have no advantage over newbies when it comes to knowing the map. I myself disagree, and are in favour of scouting the map to see what it looks like. This makes scouting and / or knowing the map part of what it takes to be a decent player.
The second point is somewhat controversial, but it can be encompassed by allow two or more different FOW modes, much like TA had (see How to visualize it).
Bare in mind that a FOW that would fix these problems would go beyond the current LOS feature, that is invoked by pressing L. So please don't reply with comments like "I like L the way it is now"; it needs to be replaced.

What does it need to obscure?
First problem is what the FOW has to obscure. I think a real fog in the places where you haven't been is out of the question: that would block an overhead camera because you don't have LOS all the way to the heavens.

My suggestion is to have the an effective 2D FOW that depends on where you have LOS on the ground. All positions above it should then also be visible. This is of course not a perfect solution, as planes then can be outside the FOW but also outside your LOS.

So far there seems to be some kind of agreement on this point (but correct me if I'm wrong).

How to visualize it
The second problem is how to visualize it. Here the opinions begin to differ. Some want a real fog, but I believe that can be ruled out (see the previous point). There are two feasable options mentioned so far:
  1. Simply draw nothing where you haven't been before (or a black area), and a greyed out (or darkened) map where you have been before.
  2. Show the whole map from the beginning, with the areas where you have no LOS in gray or darkened.
  3. Or a mix; darkened terrain for the unscouted areas, grey terrain for the scouted areas. That way you can keep track of where you've been.
The second option makes for speedier gameplay, as you can see the metaldeposits and buildable locations from the start. With the first option you have to do some scouting in order to get that information.
Ideally there would be an option in the battleroom to select what kind of FOW you want; that would satisfy everyone.

How to code it
Thirdly it has to be written in code.
I'm thinking assigning a heightmap to every AllyTeam. It only contains the part of the map you have scouted so far. The area outside your LOS is 'static' in the way that it won't get updated when it deforms, and can be drawn in grey (or darkened). The area in your LOS gets treated the way it is now.

Comments still welcome
I'll update this start-post if someone says something reasonable in this topic, so keep up the comments!
Last edited by colorblind on 26 Aug 2005, 21:18, edited 4 times in total.
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

I agree 150% so, please, make this a priority...I also recommend that LoS is updated in real time.

as for fog, i'd suggest black fog that looks smooth on the edges, explored terrain could be either darkened or black and white, the edges don't necesarilly have to be smooth.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

Basically you would need 3 height maps, well 2 and a mask, right? one the orriginal, what you see outside of the scouted terrain, minus metal deposits, heigh cut off to some generic average height represented as a grid so that textures couldn't give clues, scouted terrain that would show last known heightmap and metal and thermal vents and ghosted buildings, superimposed with a wide grid to make is easier to tall the difference... then the actual LOS... radar blips would show up at the right heigt, but you couldn't know if it was a hovering plane or a HLT on a hill.
Torrasque
Posts: 1022
Joined: 05 Oct 2004, 23:55

Post by Torrasque »

How to visualize it
The second problem is how to visualize it. Perhaps a simple black (i.e. nothing) where you haven't been before, and a greyed out map where you have been before can suffice.
Having a black fog is really a pain in the ass for me.
It slow down a lot the game. exemple : without black fog, you send a builder to build a radar near the ennemi base...it's easy.
With black fog, you need to send it where you think it must go. wait it arrive, and then send the build order. (if you don't have forgoten what you wanted to do)
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

I like it the way it is now... just don't show ground deformations, or let me know there are buildings their by preventing me from building on top of them really...

like it's not just flat bits that are give away... if I just start a build order and hover around the map I can figure out where the enemy has buildings or not... if building over an enemy buiding auto-claimed it like wreakage this wouldn't be a problem
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

im it should be visiable where the fog of war starts, maybe a line will do?
colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

Post by colorblind »

Torrasque wrote:without black fog, you send a builder to build a radar near the ennemi base...it's easy.
With black fog, you need to send it where you think it must go. wait it arrive, and then send the build order.
But isn't that the whole point of a FOW? If the terrain is undiscovered it seem reasonable to me that you don't know whether or not you can build there. It was like that in OTA, and probably every other RTS you can think of. With a FOW you need to scout, not only for your enemy's location but also for the structure of the map.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

colorblind wrote:
Torrasque wrote:without black fog, you send a builder to build a radar near the ennemi base...it's easy.
With black fog, you need to send it where you think it must go. wait it arrive, and then send the build order.
But isn't that the whole point of a FOW? If the terrain is undiscovered it seem reasonable to me that you don't know whether or not you can build there. It was like that in OTA, and probably every other RTS you can think of. With a FOW you need to scout, not only for your enemy's location but also for the structure of the map.
nah after u played a map a few times, u know where everything is..
colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

Post by colorblind »

But even then I can't begin to think of a reason why you wouldn't have a FOW, apart from being lazy. Sent a construction unit into dark terrain, and it will build if the terrain is good or otherwise it'll report that it is unable to perform its orders. Knowing what the map looks like works to your advantage, but that's just part of being a decent player.

So grow over it, we need a FOW.
User avatar
Decimator
Posts: 1118
Joined: 24 Jul 2005, 04:15

Post by Decimator »

The terrain is discovered though, by the people who have played the map before. A better system would be to show the original terrain until you explore it and consider you able to build as if it were pristine terrain.
colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

Post by colorblind »

I've updated the first post in this topic with the comments / suggestions you all made. Keep 'em coming, but try to focus on the technical aspects (unless you really disagree with me).
cain
AI Developer
Posts: 124
Joined: 09 Aug 2005, 10:04

Post by cain »

terrain FOW is a good solution if the terrain is generated
randomly every game.. a good gamer will learn the terrain
at the second set, de facto penalizing newbies
(or experienced competing on a never seen map)

Hovewer the fact that you see the enemy build zone
looking at terrain deformations is a problem, that need
a good solution. I don't think is feasible to have a
separate heigthmap for every player plus the real
one in the sistem memory. This also won't be a solution:
what about pathfinding? sincronization? as scout
planes are generally fast, you will need to update
huge map zones as los changes.
A good pc today could count only on a lone MB or two
for cache.

Maybe you could draw a low resolution heightmap
for unexplored zone/ out LOS zone, giving an 'idea' of landscape
without the ability to scout for enemyes deformations.
This won't impact on the game structure, aside for the graphic
engine, wich currently support dinamic drawing resolution for
the terrain. (sort of LOD, using tessellation, if I'm correct)
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

imo we just need fog of war for the LOS notting more...


maybe it can even be done with a single line..

Image
Last edited by NOiZE on 26 Aug 2005, 19:15, edited 3 times in total.
cain
AI Developer
Posts: 124
Joined: 09 Aug 2005, 10:04

Post by cain »

Los is stored as a map for the ai's, but it's real low res (1/64 of the texture, 1/4 of the metal map you can see with f4).
a line will be drawn very bad (as los are tipically circles)
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

The best solution right now would be a darkness (not blackness) to represent LOS, the edges of LOS could be gradually becoming darker.

When you enable LOS right now with L is kind of what I mean, but without the ugly green for the radar range and no fullbright terrain in LOS range. that would be fine.
colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

Post by colorblind »

cain wrote:I don't think is feasible to have a
separate heigthmap for every player plus the real
one in the sistem memory (...)
Well you only need one extra heightmap for your own AllyTeam. There is no need to have the heightmaps of all other AllyTeams in your local memory, apart from the fact that only one extra heightmap will give some troubles when switching teams.

But as far as memory requirements you may be right, although I really don't have a clue how much resources it would drain. Would any of the SY care to comment on the feasability of a FOW with respect to memory requirements?
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

The main problem with masking height changes isnt so much the height itself as it is the shading of the ground. Since the shading is stored in a texture you would have to rewrite that texture when los changed which could get very expensive since memory to texture copies carries a lot of overhead.
colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

Post by colorblind »

Hmm .... isn't it an idea to calculate the darkened (or grayscale) version of the texture before startup, say right before or after the initial path calculation? You can then store the extra texture on the harddisk (like the pathinfo) so you only need to calculate it once.

But that's just a thought.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

First, there's the L key. Please, press L once in a Spring game before posting into this thread.

Then, I really don't want unexplored terrain to be black. In TA you had the choice to have explored terrain full black or just greyed. Full black was painful to play, I had to lose valuable time building jeffy (or other scouts) and ungreying the map before starting to build mexxes. Sometimes there was a mexx just a screen away that I missed for the first half an hour because it was in a black area.

Blacked out unexplored terrain does not encourage scouting, to the contrary it makes sending anything out of your base complicated, time consuming, hazardous, and inefficient.

Seeing the terrain from the start encourage quick expansion, raiding, faster and more active gameplay.

While with blacked out terrain, you have a slow expansion because you need to first explore any area you want to build of, and because you lose valuable time looking for res, with greyed terrain you can send cons build mexx far away in a couple click. While with blacked out terrain you can't effectively attack the enemy until you've grown so much that you accidently fell on it, with greyed terrain you can start hunting the enemy structure with the very fist unit, as you know where he is likely to have built in mexx, and you can use terrain to your advantage, coming from behind, etc..., instead of "oops, my flash just ran into a hill, it's now blocked and will die at the end of the defenders". Black terrain brings unfair randomness to the game. One player may find the metal right away while the other gets killed without having yet found any metallic area. Instead of having to use your cunning skills to use the terrain to make a difference in combat, the terrain factor becomes a roll of dice.


If you look at the evolution of RTS, you'll see that:
- At first generation, (Dune2, C&C), maps started black and terrain had to be revealed, but once revealed stayed revealed.
- At second generation (WC2), maps started black and and terrain had to be revealed, and turned black to greyout, with structure and terrain visible but units invisible ,when los was lost.
- At third generation (DoW), maps started with the terrain greyed but visible, exploring terrain once doesn't give any advantage, you see the terrain all the time but need units with los to see the enemy units.

Total Annihilation, which is now rather old, left the choice open. As the missions and the old Boneyard settings show, the devs thought that the second system (where you have to explore once to see terrain, and keep the unit around to see also units) was best. But after eight years of continuous online play, the de-facto standard for nearly all online TA game as become to have terrain always visible but greyed, and enemy invisible out of current los.

Don't discard the teaching of the past so easily!


That say, I'd like Spring to support different los possibilities, and leave the choice to the host of each game. But if the codders don't want the hassle of programming all kind of fog-of-war possible, then they should focus on the one that emerged as the best and most-widely-used-would-choice-be-given, and we know which one it is.

Oh and yeah, being able to use terrain deformation to see the flat square where building are, and the red yardmap when trying to place a building to see occupied terrain, is a little bug. I don't think it's such a problem, it's not that abuseable, but fixing it would be nice. In TA you could see rocks being reclaimed and wreckage appearing, it wasn't a big deal.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

IMO the view u get from pressing L is just ugly, somehow it has to be made clear where los starts and where it ends...
Post Reply

Return to “Engine”