Worker AI Modification

TyloniusFunk

Chieftain
Joined
Jul 30, 2006
Messages
8
Before I go through the trouble of downloading the SDK, I'm hoping someone can answer this question.

Is it possible, with the SDK, to modify the worker improvement AI. If so, is it also possible to add multiple priorities (similar to "Build Trade Network", "Improve closest city", etc.")?

I'm hoping to step up the intelligence of the worker automation so that automating a worker is no longer a strategic disadvantage. Also, this could significantly improve lower levels of difficulty as your AI opponents would benefit from improved worker decidsions as well.

Feel free to slap me if there is already such a modification available or in progress that I should know about.
 
TyloniusFunk said:
Before I go through the trouble of downloading the SDK, I'm hoping someone can answer this question.

Is it possible, with the SDK, to modify the worker improvement AI. If so, is it also possible to add multiple priorities (similar to "Build Trade Network", "Improve closest city", etc.")?

I'm hoping to step up the intelligence of the worker automation so that automating a worker is no longer a strategic disadvantage. Also, this could significantly improve lower levels of difficulty as your AI opponents would benefit from improved worker decidsions as well.

Feel free to slap me if there is already such a modification available or in progress that I should know about.

Yup, it's all in the SDK. Adding things such as new worker automations aren't too difficult either, you just need to be able to find where the old ones are and add code to their locations.

For an idea of what you're looking at, here's a snipper from "AI_update" (taken from the Vanilla source, although it'll probably be similar in Warlords) located in the file CvUnitAI.cpp. This is the "jumping point" for all worker automatization. Each one of the functions called has all the juicy details of what's actually done, but this gives you a good idea of how it gets there.
Spoiler :

Code:
if (getGroup()->isAutomated())
	{
		switch (getGroup()->getAutomateType())
		{
		case AUTOMATE_BUILD:
			if (AI_getUnitAIType() == UNITAI_WORKER)
			{
				AI_workerMove();
			}
			else if (AI_getUnitAIType() == UNITAI_WORKER_SEA)
			{
				AI_workerSeaMove();
			}
			else
			{
				FAssert(false);
			}
			break;

		case AUTOMATE_NETWORK:
			AI_networkAutomated();
			// XXX else wake up???
			break;

		case AUTOMATE_CITY:
			AI_cityAutomated();
			// XXX else wake up???
			break;

		case AUTOMATE_EXPLORE:
			if (getDomainType() == DOMAIN_SEA)
			{
				AI_exploreSeaMove();
			}
			else
			{
				AI_exploreMove();
			}
			break;

		default:
			FAssert(false);
			break;
		}
	}
 
Back
Top Bottom