CAR Mod: Civ AcceleratoR

I'm not certain where else to share this, so I'd thought I'd post it here.

I found some more interesting speed improvements for my mod by turning python calls in the SDK into python callbacks, so I could turn them off and save the game engine time. I did this 13 times, and got about a 10-15% speed improvement. In a nutshell, whenever I saw something like this in the SDK:
Code:
void CvCity::doGrowth()
{
	int iDiff;

[COLOR="Red"]		CyCity* pyCity = new CyCity(this);
		CyArgsList argsList;
		argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity));	// pass in city class
		long lResult=0;
		gDLL->getPythonIFace()->callFunction(PYGameModule, "doGrowth", argsList.makeFunctionArgs(), &lResult);
		delete pyCity;	// python fxn must not hold on to this pointer 
		if (lResult == 1)
		{
			return;
		}[/COLOR]


	iDiff = foodDifference();

	changeFood(iDiff);

without an encapsulating callback check, I added one. I added a total of 13 new python callbacks, which were fairly easy to do, and added the corresponding code in CvGlobals, and then added 13 python callbacks in the XML file, and turned them all off.
If you are more interested in this, and want specifics, PM me...
 
I'm not certain where else to share this, so I'd thought I'd post it here.

I found some more interesting speed improvements for my mod by turning python calls in the SDK into python callbacks, so I could turn them off and save the game engine time. I did this 13 times, and got about a 10-15% speed improvement.

Interesting, maybe you should post that in the RevDCM forum too, certainly cannot hurt to add it in that SDK as well :)
 
Interesting, maybe you should post that in the RevDCM forum too, certainly cannot hurt to add it in that SDK as well :)

There is the RevolutionDCM specific code proposals thread specifically for this type of thing. Would be really nice if you could merge this code with the current RevDCM SVN source and upload it, also this will make it easier on you for future update to your mod, as you'll have less conflicts and merging issues to worry about, since your code will already be in RevDCM :deal:
 
Back
Top Bottom