Vincentz Infinite Projects [VIP MOD]

hi good work.
i like your idea about unit per tile in eras.
hope to here about new version soon!!!!!!!
 
Added Unit healing cost gold.

PHP:
void CvUnit::doHeal()
// Vincentz Healing Cost
{
	if (((currHitPoints() * 100) / maxHitPoints()) < (healRate(plot())) *5)  
	{
		int unitHealCost = ((healRate(plot())) * (getUnitInfo().getProductionCost()) / GC.getDefineINT("UNIT_HEAL_COST_MODIFIER"));
		if (GET_PLAYER(getOwnerINLINE()).getGold() > unitHealCost)
		{
			changeDamage(-(healRate(plot())));
			GET_PLAYER(getOwnerINLINE()).changeGold(-unitHealCost);
			
		}
	}	
}
// Vincentz Healing end

Translated: When players (or AI's) turn, each unit goes through a check, setting movepoints to full, do healing, etc etc. This is the call for healing. (used to be changeDamage(-(healRate(plot()))); )
Now it checks to see how much the unit costs, multiplies it with the amount of healing done to the unit and divides with a modifier set in GlobalDefinesAlt.xml. 100 is 1 gold/hammer healing (pretty high). The higher amount of UNIT_HEAL_COST_MODIFIER the lower cost of healing. 200 is ½ gold pr. hammer. 1000 would be 1 gold pr. 10 hammers healed.
 
The AI is certainly still capable of launching a mighty naval invasion despite the 25 UPT.
Having the AI behaving this competent makes me almost happy I lose the city (and prolly a few more since continent was poorly defended) :D

Spoiler :
xlW7PWr.jpg


now I just need to fix the fastmovers ratio. Almost all attacks so far have been with horsies
 
Now the mouseover over the AIs in the scoreboard shows icon of leader, civ, religion and civics:

Spoiler :
P91IX1L.jpg


code: CvDLLWidgetData.cpp - CvDLLWidgetData::parseContactCivHelp
PHP:
//Vincentz Civimage
	szBuffer.append(NEWLINE);
	szBuffer.append(CvWString::format(L"<img=%S size=64></img>", GC.getLeaderHeadInfo(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getLeaderType()).getButton()));
	szBuffer.append(CvWString::format(L"<img=%S size=64></img>", GC.getCivilizationInfo(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getCivilizationType()).getButton()));
	if (GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getStateReligion() != NO_RELIGION)
	{
		szBuffer.append(CvWString::format(L"<img=%S size=64></img>", GC.getReligionInfo(GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getStateReligion()).getButton()));
	}
	szBuffer.append(NEWLINE);
	for (int i = 0; i < GC.getNumCivicOptionInfos(); i++)
	{
		CivicTypes eCivic = GET_PLAYER((PlayerTypes)widgetDataStruct.m_iData1).getCivics((CivicOptionTypes)i);
		szBuffer.append(CvWString::format(L"<img=%S size=38></img>", GC.getCivicInfo(eCivic).getButton()));
	}

//Vincentz Civimage

edit: looks like civ fantatics forum is a bit cheeky. Its suppose to say parseContactCivHelp ;)
 
Fixed the UPT so it doesnt count invisible units
Added a counter when mouseover tile (Units (actual / max)
Took me the better of two hours :( and prolly not the best way...

In the beginning of each turn, each unit do a verifyStackValid, and if the stack is too big (if unit is build in a city and its already full) then it will find the closest place to put the unit (though not planes, but thats another story, and a leftover bug in BtS where even though there is a limit, you could still build planes).
It also checks when you move into a tile if its full.

Impact on gameturns doesnt seem like a lot. Im on a colossal map with 30 civ in 1622 and turns are (imho) surprisingly fast.

Spoiler :
gUvpCrB.jpg


GlobalDefinesAlt.xml
PHP:
	<Define>
		<DefineName>MAXUPT</DefineName>
		<iDefineIntVal>25</iDefineIntVal>
	</Define>

CvUnit::doTurn
PHP:
	verifyStackValid();

CvUnit::canMoveInto under default (get domaintype)
PHP:
//Vincentz #UPT
	int iNumVisibleUnits = 0;
	if (pPlot->isVisible(GC.getGameINLINE().getActiveTeam(), false))
	{
		CLLNode<IDInfo>* pUnitNode5 = pPlot->headUnitNode();
		while(pUnitNode5 != NULL)
		{
			CvUnit* pUnit = ::getUnit(pUnitNode5->m_data);
			pUnitNode5 = pPlot->nextUnitNode(pUnitNode5);

			if (pUnit && !pUnit->isInvisible(GC.getGameINLINE().getActiveTeam(), false))
			{
				++iNumVisibleUnits;
			}
		}
	}

	if  (!pPlot->isVisibleEnemyUnit(this))
	{
		if (iNumVisibleUnits >= GC.getDefineINT("MAXUPT"))
		{
			return false;
		}
	}
//Vincentz #UPT

CvUnit::verifyStackValid()
PHP:
//Vincentz #UPT
	int iNumVisibleUnits = 0;
	if (plot()->isVisible(GC.getGameINLINE().getActiveTeam(), !GC.getGameINLINE().isDebugMode()))
	{
		CLLNode<IDInfo>* pUnitNode5 = plot()->headUnitNode();
		while(pUnitNode5 != NULL)
		{
			CvUnit* pUnit = ::getUnit(pUnitNode5->m_data);
			pUnitNode5 = plot()->nextUnitNode(pUnitNode5);

			if (pUnit && !pUnit->isInvisible(GC.getGameINLINE().getActiveTeam(), false))
			{
				++iNumVisibleUnits;
			}
		}
	}

	if ((iNumVisibleUnits > GC.getDefineINT("MAXUPT")) && (getDomainType() != DOMAIN_AIR))
	{
		return jumpToNearestValidPlot();
	}
//Vincentz #UPT

CvGameTextMgr::setPlotHelp - pretty far down, before the iDefenseModifier =
PHP:
//Vincentz #UPT		
	int iNumVisibleUnits = 0;
	if (pPlot->isVisible(GC.getGameINLINE().getActiveTeam(), GC.getGameINLINE().isDebugMode()))
	{
		CLLNode<IDInfo>* pUnitNode5 = pPlot->headUnitNode();
		while(pUnitNode5 != NULL)
		{
			CvUnit* pUnit = ::getUnit(pUnitNode5->m_data);
			pUnitNode5 = pPlot->nextUnitNode(pUnitNode5);

			if (pUnit && !pUnit->isInvisible(GC.getGameINLINE().getActiveTeam(), GC.getGameINLINE().isDebugMode()))
			{
				++iNumVisibleUnits;
			}
		}
	}

		szTempBuffer.Format(L"Units (%d / %d) ", (iNumVisibleUnits), (GC.getDefineINT("MAXUPT")));
		szString.append(szTempBuffer);
 
Uploaded 99E
Download here

There is just something about the colossal map size. Im in 1640 AD and have quite a few frigates out there removing fog of war and discovering new civilizations. Yet there is still a huge part of the map still black.
It really makes it feel epic and grand. Looking forward for the globalization era :D

Spoiler :
sECsg3m.jpg

AvPbSmT.jpg
 
Finally, though it took ALOT longer than I'd like to admit....

The Projects that share techs (National Library, Encyclopedia, Com network and internet) are now exactly (well, give and take a bit) how I wanted them to be.

Instead of giving TechA to player when X civ have TechA* it is now a bit more complex
*Internet gave tech if 2 other met civs had it.

Now it depends on
  • Number of civs having the tech (More civ equal more techshare beakers)
  • Number of civs on map (Scale map size depending on max civ)
  • Open Borders with civ
  • Difficulty Level (Settler get 100%, Deity get 20%)
  • Number of turns (Scale gamespeed)
  • Chance of getting Techshare (Quality of Project)
  • Cost of tech (Scale tech beaker cost)
  • Chance and amount of Techshare can be adjusted in GlobalDefinesAlt.xml
So instead of giving full tech, it will give some beakers from techs owned by other civs. The more civs having the tech, the more beakers. The chance of getting beakers to a tech and the amount of beakers is also randomzied.

NRV7nNn.jpg


added updateTechShare to doTurn in CvTeam.cpp and removed it from the other places (except ofcourse updateTechShare()

void CvTeam::updateTechShare(TechTypes eTech) from iHasMet
PHP:
					if (isHasMet((TeamTypes)iI))
					{
						FAssertMsg(iI != getID(), "iI is not expected to be equal with getID()");
						iCount++;
//Vincentz Techshare Start

						if (isOpenBorders((TeamTypes)iI))
						{
							iCount++;
						}
					}
				}
			}
		}
/*		if (iCount >= iBestShare)
		{
			setHasTech(eTech, true, NO_PLAYER, true, true);
		}
*/

		if ((GC.getGameINLINE().getSorenRandNum((10+iBestShare), "Project Tech Sharing")) < (GC.getDefineINT("PROJECT_TECHSHARE_CHANCE")))
		{
			int newProjectResearch = (getResearchCost(eTech) * iCount * GC.getGameINLINE().getSorenRandNum(10, "Project Tech Sharing") * GC.getDefineINT("PROJECT_TECHSHARE_MODIFIER"));
			newProjectResearch /= (MAX_PLAYERS * iBestShare * (GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getResearchPercent()));

			if (isHuman())
			{
				newProjectResearch *= (GC.getHandicapInfo(getHandicapType()).getNoTechTradeModifier());
				newProjectResearch /= 100;
			}

			changeResearchProgress(eTech, (newProjectResearch), NO_PLAYER);

			for (int iI = 0; iI < MAX_PLAYERS; iI++)
			{
				if (GET_PLAYER((PlayerTypes)iI).isAlive())
				{
					if (GET_PLAYER((PlayerTypes)iI).getTeam() == getID())
					{
						CvWString szBuffer = gDLL->getText("TXT_KEY_GOT_RESEARCH_FROM_PROJECT", GC.getTechInfo(eTech).getTextKeyWide(), newProjectResearch);
						gDLL->getInterfaceIFace()->addMessage(((PlayerTypes)iI), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_PROJECT_COMPLETED", MESSAGE_TYPE_INFO, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_HIGHLIGHT_TEXT"));
					}
				}
			}
		}
	}
}
//Vincentz Techshare End
 
You've been a busy Wizard Vinz. All of this latest on your update?
 
You've been a busy Wizard Vinz. All of this latest on your update?

Not all. You need the attached file. Just overwrite.

And yeah, I kinda opened up a few channels in my brain after I started studying computer science. Thinking about going for Data-Technician with programming as a specialty. Though its a 5 year study, and I'm already an old man ;)

But it feels great to be able to go inside the engine of this ol game. And while sometimes I'm pulling my hair out because something wont work, more and more often the added code runs straight through the compiler without any issues, and more importantly, does exactly what I want it to do :D

edit: just a reminder to self.
I want to add a Fusilier around the Musketmen, so the Melee (Heavy sword, Pike and Mace) upgrades to Fusiliers and later to Grenadiers. There is really lacking a unitline instead of everything becomes Musketmen and later Riflemen
 

Attachments

Now active espionage missions (where a spy is doing the espionage) take the points from a total pool of espionage points, whereas before it was civ specific.
It bothered me before when, f.ex. you would have spend 10.000 points on a civ, only to kill that civ and see all the points be lost forever.

Passive missions (see research, city visibility, investigate cities) and the bonus/penalty to active espionage missions are still civ specific, so its not a complete waste to direct the espionage points, though when doing missions the points wont be taken from there but the general pool.

CvPlayer::canDoEspionageMission
PHP:
//Vincentz NewSpy
//		int iEspionagePoints = GET_TEAM(getTeam()).getEspionagePointsAgainstTeam(GET_PLAYER(eTargetPlayer).getTeam());
		int iEspionagePoints = GET_TEAM(getTeam()).getEspionagePointsEver();;
CvPlayer::doEspionageMission
PHP:
// Vincentz NewSpy
//		iHave = GET_TEAM(getTeam()).getEspionagePointsAgainstTeam(eTargetTeam);
		iHave = GET_TEAM(getTeam()).getEspionagePointsEver();
		if (bSomethingHappened)
		{
//			GET_TEAM(getTeam()).changeEspionagePointsAgainstTeam(eTargetTeam, -iMissionCost);
			GET_TEAM(getTeam()).changeEspionagePointsEver(-iMissionCost);
		}

and since the total Espionage points gathered isnt shown anywhere I put an extra line after missions showing how much is left (not ideal, have to add it to UI somewhere) :

PHP:
		gDLL->getInterfaceIFace()->addMessage(getID(), true, GC.getEVENT_MESSAGE_TIME(), gDLL->getText("TXT_KEY_ESPIONAGE_MISSION_PERFORMED"), "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, ARTFILEMGR.getInterfaceArtInfo("ESPIONAGE_BUTTON")->getPath(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), iX, iY, true, true);
//Vincentz NewSpy
		gDLL->getInterfaceIFace()->addMessage(getID(), true, GC.getEVENT_MESSAGE_TIME(), gDLL->getText("TXT_KEY_ESPIONAGE_POINTS_LEFT", GET_TEAM(getTeam()).getEspionagePointsEver()), "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, ARTFILEMGR.getInterfaceArtInfo("ESPIONAGE_BUTTON")->getPath(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), iX, iY, true, true);

CvDLLWidgetData::parseActionHelp
PHP:
				szBuffer.append(NEWLINE);
				szBuffer.append(gDLL->getText("TXT_KEY_ACTION_ESPIONAGE_MISSION"));
//Vincentz NewSpy
				szBuffer.append(NEWLINE);
				szBuffer.append(gDLL->getText("TXT_KEY_ESPIONAGE_POINTS_LEFT", GET_TEAM(pHeadSelectedUnit->getTeam()).getEspionagePointsEver()));
//Vincentz End
It also shows when mouse-over the Espionage button on a spy.

Now since all the code for distributing the espionage points to civ is still there, it can function to lower/raise costs against specific civs (as it have done previously), and therefore still have a function in game, though now EverSpendAgainstAI is basically the same as PresentPointsAgainstAI.

Question is now, should a failed attempt cost espionage points now? since its easier to get points "directed" at an AI now, maybe there should be a penalty or cost for trying even if failing (could be ½ cost?)

9fSuwPT.jpg


dIRysUP.jpg
 
Definitely like the new updates. Just got my a$$ handed to me by Toku, grrr.

Think I'll drop back down a notch to Mon diff and give it another go. Well done Sir :D
 
Im glad to hear the AI grasps the new concepts. It is doing remarkably well in my current game (1700AD'ish) but many of the changes have been done while I was midgame (the pros of dll editing is that it can be modded during a game, unlike xml editing).
Im running Monarch too, and tbh the only reason why Im doing so well is because I had my own two continents to start out on.
I've been trying to capture the Greek capital for ages, but everytime I drop some units off they are bombarded, flanked by cavalry and attacked by grenadiers, so I have to withdraw them to a "healing" island.
Spoiler :
a6Pm6e8.jpg


I'll have a look at further espionage and one of the things I think have bothered most civ4-players over the years: the farm->cottage->town->....hey! lets build a farm here... AI improvement issue.
 
So my guilds are no longer in AND? hehe, then they would have taken the full circle and a bit more ;)
(I originally made them for ROM which later became AND where they were changed a bit, and then apparently removed in AND2)

Yeah, go ahead and take them :D Let me know if you balance them or find any noticeable errors with them. Its been a very long time since I had a good look at them ;)
 
Actually, your Guilds are still in ROM AND 2, and doing quite well. I just finished a game last week with that mod. Had a lot of fun battling England with Grocers Guild.
 
They were good... just not for small icons. He made easily recognizable icons.
Take a look. :)

The page you linked doesnt have any of the guilds icon (?)
But I saw a lot of other stuff I made. You guys even have the Bullseye corp, which I havent even used in my VIP. Though I made the corp like a Mercenary Corporation, and from what I could read its now a shopping mall :lol:

But seriously, feel free to do anything you like with the stuff from VIP or anything else I've made. I'm just happy its in use :D
 
Back
Top Bottom