Invisibility that you can't see

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
Has anyone tried to add an invisibility that is really invisible? In other words, you can't see the unit. I'm thinking about this by either:
  1. modifying the existing INVISIBLE_SUBMARINE in dll to make it actually invisible
  2. adding another invisibility type
I suspect #1 might be easier. But if anyone has added a new type successfully I'd like to know.

Yes, I know that real invisibility would lead to violations of 1upt. But I don't hold 1upt sacrosanct as others do.
 
Not an area I've delved into much, but it might be easier to duplicate the trade unit code (as they seem to violate just about every stacking rule) than the INVISIBLE_SUBMARINE code (which is still subject to stacking rules, attacking on entering a tile, etc)
 
Yeah, I used trade units in part to figure out how to break 1upt for civilians.

It's really a two part problem. 1) Make units not seen by other players. 2) Modify 1upt appropriately. I'm sure the reason that real invisibility was removed (it was already there in the dll before Civ5) was that that the devs didn't want to deal with the second part.



Edit: It's very confusing with a lot of code left over from Civ4. You see the code below and it appears to be used here and there. But in the implementation of Civ5 submarines, it shouldn't ever happen.
Code:
bool CvUnit::canCoexistWithEnemyUnit(TeamTypes eTeam) const
{
	VALIDATE_OBJECT
	if(NO_TEAM == eTeam)
	{
		return false;
	}

	if(isInvisible(eTeam, false))
	{
		return true;
	}

	return false;
}

Edit 2: As I said above, can't happen. The reason is that in Civ5, isInvisible() always returns false for an adjacent unit. You can see this with Lua unit:IsInvisible() and a submarine. If my warrior steps adjacent to a submarine, then submarine:IsInvisible() is false. If my warrior steps away, then submarine:IsInvisible() is now true.

I think that isInvisible() was originally (in Civ4) used to figure out if a unit was invisible based on unit properties (ie, invisibility promotion) and observer. But it was hacked to return false for any adjacent unit, effectively removing invisibility from the game (or downgrading it in any case to the current "can't see from far away" version).
 
Found the hack:

Code:
pPlotToCheck->changeVisibilityCount(eTeam, ((bIncrement) ? 1 : -1), eSeeInvisible, true, (bBasedOnUnit && thisRing < 2)?true:false);

This occurs in CvPlot::changeAdjacentSight. The last arg for changeVisibilityCount is bAlwaysSeeInvisible, and thisRing < 2 makes this true for adjacent and same plot for any unit.
 
Back
Top Bottom