The RoM Slowdown Culprit

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
I think I identified the largest slowdown in Rise of Mankind. I did some profiling with the game engine, which lets me see how much time the game spends computing each function, in ms. When I first ran it, I found some functions were taking 13000+ ms. I looked at them, and found they all had python callbacks in them, which turned out to be the real culprit behind the slowdowns. I removed the python callback in that particular function, to see the computational time drop from 13700 ms to 1334 ms, on that particular function.

I think if we can identify and remove every python callback, AND replace their old functionality with something in the SDK, we could speed up RoM a great deal.

Now, I looked at all the python callbacks enabled in RoM, and I have a few suggestions for each on how we can replace them:

USE_CANNOT_DO_CIVIC_CALLBACK: Used for Modular Civic Buildings, Slave Market, Military Buildings... etc...

I am already 95% done with a new SDK based XML tags for PrereqOrCivics and PrereqAndCivics. It works, and shows up fine, I just need to get the Obsolencance to work, and I can replace everything with those XML tags and get rid of this callback.

USE_CANNOT_CONSTRUCT_CALLBACK: I believe this is used for Zappara's upgrade paths for buildings. Correct me if I am wrong.

Dom Pedro has a XML tag called 'Replace Buildings" which removes specified buildings from a city when a building is completed. I believe this could be used to replace this feature.

USE_GET_UNIT_COST_MOD_CALLBACK: A wonder? I don't know where this is used. Can someone figure it out?

USE_GET_BUILDING_COST_MOD_CALLBACK: Same as above...


USE_CANNOT_TRAIN_CALLBACK
: Inquisitors.

Phungus came up with a way to do this without callbacks. I already have his SDK changes merged, I just need to add the new XML.

USE_CAN_TRAIN_CALLBACK: Inquisitors again?


Any other comments, suggestions?
 
How is storm feature coded? Or is it purely graphic thing that slowed the game down?
 
How is storm feature coded? Or is it purely graphic thing that slowed the game down?

No, that slowed down the game too. Fixing these in conjunction with No Storms should drastically improve performance.
 
Will you be bringing this out as a HotFix or Patch?

Soon I hope. :D

Good catch! :thumbsup:

JosEPh :)
 
I think this find makes it so your Dll should be included in Rom and not as a modmod.:D
 
Will you be bringing this out as a HotFix or Patch?

Soon I hope. :D

Good catch! :thumbsup:

JosEPh :)

Some kind of modmod. Hotfix inplies savegame compatibility, which this will undoubtedly break, and patch means that there was a bug.

This is AWESOME -- nice job :goodjob:

I haven't done anything yet. I don't even know what two of those do. Don't congratulate me yet...


I think this find makes it so your Dll should be included in Rom and not as a modmod.:D

That's up to Zap, not me.
 
Hotfix or patch, I don't care. If it fixes the slowdowns I have no issues starting new games. Keep up the great work Afforess :goodjob:. I like this ROM so much that I even got my bf hooked on it. I want to help, but I need a guide on the python, xml, and any other language used in the game. Its been quite some time since I've used C++ and any other programming language that I need a quick refresher course. I'd love to be of use since I love ROM.

To be honest, I went to see if there were any other mods I could use and I started to cry when I saw the others. I'll take slower turn times with ROM than any other mod on CFC.
 
Hotfix or patch, I don't care. If it fixes the slowdowns I have no issues starting new games. Keep up the great work Afforess :goodjob:. I like this ROM so much that I even got my bf hooked on it. I want to help, but I need a guide on the python, xml, and any other language used in the game. Its been quite some time since I've used C++ and any other programming language that I need a quick refresher course. I'd love to be of use since I love ROM.

Thanks. XML is very simple. Just open up a file and look. The modiki pretty much can hand-hold you through it.

Eh, Python, I just know enough of it to get by, I rarely use it.

If you really wanted to mod or modmod something I would start with XML, you can do a lot with the XML.

To be honest, I went to see if there were any other mods I could use and I started to cry when I saw the others. I'll take slower turn times with ROM than any other mod on CFC.

I know, other mods pale in comparison with RoM. I'll never play a different mod.
 
I know, other mods pale in comparison with RoM. I'll never play a different mod.
Except when you are looking for stuff to plunder:rolleyes:

Zappara already did some stuff with Python Callbacks as they are a known slow point. I think he turned off those he was not using. The WarriorsOfGod I am converting and testing uses the Can/Cannot train call back so if you are replacing it I will need to know what I use in its place.
 
So....
You major players in the RoM modmod industry have increased your fanbase to include me and pretty much my entire platoon. We go on patrol, we come back, we play RoM. I saw several other threads that caught my attention, and we would love to help but we don't have any skill at modding. Some of us HAVE begun to look at XML files. We're all active military and we're all huge military history buffs, so if you require any help in that area, lol... that's about the extent. I just wanted to let you know that we really appreciate the effort you guys are putting into this mod, and we want you to keep up the good work. Oh... and yeah, speeding it up would be pretty helpful, since we all play on laptops and only get about ten turns at a time in before we're called away.

I'm a medic so I think my first mod is going to focus around the medic promotions and other combat med related game improvements... ideas are welcome. Thanks for reading.

DocBuck
 
Except when you are looking for stuff to plunder:rolleyes:

Zappara already did some stuff with Python Callbacks as they are a known slow point. I think he turned off those he was not using. The WarriorsOfGod I am converting and testing uses the Can/Cannot train call back so if you are replacing it I will need to know what I use in its place.

You'll need to tell me how they are used before I can make an adequate replacement.
 
I've got the Civic Prereqs for buildings all done, so that's one callback eliminated.

I'm working on the building upgrade paths.
 
In the WarriorsOfGod mod it only uses the USE_CANNOT_TRAIN_CALLBACK callback. I am assuming this it the one because there is a python function called cannotTrain which is not called by anything python but has specific code for this mod in it.

The code itself just checks to see if the state religion is in the city. You cannot build the monk or fanatic if the state religion is not present or if there is no state religion.
 
In the WarriorsOfGod mod it only uses the USE_CANNOT_TRAIN_CALLBACK callback. I am assuming this it the one because there is a python function called cannotTrain which is not called by anything python but has specific code for this mod in it.

The code itself just checks to see if the state religion is in the city. You cannot build the monk or fanatic if the state religion is not present or if there is no state religion.

I can add an XML field for units like "bRequiresStateReligionInCity" or something like that. Would that work?
 
Oh, it will work. I'll make it work. :mischief:

I'm looking at some of the wonders Zappara added, and figuring out how to softcode everything.

Which wonders are you talking about? Just curious? I think I have a better, or at least slightly more efficient, bit of code for generating crusader and other like units.

I can add an XML field for units like "bRequiresStateReligionInCity" or something like that. Would that work?
An excellent solution.
 
Which wonders are you talking about? Just curious? I think I have a better, or at least slightly more efficient, bit of code for generating crusader and other like units.

The Great Mosque of Djenne is one, the Himeji Samurai Castle is another.

I also need to softcode the civic changes too.

Here's the list of new XML fields I have ATM: (There will be more)
CvBuildingInfos:
bRequiresHillsOrPeaksInVicinity
bFamous
bNotFamousCity
bRequiresDesert
iPillageGoldModifier
bNoEnemyPillagingIncome
BuildingProductionModifier

CvUnitInfos:
CivicProductionModifier
bRequiresStateReligionInCity

CvCivicInfos:
BuildingProductionModifier

CvTechInfo:
iUpgradeCostModifier

Edit: I went through all of RoM's python, and I think this is what I'm going to need to add.
 
Back
Top Bottom