SDK and how it handles team techs

GEFORCED

Chieftain
Joined
Mar 1, 2007
Messages
17
Can someone please help me figure this out.

I've followed the tutorials for the SDK, adding a new option etc, the attempts at editing the code so players in the team do not share research or technologies are resulting in no changes :(

Anyone familiar with the SDK know how civ4 handles teams and teching?

Thanks
Gef
 
Are you sure that you're successfully compiling the DLL, i.e. does any change that you make to the DLL code have any effect?

Crucially, you'd have to move m_pabHasTech, m_paiTechCount and m_paiResearchProgress from CvTeam to CvPlayer. However, tech affects a lot of cached effects, so you'd actually have to move about half of the CvTeam data members. (I wouldn't move them directly to CvPlayer, which is already an enormous catch-all class, but to a component class, say "TechState".) I'd say all the ones I've commented out in this list need to move:
Spoiler CvTeam.h :
Code:
int m_iNumMembers;
int m_iAliveCount;
int m_iEverAliveCount;
int m_iNumCities;
int m_iTotalPopulation;
int m_iTotalLand;
int m_iNukeInterception;
//   int m_iExtraWaterSeeFromCount;
//   int m_iMapTradingCount;
//   int m_iTechTradingCount;
//   int m_iGoldTradingCount;
//   int m_iOpenBordersTradingCount;
//   int m_iDefensivePactTradingCount;
//   int m_iPermanentAllianceTradingCount;
//   int m_iVassalTradingCount;
//   int m_iBridgeBuildingCount;
//   int m_iIrrigationCount;
//   int m_iIgnoreIrrigationCount;
//   int m_iWaterWorkCount;
int m_iVassalPower;
int m_iMasterPower;
int m_iEnemyWarWearinessModifier;
//   int m_iRiverTradeCount;
int m_iEspionagePointsEver;

//   bool m_bMapCentering;
bool m_bCapitulated;

TeamTypes m_eID;

int* m_aiStolenVisibilityTimer;
int* m_aiWarWeariness;
//   int* m_aiTechShareCount;
//   int* m_aiCommerceFlexibleCount;
//   int* m_aiExtraMoves;
int* m_aiForceTeamVoteEligibilityCount;

bool* m_abAtWar;
bool* m_abHasMet;
bool* m_abPermanentWarPeace;
bool* m_abOpenBorders;
bool* m_abDefensivePact;
bool* m_abForcePeace;
bool* m_abVassal;
bool* m_abCanLaunch;

//   int* m_paiRouteChange;
int* m_paiProjectCount;
int* m_paiProjectDefaultArtTypes;
std::vector<int> *m_pavProjectArtTypes;
int* m_paiProjectMaking;
int* m_paiUnitClassCount;
int* m_paiBuildingClassCount;
//   int* m_paiObsoleteBuildingCount;
//   int* m_paiResearchProgress;
//   int* m_paiTechCount;
//   int* m_paiTerrainTradeCount;
int* m_aiVictoryCountdown;

int* m_aiEspionagePointsAgainstTeam;
int* m_aiCounterespionageTurnsLeftAgainstTeam;
int* m_aiCounterespionageModAgainstTeam;

//   bool* m_pabHasTech;
//   bool* m_pabNoTradeTech;

//   int** m_ppaaiImprovementYieldChange;

//   std::vector<BonusTypes> m_aeRevealedBonuses;
And an even larger number of member functions (some exposed to and called from Python) operating on that data would have to move as well. A major effort, and one would need to understand roughly what all those variables do to get it right. Solid knowledge of C++ would really also seem necessary. Generally, team rules cut across the game logic, and changing them requires changes in numerous places.

I've implemented a research penalty when members of the same team are researching the same tech. Of course that falls far short of what you're trying to accomplish, but it's also vastly easier to implement, requiring changes only in CvPlayer::calculateResearchModifier and CvPlayerAI::AI_chooseResearch. (Research costs are already implemented at the level of players.)
 
Hey, thanks for the detailed reply, I'll give it a shot although it my be too advanced for my C# knowledge.
 
Back
Top Bottom