Author Topic: [done]Give unit special ability to remove fog of war for player in custom games.  (Read 4200 times)

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
Request: Give unit special ability to remove fog of war for player in custom games.

So here is the Idea:

A unit has a skill in which for an EP and/or Resource Cost (up to modder) that removes fog of war for the player who purchased it (and/or allies) for a limited time. (up to the modder)

I've attempted to do this using a building that produces a size zero unit with 500+ vision radius with -1 hp regen.  However, units with vision higher than 100 causes lag due to background calculations that come from the unit "seeing" a large area. So it would be easier to temporally turn off FOW.
« Last Edit: 5 February 2013, 06:20:29 by softcoder »
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
How exactly would this be done? Fog of war is shown or not based on the game setting, now you want it at the unit level? Would we visually not show fow when such units are selected? I'm having a hard time figuring how this would work visually?

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
You misunderstand. He wants FOW to be deactivated totally for a set time for a given team and/or faction. And this is set based on a command being clicked, probably some sort of satellite unit is involved.

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
You misunderstand. He wants FOW to be deactivated totally for a set time for a given team and/or faction. And this is set based on a command being clicked, probably some sort of satellite unit is involved.

If you did this once the temporary sight was turned off the whole map would still be explored for them.
Get the Vbros': Packs 1, 2, 3, 4, and 5!

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
I would like to hear direct feedback from Ishmaru about how he would like to see this feature work.

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
MoLAos is close. Essentially I wanted to have a unit skill that upon activation (there should be an ep cost) reveals the entire map for the player only for limited time. Once time is up then what's visible should return to how it was before the ability was activated.

skill should:
Reveal Map for a limited time.  Time amount should be editable in xml 
Reveal Map for player and/or ally only.  Editable in xml
Should have an EP and/or resource cost.  Editable in xml
Fog of war should return to normal with the completion of skill.

Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
MoLAos is close. Essentially I wanted to have a unit skill that upon activation (there should be an ep cost) reveals the entire map for the player only for limited time. Once time is up then what's visible should return to how it was before the ability was activated.

skill should:
Reveal Map for a limited time.  Time amount should be editable in xml 
Reveal Map for player and/or ally only.  Editable in xml
Should have an EP and/or resource cost.  Editable in xml
Fog of war should return to normal with the completion of skill.
An ability to specify a "cooldown period" (time in miliseconds before the command can be used again) would be nice too. In fact, such would be pretty awesome if it were available to every command. We could have super powered attacks that can only be used every 10 seconds, only allow the fog of war to be removed every 10 minutes, or allow a powerful healing (repair) command to only be usable every minute.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
just give the unit a second stop skill (costs ep) which has an attack boost.
the attack boost gives the unit +1000 sight... fog removed until ep are at 0
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
If you actually read the first post you would see where he said that just making huge vision creates a buttload of lag, presumably due to issues with fog of war calculations.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
If you actually read the first post you would see where he said that just making huge vision creates a buttload of lag, presumably due to issues with fog of war calculations.
Yes, I've tried this myself. The game becomes almost unplayable. Likewise, setting a really far rendering distance and tilting the camera has a similar effect. Presumably there's calculations based upon sight.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Correct for every unit in the current players faction, we check their site radius and remove fog of war every 40 frames. Svn has this hopefully improved a lot.

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Svn rev#: 4009 implements this partially (duation is not yet doing anything)

Create a skill like this:

Code: [Select]
<skill>
<type value="fog_of_war"/>
<name value="clearfog_skill"/>

                        <enable-fog value="false" />
                        <apply-team value="true" />
                        <duration value="0" />
</skill>


Now to USE this new skill you must link it to one or more parent skills for a given command:

Quote
      <command>
         <type value="harvest"/>
         <name value="harvest_wood"/>
         <image path="images/worker_harvest_wood.bmp"/>
         <unit-requirements/>
         <upgrade-requirements/>
         <move-skill value="move_wood_skill"/>
         <harvest-skill value="harvest_wood_skill"/>
         <stop-loaded-skill value="stop_loaded_wood_skill"/>
         <move-loaded-skill value="move_loaded_wood_skill"/>
         <harvested-resources>
            <resource name="wood"/>      
         </harvested-resources>
         <max-load value="25"/>
         <hits-per-unit value="1"/>

                        <fog-of-war-skill value="clearfog_skill" skill-attachments="move_wood_skill,harvest_wood_skill" />
      </command>

Notice the bottom line links our new fog of war skill to two other skills used in the command:

move_wood_skill,harvest_wood_skill

This is a comma delimited list of skills to link fog of war skill to. So when the attached skill is triggered by the command then fog of war also is triggered.

In the case above we turn off fog of war for my team when move_wood_skill or harvest_wood_skill skills are enabled for the command harvest_wood.

titi_son

  • Draco Rider
  • *****
  • Posts: 283
  • titi_son
    • View Profile
If you actually read the first post you would see where he said that just making huge vision creates a buttload of lag, presumably due to issues with fog of war calculations.
he added this after i posted i think.  ::) nvm softcoder implemented it :)
My first Tilseset: SPRING :) (included in Megaglest )

Secret Hint: To play online join the IRC #megaglest-lobby on freenode which is the lobby chat ingame. So you can chat with or wait for people in the lobby without running megaglest all the time.

MoLAoS

  • Ornithopter
  • *****
  • Posts: 433
    • View Profile
If you actually read the first post you would see where he said that just making huge vision creates a buttload of lag, presumably due to issues with fog of war calculations.
he added this after i posted i think.  ::) nvm softcoder implemented it :)

It was there before I posted. And I posted before you.  ::)

Ishmaru

  • Behemoth
  • *******
  • Posts: 1,071
  • um wat??
    • View Profile
    • DelphaDesign
I noticed that after the skill is over, the fog does not return. The units outside normal vision disappear but map stays revealed, I remember that the map would not stay revealed after the skill finishes.

On a side note when <enable-fog value="true" /> the clearfog skill has no effect.

This is on an svn revision after 3.9.1. revision 4711.50
Annex: Conquer the World Release 4 For Pc Mac + Linux
https://forum.megaglest.org/index.php?topic=9570.0
Annex is now on Facebook!
https://www.facebook.com/AnnexConquer