Fog of war

Discussion in 'Mod Discussions' started by jamiem, July 25, 2014.

  1. jamiem

    jamiem Active Member

    Messages:
    115
    Likes Received:
    89
    Hi,
    Does anyone know if the engine supports fog of war that hides the terrain?
    I.e. the planet shows no details at all until your units see it, in the style of Warcraft.
    Thanks!
  2. squishypon3

    squishypon3 Post Master General

    Messages:
    7,971
    Likes Received:
    4,357
    I believe I heard the devs comment that it's very difficult for PA's engine. (We couldn't even attempt it without the engine as well)
  3. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    In theory it's a shader that could be replaced; in practice there are nine shaders with fog in their name so it's not clear which ones are in use.
  4. tehtrekd

    tehtrekd Post Master General

    Messages:
    2,996
    Likes Received:
    2,772
    To quote Neutrino:
  5. jamiem

    jamiem Active Member

    Messages:
    115
    Likes Received:
    89
    I see. Thanks all.
  6. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    RTS games usually have three levels of vision. No vision, old vision, and current vision. We have this as well and determine the visibility of units and features (ie: trees) based on it. However we don't try to represent a differentiation between no vision and old vision in our fog of war rendering. Because of this it would be very difficult to implement terrain hiding fog of war unless you made all non current vision be black.
    squishypon3 likes this.
  7. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    Can we get an option making all no vision be solid black?

    I can see problems with this, landing and all, but maybe all landing spots show up as old vision upon game start?
  8. jamiem

    jamiem Active Member

    Messages:
    115
    Likes Received:
    89
    Would it be hard to add another state, i.e. initial vision?
    In terms of modding the engine, having this kind of starting fog of war expands the possibilities a lot e.g. solar exploration
  9. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    Short answer: No.
    Long answer: You can make the fog of war be solid black outside the current vision, and make metal spots require vision before becoming visible, but there's no middle tier of vision. We don't have any systems in place to keep track of what areas you've had previous vision of to allow for the three states. For our recon system we keep track of the state of structure units and trees you've seen, but not the terrain.

    The way we do fog of war currently is in screenspace we render every single unit's vision sphere onto the screen, then use that as a texture to drive the fog. This lets us ignore fog of war for units the client can't see on screen for that frame. To keep track of old vision on the terrain we would have to keep track of all units at all times, even if they're offscreen, and render them into a voxel grid or cubemap representing some approximation of the planet surface.

    Since we one of the current optimizations we do is to not send clients data about units offscreen, this would be problematic, and would mean we would either have to not use this (significant) optimization or be updating the old vision data from the server.


    edit: Also one of the reasons we went with this direction is two fold.
    One is visuals; all black planets are boring to look at. We wanted planets to look nice even if you don't have full vision of them. It was also decided early on to not have any kind of cloud cover.
    The second is since we're on planets, one would think sitting on one planet and looking at another you'd see most of the terrain just by looking at it, though not necessarily unit locations. Metal spots are always visible just because it was deemed annoying to have to search for them, especially when we weren't doing no vision / old vision separation to let you know where you haven't looked.
    wondible and lokiCML like this.
  10. jamiem

    jamiem Active Member

    Messages:
    115
    Likes Received:
    89
    Thanks for the detailed explanation and sorry if I'm flogging a dead horse here. The choice regarding visuals and metal spots makes sense for PA, but the option to explore a solar system not knowing what you're going to find until you land could allow for some very interesting mods.

    I was wondering a couple of things, first being keeping track of all units at all times. Is this not already done? Surely the engine needs to always know where they are?

    Second, for something as simple as an initial (i.e. completely blank state) fog of war, couldn't a simpler representation like a spherically mapped texture be used? Since the effect is cumulative, updating over time could be cheaper and probably disabled in areas where the fog is already cleared.

    Anyway just food for thought, I know you guys have got your hands full getting the game released.

Share This Page