[PYTHON] Science python rule

Darkator

Warlord
Joined
Sep 18, 2020
Messages
213
Location
Poland,EU
Can you create a python rule that divides your team's research points by the number of allies in your alliance?
 
I can not imagine how that should work in Python. Also it would not be very performant.
All of the Yield generation logic is in DLL (source code) and normally not made accessible to Python.

But in DLL such "Yield calculation rules" are a piece of cake.
(We have lots of such rules in "We the People".)

Summary:
Go for DLL.
 
the problem is that my mod is already based on one dll (32 more civilization)
Is the source code of that DLL not available?
Otherwise I do not really understand the general issue.

Why not simply modify the source code of "32 more civilization" by putting your changes in it and compile it again?
You would still have only one DLL but it will simply be "32 more civilizations + darkator changes".
 
Last edited:
and here's the problem, i can barely know python, let alone dll, and i don't have dll source code.
 
and here's the problem, i can barely know python, let alone dll, and i don't have dll source code.
Well ok, if you do not even have the source code then this option is of course dead.
 
Might be possible to accomplish what you want through the
TECH_COST_EXTRA_TEAM_MEMBER_MODIFIER
value in GlobalDefines.xml. Here's how the DLL uses that value (slightly edited for readability):
Code:
int CvTeam::getResearchCost(TechTypes eTech) const
{
   int iCost = GC.getTechInfo(eTech).getResearchCost();

   // (... apply a bunch of other percent modifiers ...)

   iCost *= std::max(0, 100 +
         GC.getDefineINT("TECH_COST_EXTRA_TEAM_MEMBER_MODIFIER") *
         (getNumMembers() - 1));
   iCost /= 100;
}
On a side note, if your DLL only increases the civ limit, then you could simply use the source code of the original DLL and increase the civ limit there; it's a one-line change in CvDefines.h. However, setting up the environment for recompiling the DLL is a bit laborious, so, hopefully you can get it to work through XML/ Python.
 
Top Bottom