Primitive Generator

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Bazarov wrote: First off, what is the total list of 'recruit_pattern' things? (What does 'mixed' mean?) without a 'pattern' will it just recruit randomly?
recruitment_pattern lists the unit 'usage's that will be recruited. If you have,

Code: Select all

recruitment_pattern=fighter,fighter,scout,archer
Then the leader will recruit 50% fighters, 25% scouts, and 25% archers. 'mixed fighter' is just another usage type (that generally means that the unit is good at close and long range).

If omitted, the default recruitment pattern will be used, which is 'fighter,fighter,archer'.
Bazarov wrote: Aggression: what is the minimum and maximum values?
Maximum is 1. 1 means that when the AI calculates combat, it will always attempt the moves that inflict the most damage on the enemy, without consideration of how much damage it will take. You could have aggression above 1, but that would make the AI pursue moves that hurt it, even if it doesn't hurt the enemy more.

Aggression of 0 means that the AI will equally weight damage it inflicts and damage it takes. If it estimates that a move will inflict 5 damage, but it will take 6 damage, it will not do the move (note that 'damage' is weighted according to numerous factors, such as how valuable the unit is, and how close to death it is).

Aggression of -1 means that the AI must inflict double the damage it takes for a move to be worthwhile.

There is no minimum aggression, but I don't recommend values below -1.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
fmunoz
Founding Artist
Posts: 1469
Joined: August 17th, 2003, 10:04 am
Location: Spain
Contact:

Post by fmunoz »

Better not use Fighter, Commander, Lord and Princess in the random geneated maps, this units are tied to the campaign characters...
Bazarov

Post by Bazarov »

I was asking if that is what the 'income' and 'gold' WML headers did, that is, work for easy, medium, hard in 'shorthand' as an array. I cannot find any reference to those tags (being used that way, anyway) in the Wiki... is there a reference document you have access to that I don't?
Will 'Gold=200' overwrite '{GOLD 150 250 350}' ? Does placement order matter?
(In other words, those numbers were not what I was using, they were a question, my values will be calculated based on difficulty, number of enemies and allies, etc)
Is the 'recruitment calculator' partially random? Will it not recruit Vampire Bats even if they are in the list but 'scout' isn't in the pattern, or just rarely? What I am asking is if I have to carefully match my patterns against the list of recruitables to make sure they can all actually be recruited by the AI, or if it will all work itself out, and if so, what are the full lists of 'pattern': fighter, scout, archer, mixed...?(Mage?, Healer?Swimmer?) Is there a 'random' pattern (that would be very nice, so I could go 'fighter, fighter, archer, random' so that it would be mostly fighters but sometimes throw in a scout or something.)

I did update to use 'team=' wow, that was a lot easier than the previous model.
fmunoz
Founding Artist
Posts: 1469
Joined: August 17th, 2003, 10:04 am
Location: Spain
Contact:

Post by fmunoz »

From team.cpp

Code: Select all

	//default recruitment pattern is to buy 2 fighters for every 1 archer
	if(recruitment_pattern.empty()) {
		recruitment_pattern.push_back("fighter");
		recruitment_pattern.push_back("fighter");
		recruitment_pattern.push_back("archer");
	}
From ai.cpp

Code: Select all

		//get scouts depending on how many neutral villages there are
		int scouts_wanted = current_team.villages_per_scout() > 0 ?
		                neutral_towers/current_team.villages_per_scout() : 0;

		std::map<std::string,int> unit_types;
		while(unit_types["scout"] < scouts_wanted) {
			if(recruit(map,leader->first,"scout",gameinfo,team_num,current_team,
			           min_gold,units,disp) == false)
				break;

			++unit_types["scout"];
		}

		const std::vector<std::string>& options =
		                        current_team.recruitment_pattern();

		if(options.empty()) {
			assert(false);
			return;
		}

		//buy fighters as long as we have room and can afford it
		while(recruit(map,leader->first,options[rand()%options.size()].c_str(),
		              gameinfo,team_num,current_team,min_gold,units,disp)) {

		}
In the last "while" there is the answer to your question... so no healers, swimmers or other creatures recruited if they are not in the list...
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Anything inside {} is generally using the WML macro system.

{GOLD 100 200 300} is equivalent to

Code: Select all

#ifdef EASY
gold=100
#endif

#ifdef MEDIUM
gold=200
#endif

#ifdef HARD
gold=300
#endif
and if there are multiple attributes with the same name, the second overrides the first, so the answer to your question is 'yes'.

Also, as fmunoz's code paste shows, AIs will recruit scouts while there are neutral villages available to be captured. You can use scouts_per_village to control how many scouts they will recruit per neutral village. (and set to 0 to recruit no scouts).

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Post Reply