[MODCOMP] New Profession: Inventor w/ TechTree

That's really awesome Kailric! :goodjob:. This is getting to be the most impressive modcomp of Colonization ever.

I've started creating a scifi techtree for use in my mod, will take awhile since I'm planning a lot of techs! :scan: I'll post it here when finished, I'm still using the XML tags from standard Colonization so others can use some of the techs if they like them. Could you include your modcomp Not Allow Specified Professions per Unit in your next version? I think that's also a great feature to have available when making techs.

BTW, I tested making a tech that consumes Bells and Crosses as yields, and it seems to convert them to Bulbs ok as long as they were being produced in the same colony as the Inventor. I think it could even work with the Education yield, that could allow cool possibilities for political or cultural kinds of techs. :king:

Cool man, yeah I'll merge that mod in. In your testing did you notice if the Bells/Crosses being consumed where subtracted from the players total Bells? Well, thanks to Aymericks hard work on the Multi Yields mod I was able to figure things out and get it to work right a whole lot faster. Its tuff trying to decipher someone elses code. :crazyeye:
 
It seemed like they were subtracted correctly from the total Bells/Crosses produced in that city, so if you had a city making 9 Bells/turn and converted 6 to Bulbs then you'd be making a net 3 Crosses/turn in that city, which seemed to count correctly toward your overall total per turn. I didn't test much with multiple cities though. I remember Androrc mentioned using BellsStored in the quote below, I'm not sure if that's necessary or you could just use YIELD_BELLS per city.
But, then again for future mods and such I thought it would be cool to have like Statesmen able to Research new Governing Pholosophys or Techs and such.
That's a pretty interesting idea. You could use the BellsStored as a cost for such research as well as normal YIELD_IDEAS, which would expand the use of bells. In case you choose to do so, I recommend changing doBells() in CvPlayer so that the king increasing units in the REF doesn't deplete the BellsStored, but rather depletes a second variable that is also dependent on bell rate.

Does the AI seem able to research techs ok that need multiple yields? I'm thinking of giving a free yield of 1 Bulb/turn from the capital city like happens with Crosses, so it's always possible to make some slow progress and not get stuck.
 
Does the AI seem able to research techs ok that need multiple yields? I'm thinking of giving a free yield of 1 Bulb/turn from the capital city like happens with Crosses, so it's always possible to make some slow progress and not get stuck.

AI at the moment do not require any Yields so they get a free Handicap there. I will need to look over the code to see what tells the AI to Allocate yields too. You can adjust how important research is my setting the TK_IDEAS_CITY_VALUE Its set at 75 and they seem to allocate researchers just fine as long as no Yields are required. If you have Logging and Cheats turned on there will be a note made in the MPLog txt file about the Each AIs Research.
 
I made up a Tech Tree for the Colonization Period. The techs benefits are not listed but still it lets you get an Idea of what all was going on back then at least as far as I can tell :) I didn't list the techs by Category this time. In the next update I'll have two options where you can list techs automaticly by Category or place them yourself with X,Y coordinates for a more organic approach.

Edit: I edited my tech tree :)
Spoiler :
 

Attachments

  • TechTree.jpg
    TechTree.jpg
    127.8 KB · Views: 446
Here's the beginning of mine so far (right now just a generic 4 branches for each of the processed resources:rolleyes:, I'll have to add some culture/military techs and adjust to make it more interesting).

For the existing <AllowsUnitClasses> , can it check for the tech when new immigrants show up on the docks, and also when purchasing units in Europe? For my mod's dystopian setting, most of your early immigrants will start out as Criminals and Indentured Servants until techs get unlocked that allow you to start getting the better colonist types. I'm planning on having a political tech Civil Rights that allows Free Colonists to start appearing as immigrants, and later Emancipation which obsoletes Criminals from showing up on the docks.

AI at the moment do not require any Yields so they get a free Handicap there.
Hmm, if it works out in playtesting maybe it's ok for them to have that advantage.. the standard game AI players have always been far too weak, maybe this is just what they need to make it more of a challenge. Is there a way to make some techs nontradable, and to discourage civs like the Europe Kings from buying/selling techs?
 

Attachments

  • GameInfo.zip
    8.5 KB · Views: 161
For the existing <AllowsUnitClasses> , can it check for the tech when new immigrants show up on the docks, and also when purchasing units in Europe?

The function that controls which immigrants are chosen is this one in CvPlayer.cpp:

Code:
UnitTypes CvPlayer::pickBestImmigrant()
{
	std::vector<int> aiWeights(GC.getNumUnitInfos(), 0);
	for (int iUnitClass = 0; iUnitClass < GC.getNumUnitClassInfos(); ++iUnitClass)
	{
		UnitTypes eUnit = (UnitTypes) GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(iUnitClass);
		if (NO_UNIT != eUnit)
		{
			int iWeight = GC.getUnitInfo(eUnit).getImmigrationWeight();
			for (int i = 0; i < getUnitClassImmigrated((UnitClassTypes) iUnitClass); ++i)
			{
				iWeight *= std::max(0, 100 - GC.getUnitInfo(eUnit).getImmigrationWeightDecay());
				iWeight /= 100;
			}

			aiWeights[eUnit] += iWeight;
		}
	}

	UnitTypes eBestUnit = (UnitTypes) GC.getGameINLINE().getSorenRand().pickValue(aiWeights, "pick immigrant");
	FAssert(NO_UNIT != eBestUnit);
	if (eBestUnit != NO_UNIT)
	{
		changeUnitClassImmigrated((UnitClassTypes) GC.getUnitInfo(eBestUnit).getUnitClassType(), 1);
	}

	return eBestUnit;
}

Change it to:

Code:
UnitTypes CvPlayer::pickBestImmigrant()
{
	std::vector<int> aiWeights(GC.getNumUnitInfos(), 0);
	for (int iUnitClass = 0; iUnitClass < GC.getNumUnitClassInfos(); ++iUnitClass)
	{
		UnitTypes eUnit = (UnitTypes) GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(iUnitClass);

		//Inventor
		bool bAllowed = true;
		for (int iCivic = 0; iCivic < GC.getNumCivicInfos(); ++iCivic)
		{
			if (GC.getCivicInfo((CivicTypes) iCivic).getCivicOptionType() == (CivicOptionTypes)GC.getDefineINT("CIVICOPTION_INVENTIONS"))
			{
				CvCivicInfo& kCivicInfo = GC.getCivicInfo((CivicTypes) iCivic);
				if (eUnit != NO_UNITCLASS && (UnitTypes)kCivicInfo.getAllowsUnitType() == eUnit)
				{
					if (getIdeasResearched((CivicTypes) iCivic) == 0)
					{
						bAllowed = false;
					}
				}
			}
		}

		if (NO_UNIT != eUnit && bAllowed)
		//Inventor End
		{
			int iWeight = GC.getUnitInfo(eUnit).getImmigrationWeight();
			for (int i = 0; i < getUnitClassImmigrated((UnitClassTypes) iUnitClass); ++i)
			{
				iWeight *= std::max(0, 100 - GC.getUnitInfo(eUnit).getImmigrationWeightDecay());
				iWeight /= 100;
			}

			aiWeights[eUnit] += iWeight;
		}
	}

	UnitTypes eBestUnit = (UnitTypes) GC.getGameINLINE().getSorenRand().pickValue(aiWeights, "pick immigrant");
	FAssert(NO_UNIT != eBestUnit);
	if (eBestUnit != NO_UNIT)
	{
		changeUnitClassImmigrated((UnitClassTypes) GC.getUnitInfo(eBestUnit).getUnitClassType(), 1);
	}

	return eBestUnit;
}

...and it should work.
 
Here's the beginning of mine so far (right now just a generic 4 branches for each of the processed resources:rolleyes:, I'll have to add some culture/military techs and adjust to make it more interesting).

For the existing <AllowsUnitClasses> , can it check for the tech when new immigrants show up on the docks, and also when purchasing units in Europe? For my mod's dystopian setting, most of your early immigrants will start out as Criminals and Indentured Servants until techs get unlocked that allow you to start getting the better colonist types. I'm planning on having a political tech Civil Rights that allows Free Colonists to start appearing as immigrants, and later Emancipation which obsoletes Criminals from showing up on the docks.


Hmm, if it works out in playtesting maybe it's ok for them to have that advantage.. the standard game AI players have always been far too weak, maybe this is just what they need to make it more of a challenge. Is there a way to make some techs nontradable, and to discourage civs like the Europe Kings from buying/selling techs?

Cool, yeah I haven't needed to check for Immigrants so I will add the code Androrc showed so that it will do that in the next update. Yeah, I am not sure what all the AI does as far as manufacturing goods. I am not sure if they go throug the whole process or not. I am going to do some testing to see.

Yeah, I'll add an attribute to make a Techs NoneTrade able, thats a good addition. At the moment Natives and Kings do not do research. Natives have all the Native techs however for trade. I will eventually add attributes to the Civ Leaders that allows for Free Techs at the start. I could make it so that Kings can aquire techs over time and then allow the player to Purchase them form him... or the King could demand a Tech from the player as tribute. Those would be good additions to Diplomacy as it was really shallow to start with.

"Ahh, I see you have learned Flintlock Mustket, I demand this knowledge or I will raise your taxes!"

So the player then can give Flintlocks to keep taxes low but then will have to face the Flintlock in the Battle for Independence.

I plan to add attributes for which techs a Leader desires, with kings of course wanting all the Military techs. Right now a Leader's tech choice is just random.
 
There is a bug in the current release that will cause a CTD if you don't have a research partner. The below code in CvPlayer::doIdeas needs to be changed as below. Also, I discovered an oddity I need to work out. It seems that if one Nation is gathering Research all the other AI Leaders want gather any or at least its Research gets lowered to a very low priority. I need to figure out what creates this oddity and stop it.
Code:
if (ePartner == NO_PLAYER)
            {
                CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_PLAYER_COMPLETED_RESEARCH", GC.getCivicInfo(eCivic).getTextKeyWide());
                gDLL->getInterfaceIFace()->addMessage(getID(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_UNIT_GREATPEOPLE", MESSAGE_TYPE_MAJOR_EVENT, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"));
            }
            else
            {
                CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_PLAYER_COMPLETED_RESEARCH_PACT", GC.getCivicInfo(eCivic).getTextKeyWide(), GET_PLAYER(ePartner).getName());
                gDLL->getInterfaceIFace()->addMessage(getID(), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_UNIT_GREATPEOPLE", MESSAGE_TYPE_MAJOR_EVENT, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"));
            }

EDIT: Ok, I figured out what as causing the oddity above. I didn't know that "getActivePlayer()" only refers to Human Players playing the game. I thought it ment what ever players turn it was. So I had to make some changes to the code.

Version 0.9a is uploaded now to Quick fix these issues
 
I been hard at work on the next update and its looking good. My tech tree has come a long way and I have added several new tags. I also merged the Civ4 arrows that point to each successive tech... now that was cool. You can see it in the pic. This system will be compatable with any tech tree.. meaning the Arrows auto find the correct Tech it should be pointing to.
Spoiler :



New Additions for next update:

- Added my Viscos Mod (NotAllowProfessionsPerUnit)
- Leaders will start with a few of the starting Techs, each Nation will have their own starting Techs
- Prolific Inventors are now a Special Named unit. You can no longer aquire them from Immigration. You now gain Research Experince like you do Combat Experience. There will be an Indicator bar on the Research Advisor that informs you when the next Prolific Inventor will be available. They will appear in Europe and will need transported to your colonies.

New Tags
- Tech grants a free tech
- allow TradeMaps
- isTradeable
- iX_locaion and iY_location for using the new Research Advisor layout. They workd just like Techs in Civ4
- DisallowsTech... that means once you research this tech the Disallowed tech will not be researchable
- iProlificInventorRateChange- changes the rate you aquire Research Experince
- and more
 

Attachments

  • ResearchTemp.jpg
    ResearchTemp.jpg
    163.9 KB · Views: 420
Sort of a new poster on the forums and i must say i loved playing this beta form of the tech tree you gentlemen made for civ4: colonization. I felt the game was lacking in late game and it needed something to keep my interests moving forward and this mod does that. Maybe i'm just spoiled and need a tech tree of some kind in my civ games. I wanted to show my appreciation to you gentlemen and hope to see further improvements to this mod or mods that will incorporate this tech tree into future mods down the road.

There is one thing that i had noticed while playing and you must excuse me if someone else might of brought it to your attention but when i was in game and had enough money to purchase more ships from Europe that the Indiaman ship which according to the tech tree was an upgrade from the merchant ship had a zero gold cost attached to it. Now this might be some small minuscule glitch that can be corrected I figured i would let you know about it so it might be corrected in the next update.

As far as the rest of the mod goes it's quite enjoyable and hope to see more good work from you gents down the road.

cavvy
 
Sort of a new poster on the forums and i must say i loved playing this beta form of the tech tree you gentlemen made for civ4: colonization. I felt the game was lacking in late game and it needed something to keep my interests moving forward and this mod does that. Maybe i'm just spoiled and need a tech tree of some kind in my civ games. I wanted to show my appreciation to you gentlemen and hope to see further improvements to this mod or mods that will incorporate this tech tree into future mods down the road.

There is one thing that i had noticed while playing and you must excuse me if someone else might of brought it to your attention but when i was in game and had enough money to purchase more ships from Europe that the Indiaman ship which according to the tech tree was an upgrade from the merchant ship had a zero gold cost attached to it. Now this might be some small minuscule glitch that can be corrected I figured i would let you know about it so it might be corrected in the next update.

As far as the rest of the mod goes it's quite enjoyable and hope to see more good work from you gents down the road.

cavvy

Welcome to the Forums, mate. Yeah, us modders have been churning out some really neat stuff. Anyway, thanks for the feed back. Actually sometime today if all goes well I'll post the next version of this mod. I been waiting to get the tech tree fully filled out and functional before I released the next version but I am close to that now. We will need some testers for the next version for sure so stay tuned :cool:

Edit: The bug you reported has been fixed in the next version.
 
Kailric are you planning to upload a new tech modcomp version soon? I'll definitely be using it in my mod, but wanted to wait till you're done with most planned major updates.

Yeah, soon sho nuff, I been letting the AI play test it for me last few days when I had a chance to work on it. Had a several crash bugs I had to work out cause the AI wasn't programed to handle all the changes I made. I can run a whole game now though with out a crash. I have a new victory condition with this update called "Industrialization" victory. To achieve this victory you have to first Research "Industrilization". Then this opens up Industrilization Victory for all Colonies.

The tech tree I created kinda follows actual history in America as it slowly became industrialized. Cotton played a huge role in this in the invention of the cotton gin and steam power. With that being so, in order to win an Industrial victory you have to be the first to sell a certain amount of Cloth to Europe and cloth can't be bought from Europe at this time in case you was planning on cheating :)

Anyway, back to testing...
 
Just uploaded v 1.0 for testing. A storm blew out my internet so I am late in posting this. Its still down and I'll update the changes more when I get the net back. The quickest way to check out all the changes is to just look over the new Tech Tree.

Things to note:
Flavor Units/Professions

All colonys start with the new European Units instead of Free Colonists and Veteran Conqueror instead of Veteran Soldiers. These units are just for Flavor to add to the feel of Discovering a New World. After you research Colonial Traditions your colonist will begin to adapt Colonial life style and the Units will change over to the Vanilla Colonization units.

Also, the Explorer Profession is just a Flavor for Scout Profession.
 
It looks really great :goodjob:. But in trying to merge it to my mod, I'm getting lots of XML errors on startup saying that tags like MILITARY_TECH are incorrect in xml\GameInfo/CIV4ForceControlInfos.xml. I can't find any CIV4ForceControlInfos.xml in the mod folder. Do you know what could be causing those?
 
It looks really great :goodjob:. But in trying to merge it to my mod, I'm getting lots of XML errors on startup saying that tags like MILITARY_TECH are incorrect in xml\GameInfo/CIV4ForceControlInfos.xml. I can't find any CIV4ForceControlInfos.xml in the mod folder. Do you know what could be causing those?

It probably is the case of the game having an error reading one of the xml files, and then not be able to read the other ones.
 
It looks really great :goodjob:. But in trying to merge it to my mod, I'm getting lots of XML errors on startup saying that tags like MILITARY_TECH are incorrect in xml\GameInfo/CIV4ForceControlInfos.xml. I can't find any CIV4ForceControlInfos.xml in the mod folder. Do you know what could be causing those?

When I get errors like this its usually because something is wrong in the GlobalDefineAlt.xml. Have you copied over all my changes to the GlobalDefineAlt.xml? They have to be the same as whats in the SDK. I can't remember the exact C++ file those defines are in and my internet is still out so I am using a neighbors pc, but the file name ends with Set.cpp I think. I'll check to make sure all the cpp files are there.

I did find one bug so far. If you try to manually cancel a Deal, like open borders, the game will crash. Declaring war works just fine though. I'll post an update soon with some tweaks I made. Any new changes I'll have marked different so you can more easily merge in the new changes.
 
XML errors on startup saying that tags like MILITARY_TECH are incorrect
When I get errors like this its usually because something is wrong in the GlobalDefineAlt.xml.
Youre right; it was because the Globaldefinesalt.xml had set names for tags like MEDICINE_TECH, MILITARY_TECH, TRADE_TECH, DISCOVERY, CONTACT_YIELD_GIFT_TECH. I redefined those to use tagnames from my mod which solved the errors. Do those Globaldefines settings have specific effects in-game?
 
Top Bottom