Author Topic: Cloaking  (Read 3242 times)

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Cloaking
« on: 6 December 2010, 08:29:26 »
The new cloaking unit ability is now complete, and ready for some more extensive testing.

Windows people can get the latest snapshot (rev 1004)
Linux people all know how to compile programs themselves, so they'll be fine  :P

You may experience graphical issues related to the new experimental shader code, if so, please open glestadv.ini and set RenderUseShaders=false

The trac ticket has three addons attached, these are mutually exclusive, only put one at a time in your addons.

The first addon makes daemons invisible with a 'permanent' cloak, which is deactivated while the daemon is attacking, the XML looks like this,
Code: [Select]
   <cloak type="permanent">
      <de-cloak skill-class="attack" />
   </cloak>

de-cloak nodes can specify an entire 'skill-class' or a specific 'skill-name', <de-cloak> nodes are valid for all cloak types and multiple de-cloak nodes can be used.

The second addon, invisible_daemons_v2, gives daemons an 'energy' cloak,
Code: [Select]
   <cloak type="energy" cost='20'>
      <image path="images/daemon_cloaked.png" />
      <cloak-sound path="sounds/cloak.wav" />
      <de-cloak-sound path="sounds/decloak.wav" />
   </cloak>

The 'cost' is specified for the same interval as regeneration (once per second at normal game speed). <cloak-sound> and <de-cloak-sound> are supported for all cloak types, <image> is only needed for energy cloaks, and is the command button used to toggle the cloak on/off.

v2 also makes summoners 'detectors',
Code: [Select]
   <detector value='true'/>

invisible_daemons_v3, gives daemons an 'effect' cloak,
Code: [Select]
   <cloak type="effect">
      <cloak-sound path="sounds/cloak.wav" />
      <de-cloak-sound path="sounds/decloak.wav" />
   </cloak>
   <tags>
      <tag value="daemon"/>
   </tags>

The new <tags> in the unit parameters node allow you tag unit types, this feature will allow numerous things in the future, and was addded early to restrict the targets of an effect.

You should still set target='ally' in the effect/emanation tag, you can then use tags to further refine the potential targets.

The summoner in v3 has an emanation which cloaks nearby daemons,
Code: [Select]
   <emanations>
      <emanation name="hide_daemons" bias="beneficial" stacking="overwrite"
            target="ally" chance="100.0" duration="2" radius="7">
         <affect value="daemon" />
         <flags>
            <causes-cloak/>
         </flags>
      </emanation>
   </emanations>

The new <affect> node is used to restrict this Effect to units tagged as 'daemon', in this case, just daemons.
The new flag <causes-cloak/> will trigger an 'effect' cloak on the target, if the target does not have an effect cloak, it will do nothing.

The new cast-spell command can also be used to make an 'invisibility' spell to make the caster invisible, spells to target other units or areas are due to be implemented sometime in the not to distant future.

Note: Units can have only one cloak type.

Enjoy, and please feel free to post questions and/or feedback here.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Cloaking
« Reply #1 on: 6 December 2010, 10:45:57 »
Sounds good. I've only had a quick look to get the shader working with it though. The alpha is being applied now but other units are affected by it. The golem is permanently on but turns off with different camera positions and other units dissapear when a dead unit fades into the ground.

Are you able to cloak your enemies' units so they can't control them?
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

Psychedelic_hands

  • Guest
Re: Cloaking
« Reply #2 on: 6 December 2010, 11:15:15 »
Thank you, this sounds awesome :) Can't wait to try it.

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Cloaking
« Reply #3 on: 6 December 2010, 14:39:55 »
Sounds good. I've only had a quick look to get the shader working with it though. The alpha is being applied now but other units are affected by it. The golem is permanently on but turns off with different camera positions and other units dissapear when a dead unit fades into the ground.

We weren't resetting the material properties after drawing a faded unit, I think this wasn't a problem in the fixed pipeline because of the glEnable/glDisable(GL_COLOR_MATERIAL) difference.

Fixed... and I changed the fragment shader to just used the calculated diffuse and ambient alpha, which appears to be correct now.

Quote
Are you able to cloak your enemies' units so they can't control them?

Cloak enemy units, yes, but you wouldn't want to, they'll be invisible to you, not your enemy.

Interesting twist, guess I should think about it... though my initial impression is that it would be rather annoying.
Glest Advanced Engine - Code Monkey

Timeline | Downloads

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Cloaking
« Reply #4 on: 7 December 2010, 11:57:21 »
We weren't resetting the material properties after drawing a faded unit, I think this wasn't a problem in the fixed pipeline because of the glEnable/glDisable(GL_COLOR_MATERIAL) difference.

Fixed... and I changed the fragment shader to just used the calculated diffuse and ambient alpha, which appears to be correct now.
Confirmed. It's working for me too. I was worried multiplying by the bump and diffuseIntensity might affect it. Seems to be ok.
« Last Edit: 7 December 2010, 12:10:30 by hailstone »
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

Zoythrus

  • Guest
Re: Cloaking
« Reply #5 on: 7 December 2010, 20:02:12 »
do you think that you can allow for <upgrade-requirement> and <unit-requirement> tags to it? i mean, in the mod im working on, we will need a way to research cloaking, not just give it from the get-go.

also, when will you guys update the wiki with this info? reference would be nice.

-Zoy

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Cloaking
« Reply #6 on: 11 December 2010, 03:06:55 »
Seems reasonable  ;)

I was also thinking that detectors could have types too, all the same ones as for cloaking, 'permanent', 'energy' and 'effect', and maybe they can get unit/upgrade requirements too!
Glest Advanced Engine - Code Monkey

Timeline | Downloads

Zoythrus

  • Guest
Re: Cloaking
« Reply #7 on: 11 December 2010, 03:11:38 »
Seems reasonable  ;)

I was also thinking that detectors could have types too, all the same ones as for cloaking, 'permanent', 'energy' and 'effect', and maybe they can get unit/upgrade requirements too!


i forgot to mention that, so please do this!

Gabbe

  • Guest
Re: Cloaking
« Reply #8 on: 13 December 2010, 18:40:08 »
Can there be added effects to cloaked units, for example like in SC2?

This is what the player who is allied or/and controls the unit:


couldn`t find any pictures of how the enemy would see it, but you get the idea, and those who played SC/2 knows what im talking about.

Zoythrus

  • Guest
Re: Cloaking
« Reply #9 on: 13 December 2010, 21:21:31 »
well, in SC1, you could see your enemy's cloaked units (not well, but you could). that wasnt the case for your units, they were totally defenseless unless a detector was nearby.

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Cloaking
« Reply #10 on: 13 December 2010, 22:36:05 »
Looks like shaders are being used for the sc2 effects.

Something I noticed is you can't attack (maybe target) your own units while they're cloaked.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

Gabbe

  • Guest
Re: Cloaking
« Reply #11 on: 13 December 2010, 22:40:54 »
well, in SC1, you could see your enemy's cloaked units (not well, but you could). that wasnt the case for your units, they were totally defenseless unless a detector was nearby.
You can in SC2 aswell, and that was kind of my suggestion, im sorry i didn`t formulate myself very well ;)

will

  • Golem
  • ******
  • Posts: 783
    • View Profile
Re: Cloaking
« Reply #12 on: 13 December 2010, 22:52:57 »
In C&C Tiberian Sun one or two units could cloak, and when they did they would just shimmer for their owner, whilst not be drawn for their opponents.

They could get detected if they got really close to the enemy, and they had to uncloak - and be defenseless whilst uncloaking - before attacking.

Of course the second point is about rules and balance, not the kind of restrictions you put in the code...

Zoythrus

  • Guest
Re: Cloaking
« Reply #13 on: 13 December 2010, 22:57:09 »
you know what i think would be interesting? a cloaked unit would slightly distort the area when it's moving, but is completely invisible when not (well, somewhat visible to you...not your units).

Gabbe

  • Guest
Re: Cloaking
« Reply #14 on: 13 December 2010, 23:02:49 »
you know what i think would be interesting? a cloaked unit would slightly distort the area when it's moving, but is completely invisible when not (well, somewhat visible to you...not your units).

like In SC2/1

Maybe like the glass effect you can add in blender?

Zoythrus

  • Guest
Re: Cloaking
« Reply #15 on: 13 December 2010, 23:08:48 »
you know what i think would be interesting? a cloaked unit would slightly distort the area when it's moving, but is completely invisible when not (well, somewhat visible to you...not your units).

like In SC2/1

Maybe like the glass effect you can add in blender?
in SC its still visible, even when not moving. i mean rendered only when moving.

Gabbe

  • Guest
Re: Cloaking
« Reply #16 on: 14 December 2010, 21:53:20 »
Would make it hard, chooseable? Having a ton of "observer" like units flying and standing still in the enemy base will...ruin the game? That would be like maphack and the games wouldn`t be interesting.


Zoythrus

  • Guest
Re: Cloaking
« Reply #17 on: 14 December 2010, 22:13:58 »
Would make it hard, chooseable? Having a ton of "observer" like units flying and standing still in the enemy base will...ruin the game? That would be like maphack and the games wouldn`t be interesting.


wait, what do you mean?

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Cloaking
« Reply #18 on: 14 December 2010, 22:24:39 »
One posibility would be to make cloaking units sort of like in Halo. They are visible, but very hard to see and not on the minimap. They have a high translucency effect that is sort of a mixture of distortion and "glass-like" effects. Looks fabulous, but can't be at all simple... :confused:
Edit the MegaGlest wiki: http://docs.megaglest.org/

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

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Cloaking
« Reply #19 on: 14 December 2010, 22:56:32 »
Isn't it just easier to say "Like in the movie Predator!"?  Don't tell me you kids are too young to have seen it. :P

Gabbe

  • Guest
Re: Cloaking
« Reply #20 on: 15 December 2010, 01:05:37 »
Didnt remember predator, but yeah like that.

 

anything