Quick Answers / 'Newbie' Questions

Where can I ask a question here? (Newbee)
Simple quick questions can go here. If you want a more detailed discussion, or have a lotta questions feel free to start your own thread.
 
I was playing a game on Noble and popped Bronze Working from a hut on turn 2 and got the usual "switch to slavery?" prompt, which I declined at that time, but then the very next turn I got a prompt I'd never seen before, saying something like "You may want to take a look at your available civics" featuring the same choices as the "switch to [civic]?" prompt minus the button that instantly switches to the civic. I guess this isn't really a question so much as a "huh, that's weird"
 
AFAIK that popup usually appears in advanced starts, I definitely have seen it before, especially in mods. It usually occurs on the second played turn (i.e. turn 1 if one starts at turn 0).

That it appeared probably is related to discovering the tech in the first 5 turns as these have slightly different rules.
 
Yeah I figured it was something like that. I may have popped it turn 0, I can't remember precisely, but it was definitely within like the first 3 turns this occurred.
 
With Auto-Promotions turned on, how does the computer determine what promotions to add to units?
 
I've never even tried that option, but, according to the code, the promotions get chosen by the AI as intelligently as it can:
Spoiler :
C++:
void CvPlayerAI::AI_doTurnUnitsPost()
{
	// ...
	if (!isHuman() || isOption(PLAYEROPTION_AUTO_PROMOTION))
	{
		for(pLoopUnit = firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = nextUnit(&iLoop))
		{
			pLoopUnit->AI_promote();
		}
	}
	// ...
}
And AI_promote calculates a "promotion value" for each valid promotion and picks the one with the highest such value: CvUnitAI::AI_promotionValue
The value depends a lot on the "AI type" assigned to the unit. For a human unit, I think that'll be the default AI type set for the unit type in Civ4UnitInfos.xml, e.g. city defender for all Archers. This AI type probably gets (permanently) assigned here when a human player starts producing a unit:
Spoiler :
C++:
void CvCity::pushOrder(OrderTypes eOrder, int iData1, int iData2, bool bSave, bool bPop, bool bAppend, bool bForce)
{
  // ...
	switch (eOrder)
	{
	case ORDER_TRAIN:
		if (canTrain((UnitTypes)iData1) || bForce)
		{
			if (iData2 == -1)
			{
				iData2 = GC.getUnitInfo((UnitTypes)iData1).getDefaultUnitAIType();
			}
			// ...
		}
A quick test in the debugger seems to confirm that this is how it works. Auto-promotions at the start of a human turn, newly produced units appear at the end of a human turn. Well, one couldn't promote them faster than that manually either (to have them promoted in case that they need to defend immediately).
 
I've never even tried that option, but, according to the code, the promotions get chosen by the AI as intelligently as it can. A quick test in the debugger seems to confirm that this is how it works. Auto-promotions at the start of a human turn, newly produced units appear at the end of a human turn. Well, one couldn't promote them faster than that manually either (to have them promoted in case that they need to defend immediately).
I looked in here - https://modiki.civfanatics.com/index.php?title=Civ4PromotionInfos - but I could not see any parameter that uses <AIWeighting> or similar
 
I see no way to guide the choice of the promotion through XML other than changing default unit types, – which will have have side-effects. Not seeing a Python override either. The BeginPlayerTurn handler might run before the DLL assigns auto-promotions, so perhaps one could apply some special promotion rules through Python beforehand.
 
Back
Top Bottom