1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[MODCOMP] New Profession: Inventor w/ TechTree

Discussion in 'Civ4Col - Mods and Files' started by Kailric, Mar 23, 2010.

  1. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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:
     
  2. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    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.
    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.
     
  3. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  4. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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 :
     

    Attached Files:

  5. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    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?
     

    Attached Files:

  6. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    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.
     
  7. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  8. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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
     
  9. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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
     

    Attached Files:

  10. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    :eek:

    It is beautiful!
     
  11. cavvy

    cavvy Chieftain

    Joined:
    Nov 28, 2005
    Messages:
    19
    Location:
    Rancho Cucamonga, Ca - USA
    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
     
  12. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  13. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    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.
     
  14. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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...
     
  15. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    Just a quick update on progress. If I had time tonight I would prolly upload the next version... but as it seems I will have to wait till tomorrow, so hopefully I will see you guys tomorrow :)
     
  16. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  17. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    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?
     
  18. Androrc the Orc

    Androrc the Orc Chieftain

    Joined:
    Apr 19, 2004
    Messages:
    1,620
    Location:
    Vienna, Austria
    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.
     
  19. Kailric

    Kailric Jack of All Trades

    Joined:
    Mar 25, 2008
    Messages:
    3,094
    Location:
    Marooned, Y'isrumgone
    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.
     
  20. orlanth

    orlanth Storm God. Yarr!

    Joined:
    Nov 17, 2001
    Messages:
    1,759
    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?
     

Share This Page