Hidden Trait Implementation

Vehem

Modmod Monkey
Joined
Nov 22, 2005
Messages
3,219
The following can be added to the end of "OnBeginGameTurn" (in CvEventManager) to give a rough implementation of the "Hidden" trait. Each tile within a Hidden Trait Race's cultural border that is currently not in line of sight of a player has a 10% chance each turn to become unrevealed to that player.

Code:
#VEHEM
		for i in range(gc.getMAX_PLAYERS()):
			player = gc.getPlayer(i)
			iChance = -1
			if player.isAlive():
				eTeam = gc.getTeam(player.getTeam())
				aTeam = player.getTeam()
		
				iMapDecayPercentage = 10
				for i in range (CyMap().numPlots()):
					pPlot = CyMap().plotByIndex(i)
					owner = gc.getPlayer(pPlot.getOwner())
					if owner:
						if owner.hasTrait(gc.getInfoTypeForString('TRAIT_HIDDEN')):				
							if (not pPlot.isVisible(aTeam, false)):
								if (CyGame().getSorenRandNum(100, "MapDecay") < iMapDecayPercentage):
									pPlot.setRevealed(aTeam, false, false, TeamTypes.NO_TEAM)
#/VEHEM

I've also put together a small set of changes to make the Sidar into a playable race with a few changes to make their gameplay distinctive. Notably, their Recon-line have had their anti-Animal role replaced with anti-Undead promotions (Undead-slaying at low levels and the Destroy Undead spell at higher levels). The Marksman promotion has also been removed from the assassin and marksman and granted to all Recon-line units within their own borders in the same way as the "Homeland" promotion (they can use their "hidden" ability to get close to the targets they choose).

Treewise, I've moved a few pre-reqs for the Recon line around, requiring low level Adept/Priest line techs in order to build the pre-req buildings (replaced Hunting Lodge with Ossuary, requiring Mysticism, similar to the Balseraph switch of Freak Show to Carnivals). I've also revamped the "Marksmen" unit (as it lost the promotion) to be "Prescients" - archers capable of seeing a short way into the future (Drill I to III by default).

I plan to do a little more playing around with this before any release - but will post the full changes if there is any interest.

Edit: Fix as noted by Xanaqui
 
Code:
#VEHEM
		for i in range(gc.getMAX_PLAYERS()):
			player = gc.getPlayer(i)
			iChance = -1
			if player.isAlive():
				eTeam = gc.getTeam(player.getTeam())
				aTeam = player.getTeam()
		
				iMapDecayPercentage = 10
				for i in range (CyMap().numPlots()):
					pPlot = CyMap().plotByIndex(i)
					owner = gc.getPlayer(pPlot.getOwner())
					if owner:
						if owner.hasTrait(gc.getInfoTypeForString('TRAIT_HIDDEN')):				
							if (not pPlot.isVisible(aTeam, false)):
								if (CyGame().getSorenRandNum(100, "MapDecay") <= iMapDecayPercentage):
									pPlot.setRevealed(aTeam, false, false, TeamTypes.NO_TEAM)
#/VEHEM

Minor defect: CyGame().getSorenRandNum(100, "MapDecay") returns a range of 0-99, so if you want iMapDecayPercentage to be a straight percentage, that line should be changed to:

if (CyGame().getSorenRandNum(100, "MapDecay") < iMapDecayPercentage):

Otherwise, setting MapDecay to 0 (for example) would result in a roughly 1&#37; chance of decaying. Similarly, the code you originally described has an 11% chance of firing, not a 10% chance.

Note that the FfHII team often (though not always) injects this defect in their code. This is why the wiki percentages are often 1% or .01% off the stated intended percentages - they're based on the implemented code, not the intention.
 
The following can be added to the end of "OnBeginGameTurn" (in CvEventManager) to give a rough implementation of the "Hidden" trait. Each tile within a Hidden Trait Race's cultural border that is currently not in line of sight of a player has a 10% chance each turn to become unrevealed to that player.
I'm curious as to how the AI handles an opponent with this version of the Hidden trait. I would think that it would make it even tougher for the AI to counter-attack, since the standard AI is heavily reliant on omniscience for its attacking.
 
I'm curious as to how the AI handles an opponent with this version of the Hidden trait. I would think that it would make it even tougher for the AI to counter-attack, since the standard AI is heavily reliant on omniscience for its attacking.

They actually seem to do quite well with it, though they do keep a number of scout units close to the border in the late-early game (which I'd imagine a human player might well do too). Similar "issue" with open borders - you get a scout or two running around in your territory, but again - a human with open borders would do the same thing.
 
I was under the impression that the current AI can see all territory anyway. this implementation only seems useful against human players(although, since the AI in BtS isn't supposed to cheat, it might be more useful then).
 
I was under the impression that the current AI can see all territory anyway. this implementation only seems useful against human players(although, since the AI in BtS isn't supposed to cheat, it might be more useful then).

I think that some of the Blake AI, which started with a mod to warlords, and got introduced in one of the official patches, makes the A.I. only see what a player would see. And Kael has used some of this code in the FfH SDK. But Im not sure if he only uses the AI City code or if it's more. (Blake has been helping Firaxis with the AI for BtS as well)
 
I was under the impression that the current AI can see all territory anyway. this implementation only seems useful against human players(although, since the AI in BtS isn't supposed to cheat, it might be more useful then).

It's been said many times by Firaxis that this is not the case, and you can see that civ4 is way different from civ3 in this regard. The AI misses nearby goody huts because it doesn't see them, and the same goes with city attack. So all in all this trait is on the paper much more powerful vs the AI than vs a human player, who knows where you are anyways.
 
It's been said many times by Firaxis that this is not the case, and you can see that civ4 is way different from civ3 in this regard. The AI misses nearby goody huts because it doesn't see them, and the same goes with city attack. So all in all this trait is on the paper much more powerful vs the AI than vs a human player, who knows where you are anyways.

I've run through a few times now with it in effect (once as Sidar and three as others) - the AI seemed to handle it at least acceptably well in both cases (though the last time through Orthus killed them off relatively early so it wasn't much use as a study).

A good counter to the effect is to get early open borders and stick your religion to as many of their cities as possible. Human Sidar are liable to use Inquisitors to deal with that, but the AI obviously doesn't tend to use those as much and can't see the long term benefits.

In anycase - I'm quite enjoying having bits of the map that I can't see clearly - especially in the second game which also had the Svaltafar in it with a vast empire (half a continent of hidden cities).
 
The following is a list of all the changes I made to the Sidar race as I'm playing them at the moment, with rationale for some of the changes. I don't claim to fully understand the backstory of the race as Kael has designed them - but I've read through the 'pedia entries to find clues and then incorporated these into the civ. At the least, it provides a flavourful stand-in until Shadow.

The changes currently need updating for Patch H - any feedback is welcomed and may help to shape the release version.

Recon Line

The Sidar care little for the affairs of other civilizations and the lesser beasts around them. They do however take affront to the vile magics used to reanimate the dead - especially the remains of the own ancestors. Sidar remains are generally stored in a great Ossuary, guarded by Wardens and Preservers. When these guardians do venture into the wilds to deal with a threat, they are accompanied by scores of black ravens which offer reports from the sky.

Scout - Remains the same (I originally changed this too, but it's too great a handicap to have no anti-animal troops at all in the early game)
Warden (Hunter) - Same Strength, Animal Combat Removed, Undead Slaying Added. Requires Ossuary.
Preserver (Ranger) - Same Strength, Animal Combat Removed, Undead Slaying, Life II and Sorcery Added (Destroy Undead). Requires Ossuary.
Perditioner (Beastmaster) - Same Strength, Animal Comabt Removed, Undead Slaying, Life II and Sorcery Added (Destroy Undead). Requires Ossuary.

Ossuary (Hunting Lodge) - +1 Happy with Furs/+1 Health with Deer removed, +1 Happy/Health with Spirit Mana added. Requires Mysticism.

---------------------------
Naturally stealthy in their own lands, Sidar assassins spend a greater deal of time perfecting the killing arts instead of skulking in shadows.

Griefblade (Assassin) - Additional 1 Poison strength. Marksman promotion removed.
---------------------------
Shades are able to slip in and out of sight and for that matter, the mortal plane entirely. At times they are more akin to spirits than men.

Shade (Shadow) - Same strength, Marksman promotion removed, Spirit Affinity: 1
---------------------------

Other Changes

Hidden Recon - In addition to the standard effect of the Hidden trait (Fog of War regrows within own lands), all Recon Line units belonging to the Sidar gain the Marksman promotion. This is fairly central to the gameplay change for the civilzation and makes a "defended/summoning mage" attack less useful than a "mass melee forces" approach. With most other civs, the opposite would be true - very few civs have a good natural counter to a well designed summoner stack.

Sidar Palace - Specialist Boni - The original version of the Sidar palace has +1 Commerce/+1 Hammer per Bard, Sage and Engineer. At a guess this was a balancing addition to give the Sidar "a little something". It would also make sense that these "more-than-mortal" specialists have had more time to hone their specialism. I kept the boni in-game, but switched Engineer to +2 Hammer, Sage stayed as +1 Commerce and +1 Hammer and Bards became +2 Commerce. This actually allows the Sidar to run a decent specialist economy for either cultural victories or late game heavy production.

Starting Mana Types - Originally Enchantment, Spirit and Body. Spirit removed, Life added. I've hooked a few effects on the Spirit mana and granting these by default removed some of the interest/urgency to acquire Spirit mana. Life mana makes a fitting replacement for immortals who dislike undead.
 
I was under the impression that the current AI can see all territory anyway. this implementation only seems useful against human players(although, since the AI in BtS isn't supposed to cheat, it might be more useful then).

No. The present AI ignores Fog of War (BetterAI does not). It differentiates between explored and unexplored territory. Since the above code changes if the plot is revealed, it should work for the AI.
 
Yeah, there is even one of the tip of loading screen that stroke me since the first time I saw it in Civ4 Vanilla: be careful before signing open border agreements, for the other civ might just want to map your land and then sell it to the highest bidder.

I like your mod so far Vehem, good work ! Until now I had been using the Hidden Trait implementation from Maniac, this is more powerful though. Note that somehow Svartalfar are always powerful whatever the trait Faeryl Viconia is associated to. Might be something in her strategy...
The only thing I don't agree on is removing the marksman promotion from the assassin line. You made assassins stronger but there are already other units with better pure strength, so this renders them quite useless, and disadvantages Sidar which will be without this kind of units. Note that I think assassins/shadows are one of FFH's weapons the AI uses at best.
 
Shouldn't it actually be that the Sidar are immune to marksmen promoted units instead? The assassin failed to kill Morgoth after all.
 
If you remove the Marksman promotion, maybe you should give Assassins a withdrawal chance (maybe 25&#37;?), which would make their Poison damage more useful...
 
If I'm completely honest - the removal from Assassins/Shadows was a bit of a "fudge" due to the implementation of the system that grants the promotion to other Recon units. I can get around that by specifically excluding Assassins-types from the check (it currently removes the promotion then grants it again if they are within cultural borders - same implementation as the old Homeland promotion).

I do like the withdrawl chance option however - more of a "get in, get out" approach.

Regarding Morgoth defeating the assassin - possibly Shades should have SeeInvisible LANDINVISIBLE?

I'm a little wary of changing too much however. There's a line somewhere that beyond which, I'd be adding things "because that'd be cool" rather than to enhance the gameplay/flavour.

Thanks for the feedback in anycase - aiming to put up something for you all to look at over the weekend.
 
Back
Top Bottom