Exploring lairs questions

aburke

Chieftain
Joined
Mar 23, 2009
Messages
15
I was looking through the cvSpellIntercase.py file to try to have a better lair exploring strategy.

I have two questions.

1. How does getNoBadExplore get set and what are the modifiers for it?

2. Does RIFE use the function spellExploreLair or spellMarnokDungeoneer for exploring lairs?

Thanks,
Tempus
 
I'm not exactly sure myself here (I have not touched exploration in some time; Snarko set that up) but IIRC, NoBadExplore comes from a unit value (promotion; Look at adventurer, I think?).

ANd I don't believe we use either function anymore; Exploration is now handled in the DLL. Results are set up as goodies (GoodyInfos in GameInfo), a list of Goodies is assigned to a GoodyClass via GlobalTypes (XML/GlobalTypes), and then GoodyClasses are assigned to improvements.

If a goody requires python, then it has it's own python callback specific to that goody within SpellInterface.
 
Thanks. I'm trying to figure out how to maximize my return on lairs.

I tried searching the threads but so many of them are out of date, it is hard to get good info. So I tried searching the code itself. If you had any locations you can send me to (either online or in the code), I'd appreciate it. I love the fact that lairs aren't always worth it. You need to be prepared and do a cost-benefit analysis, which is always the hallmark of a good strategy game. However, I'm trying to understand the mechanic of how it works.

I've heard people mention using heroes, but that seems incredibly dangerous unless there is a correspondingly high trade off in rewards. Right now, I tend to use low experience units/low value recons with more powerful troops to mop up. But there are probably better strategies.

I looked up the two files you mentioned, but there is nothing about the mechanics on choosing big goods versus big bads for lairs.

Thanks.
 
I don't know how applicable this is to RiFE, but here's some notes from FFH. They might be applicable.

http://forums.civfanatics.com/showthread.php?t=347007

Some of my own spoiler notes from a cobbled together reference doc I made for myself.

(Attributions unsure)

Spoiler :
http://forums.civfanatics.com/showthread.php?t=347007&highlight=dungeon

Each lair is harder, offering more penalties but better "good" results. The following is off the top of my head, so any errors = its 7am on block leave.

Barrow: Lowest level. Defended by skeletons, spawns skeletons. Can spawn the various Big Bads if you are very unlucky. Most good events are negligible. Can be safely explored with a stack of warriors.
Ruin: Mid level. Defended by lizardmen, spawns lizardmen. All of the bad results, but can pop a tech or a GP if you are very luck. Explore with heros or axe-men
Dungeon: Top level. Most of the giant Bad stacks spawn here. Decent chance to pop GP, religious units [which can be used to found a religion]. Explore with leveled heros.

Goblin Fort: spawns only goblins. Seems to function like a ruin, so early in the game if the Goblin Archer wanders off seize the terrain and hold it to prevent future spawns.
Shipwreck: Does not spawn anything, results similar to ruins but drawns from a smaller list so that only sea units can pop.

All lairs get better results when exploring them with a high level unit, so don't go popping dungeons with a turn 3 scout. If your enemies are exploring them around you, aggressively defend them [declaring war if need be] to keep the dreaded Azer or Ogre spawn on turn 20. A good rule of thumb is to park a unit on top and wait until you have a stack ready to explore them to mitigate bad results.

As far as I know, only shipwrecks draw from a different event list. The rest are just weighted differently. Its possible to explore the dungeon with a level 15 unit and get the same event as if you explored a barrow with a level 1 unit.
***************************************


There are only two tiers of lairs, as far as exploring go: normal and epic. Epic lairs are aifon isle, bradelines well, broken sepulcher and pyre of the seraphic. Everything else is a normal lair.

There are five types of results. BigBad, Bad, Neutral, Good and BigGood. Normal lairs can pop any of these, epic lairs only BigBad and BigGood. As HadesScorn said the higher the level of the unit exploring the higher the chance of a better result. It's still largely random however, to be certain to get good results you'd need a unit of at least level 74 (normal lair) or 54 (epic lair)!

For spawning units lairs on water use one list, lairs on land another.

BigBad: ALWAYS spawns a unit. With a good promotion. Plus henchmen.
Barrows can spawn skeleton/pyre zombie henchmen.
Ruins can spawn lizardman/gorilla henchmen.

Bad: Mostly bad promotions, sometimes units. Can kill level 1 units.

Neutral: Stuff like mutation, portals, catching the unit in a cage. Can spawn units.

Good: Mostly adds promotions, can also do stuff like give gold or spawn religion disciples. Some things (like disciples) disabled on water.

BigGood: Things like resources, golden ages, spawning friendly units (like great people). Some things disabled for water, some things disabled for land, mostly resources and units.

********************************************************


The game picks a random number 0-99 then adds the explorers level (higher level explorers get better results):

If the result is less than 14 you get a big bad result.
If it is 14-43 you get a bad result.
If it is 44-73 you get a neutral result.
If it is 74-93 you get a good result.
If it is 94 or higher you get a big good result.

What exactly the result is depends on a lot of things including how far into the game you are, the characters specifics, the type of lair being searched, if its on water or land, etc. The game builds a list of possible outcomes for that level (big bad, bad, etc) then randomly picks one.

******************************************************

The spell can be found in Assets/Python/Entrypoints/SpellInterface.py, where it appears level is the only thing to effect the die roll.

You can find lair exploration results in Assets/Python/CustomFunctions.py; "Good" results are defined under def exploreLairGood(self, caster):,"Big Good" results are defined under def exploreLairBigGood(self, caster):, "Bad" results are defined under def exploreLairBad(self, caster):, "Big Bad" results are defined under def exploreLairBigBad(self, caster):, and "Neutral" results are defined under def exploreLairNeautral(self, caster):,


"Good" results are: giving the unit the Spirit Guide, Enchanted Blade, Spellstaff, Poisoned Blade, Flaming Arrows, Shield of Faith, Bronze Weapons, Iron Weapons, or Mithril Weapons promotion, or giving it xp, giving you gold, showing you a Treasure Chest (which can be opened with an effect similar to exploring a lair), giving you Supplies, a Healing Potion, or a disciple of a random religion.


The chance that a lair is destroyed is based on the result. Generally speaking the better the result the bigger the chance of the lair being removed. BigGood has a 100% chance to destroy it.


All possible events are in CustomFunctions.py. The chance of the different types of results being triggered is in CvSpellInterface.py.


I'm sure the mechanics of how the game handles it have changed. But, some of the general guidelines given in the spoiler may still be applicable in the newer RiFE system. Maybe... /shrug
 
Thanks Morkonan,

I had actually come across that thread and it was very helpful. Unfortunately (or I guess fortunately because Civ runs faster or something), RIFE doesn't use python for the dungeons. I read through the XML files, and they seem to take a similar approach but without ranking the results. So the selection from bigbad or biggood is completely random, and your stats only affect your ability to get bigbad or biggood. Note, however, this is my reading of the code, which is very limited.

I'd love to know where the actual mechanics your result gets determined (i.e. biggood vs bigbad), but I guess it isn't somewhere too accessible.

If I was a true scientist, I would setup random tests and discover the parameters myself, but thankfully, I am lazier than that and limit myself to inquiries on the forums.
 
Here's the DLL function for deciding which goody to return.

There is no scaling based on turn/tech, but once lair results have been redone there will be; That was the point of introducing upgrading lairs.

Code:
GoodyTypes CvPlayer::doLair(CvPlot* pPlot, CvUnit* pUnit)
{
	if (pPlot->getImprovementType() == NO_IMPROVEMENT)
		return NO_GOODY; //Just in case

	bool bGood;
	int iGoodChance = 50;
	iGoodChance += pUnit->getNoBadExplore();
	iGoodChance += GC.getImprovementInfo(pPlot->getImprovementType()).getNoBadExplore();

	bGood = GC.getGame().getSorenRandNum(100, "Good Lair result") < iGoodChance;

	std::vector< std::pair<GoodyTypes, int> > aePossibleGoodyWeights;
	int iTotalWeight = 0;
	for (int i = 0; i < GC.getNumGoodyInfos(); ++i)
	{
		GoodyTypes eGoody = (GoodyTypes)i;
		int iWeight = GC.getGoodyInfo(eGoody).getWeight();
		if (iWeight > 0)
		{
			if (GC.getGoodyInfo(eGoody).isBad() == !bGood)
			{
				for (int j = 0; j < GC.getNumGoodyClassTypes(); j++)
				{
					if (GC.getGoodyInfo(eGoody).isGoodyClassType(j) && GC.getImprovementInfo(pPlot->getImprovementType()).isGoodyClassType(j))
					{
						if (canReceiveGoody(pPlot, eGoody, pUnit))
						{
							iTotalWeight += iWeight;
							aePossibleGoodyWeights.push_back(std::make_pair(eGoody, iTotalWeight));
						}
						break;
					}
				}
			}
		}
	}

	if (iTotalWeight > 0)
	{
		GoodyTypes eGoody;
		int iValue = GC.getGameINLINE().getSorenRandNum(iTotalWeight, "Explore lair result");
		for (std::vector< std::pair<GoodyTypes, int> >::iterator it = aePossibleGoodyWeights.begin(); it != aePossibleGoodyWeights.end(); ++it)
		{
			eGoody = (*it).first;
			if (iValue < (*it).second)
			{
				receiveGoody(pPlot, eGoody, pUnit);
				return eGoody;
			}
		}
	}


	return NO_GOODY;
}
 
The scary thing is that I can actually understand that.

I have to say that the idea of scaling by type of ruin appeals to me. If you enter the ninth layer of hell, you should expect a serious fight. If you are clearing the rats in the cellar, you shouldn't worry as much. Of course the rewards would also vary by the risk involved.

I want to thank both of you guys for responding to my request. However, there is still one part of my question that I don't understand yet.

How does pUnit->getNoBadExplore() get set? I know know the relative risks and rewards for when you have a 1st level guy doing the exploring. But what changes if he is 10th? Or if he has the recon unit type or one of the animal blood promotions (I forget which).

Thanks again for helping me understand the game better.
 
Top Bottom