Page 1 of 1

mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 03:47
by Argh
The check to see whether a Unit can remain Cloaked is not taking Neutrality into account.

Anything that isn't Allied to your Units may uncloak it, regardless of SightDistance or LOS- i.e., your building may be completely blind, but it can still uncloak stuff at the mincloakdistance :P

Needless to say, this produces some irritating results with World Builder stuff, which is all completely blind, yet decloaks cloaked Units around them, and makes it rather hard to have cloaking that's over a large area, as opposed to almost-impossible-to-find cloaking.

Just removing Neutral stuff from the checking loop would probably be sufficient to remedy this. However it'd make Neutral stuff that's supposed to be dangerous completely unable to uncloak things. I don't see any other cheap way to do this, though.

The relevant section is in Unit.cpp, here:

Code: Select all

else if (wantCloak || (scriptCloak >= 1)) {
		if ((decloakDistance > 0.0f) &&
		    helper->GetClosestEnemyUnitNoLosTest(midPos, decloakDistance,
		                                         allyteam, unitDef->decloakSpherical)) {
			curCloakTimeout = gs->frameNum + cloakTimeout;
			isCloaked = false;
		}

Re: mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 04:36
by Pxtl
Wait, if faction X decloaks a unit, then faction Y can see it? Since when???

Re: mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 06:32
by Argh
Yup. Every gameframe, Units check in a sphere for Units, to see if decloak happens... if not Allied, then it decloaks. Simple as that.

Re: mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 09:21
by yuritch
Currently a unit is either cloaked or not. Doesn't matter who uncloaked it, once this happened, it's visible to all the factions (if they have LOS over that point, of course).
It would be good if cloak state was per-player (as in only the player who uncloaked a unit can see it, and not others), that may require quite a bit of messing with the code however.

Re: mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 10:38
by Argh
It would be good if cloak state was per-player (as in only the player who uncloaked a unit can see it, and not others), that may require quite a bit of messing with the code however.
It'd be nice, yeah. I just can't figure out any fast way to do that.

Re: mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 11:52
by [Krogoth86]
yuritch wrote:It would be good if cloak state was per-player (as in only the player who uncloaked a unit can see it, and not others), that may require quite a bit of messing with the code however.
It shouldn't break shared vision with your allies though i.e. make the per-player-visibility compatible to a per-team-visibility... :wink:

Re: mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 15:49
by Pxtl
I can see why it was done like that, thinking it over. Look at it from a player's perspective - as the player, your unit is either cloaked or not. "Relative to whom" is not a question. Otherwise, when would you show the "decloak" graphical effect?

As for the other thing, a straight up "causesDecloak" boolean tag would probably be good enough, defaulting to true (or to sight-range is non-zero). More versatile than forcing it to non-zero sight-range.

Re: mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 16:03
by lurker
It's easy enough to make up a way to render a unit that shows that it's cloaked but not hidden to all.

Re: mincloakdistance Improvement Request.

Posted: 29 Apr 2008, 17:22
by yuritch
Even more than that, the player owning the unit doesn't have to know it's been discovered. Take Starcraft for ex. - the Protoss player is likely to have his cloaked Observers all over the map, and can easily spot some Terran Ghosts trying to sneak into his base. But the Terran player will only know his Ghosts were spotted when they will get attacked. Even more, in an FFA game the Protoss can observe other players battles without them knowing someone is seeing their cloaked units.
Currently Spring cannot do this - if an enemy decloaks your unit, you immediately know about this, even if you cannot see the unit that spotted yours (if your units have longer decloak range than LOS for ex.)

Re: mincloakdistance Improvement Request.

Posted: 01 May 2008, 20:57
by zwzsg
Cloacking cost energy, so a unit is either declocked or cloacked. Maybe if we had cost-free cloacking we could have units cloacked to some enemy sight and not others.

Re: mincloakdistance Improvement Request.

Posted: 04 May 2008, 23:42
by Tribulexrenamed
zwzsg wrote:Cloacking cost energy, so a unit is either declocked or cloacked. Maybe if we had cost-free cloacking we could have units cloacked to some enemy sight and not others.
True, but perhaps the system should work more like this:

Set cloaking on --> constant E drain, except when attacking or building if applicable.
Unit becomes visible to another player--> Visual indication (or maybe the fact that your unit is being attacked), continued E drain since unit is still cloaked. Unit is visible to player that uncloaked it. The unit is still cloaking, but chances are your enemy is tracking it, so the cloaking is ineffectual for hiding the unit from that team.

Re: mincloakdistance Improvement Request.

Posted: 09 May 2008, 07:07
by Warlord Zsinj
I'd like to have a lot more control over what decloaks what.

Re: mincloakdistance Improvement Request.

Posted: 13 May 2008, 19:29
by Forboding Angel
zwzsg wrote:Cloacking cost energy, so a unit is either declocked or cloacked. Maybe if we had cost-free cloacking we could have units cloacked to some enemy sight and not others.

lolwut? Cloaking doesn't HAVE to cost anything, just most of us assign a cost so that if the game is almost over, you don't end up with one unit that can stay cloaked forever. This comment isn't even related to what argh is talking about anyway.

Re: mincloakdistance Improvement Request.

Posted: 14 May 2008, 15:02
by Pxtl
Forboding Angel wrote: lolwut? Cloaking doesn't HAVE to cost anything, just most of us assign a cost so that if the game is almost over, you don't end up with one unit that can stay cloaked forever. This comment isn't even related to what argh is talking about anyway.
The point: either a unit is cloaked or it isn't. When it's cloaked, it exhibits different behaviour from being de-cloaked. Energy drain is the big one.

Units that have an enemy in decloak range aren't just visible, they're un-cloaked, with all the effects that being un-cloaked have.

If you have a unit with COB script that changes things based on cloaked/decloaked, then that is particularly relevant.

Making units that are spotted through cloak-range be still cloaked-but-visible would be a serious change, and break OTA compatibility (for however little that's worth).

Re: mincloakdistance Improvement Request.

Posted: 14 May 2008, 15:09
by Tobi
It could easily be done as addition that doesn't break anything; e.g. have a minCloakDistance (like now) and a seeCloakDistance (cloaked units in this range from unit wearing this tag remain cloaked but are shown to the allyteam of the tag-wearer anyway, without any indication whatsoever to the allyteam of the cloacked unit.)

Re: mincloakdistance Improvement Request.

Posted: 14 May 2008, 17:31
by KDR_11k
I'd prefer a Lua function to set whether a unit is visible to a specific team if it doesn't exist yet.

Re: mincloakdistance Improvement Request.

Posted: 14 May 2008, 19:03
by trepan
I actually did a patch for just that some time ago
(raw control of unit LOS state via Synced lua). I'll
try to find it, and get it in today / tomorrow.

Re: mincloakdistance Improvement Request.

Posted: 14 May 2008, 19:30
by Pxtl
trepan wrote:I actually did a patch for just that some time ago
(raw control of unit LOS state via Synced lua). I'll
try to find it, and get it in today / tomorrow.
Cool! Does this work for radar too? That is, can I set a unit to be a radar-blip (or not) for player X, and let the engine handle radar-drift, etc?