Discussion in 'Civ4 - Modpacks' started by Sephi, Sep 23, 2010.
LOL. No - because anyone who likes Civ4 unmodded has long moved on.
PBEM, pitboss players are no one? By far most of them play the vanilla (but patched) game.
Also, a large number of people in S&T still play unmodded. Even TMIT does IIRC.. something about mods slowing down the game. And a lot of those players prefer to be playing the same game as each other. Some of them would play HOF mod (lol, wait it's called BUFFY ) but is that what you meant?
Anyway, I suppose you just meant 'practically' nobody.
The same happened to me and from another thread on BUFFY http://forums.civfanatics.com/showthread.php?p=9798217#post9798217
it happened also to somebody else.
I was playing BtS 3.19 with no other mod running except my small one which never did that.
Thank you for any feedback or improvement!
This is a second-hand bug report, so take it with a grain of salt. Two people have reported that while using this mod with BUFFY, they sometimes are able to infinitely upgrade every unit right out of the gate.
I assume you're caching the XP needed for the next level to avoid calling out to Python as much as possible. Perhaps there's a bug in here? I have not looked at the source, but if you post that section of code here I'd be happy to take a peek if you cannot find the problem or don't want to spend any time on it until you verify the problem.
Not sure if this is related, but the "endless promotions" bug is somehow related to crashing/not correctly working python due to missing registry informations /not being able to access the registry because of the UAC, IIRC.
One of the modcomps i used in the beginning in my mod did not work well together with that and lead to the same problem (from here on).
I had the unlimited promotions problem when I upgraded Dune Wars recently. In that case, it turned out to be a problem with upgrade from a pretty old version (1.6.5) to a new version (1.9 beta 2)which left some Python files from the old version around that interfered with the newer version (causing issues with BUG in the new version, actually). The main problem was that the old version had a CvGameUtils.py file but the new one wasn't supposed to (and didn't remove it even though the installer said it was uninstalling the old version) - in regular BtS the getExperienceNeeded function in that file is where the XP cost to get promoted is calculated. The various load failures (which cause everything in the affected files to not be loaded) due to having a mismatched set of Python files resulted in that function (and a lot of others) not being defined anywhere thus resulting in no XP needed to get a promotion - if the DLL can't call the Python fucntion it is evidently left with a 0 from the initialization of the variable it uses. The solution in that case was to completely remove the mod's folder and install from scratch instead of upgrading over the top of an old installation.
I'd expect the problem to be something similar. There is almost certainly a problem that is causing at least one Python file, including the one where the getExperienceNeeded function is defined, to not load.
thanks for bug reporting. was a simple issue with a python callback blocked that was actually used by BTS.
I have uploaded version 2.0 which should be the final version. By Default mod is installed into a seperate folder. You can still copy the Cvgamecore.dll into the BTS folder if you want to.
Sources are in a subfolder. I have only included files that have changes.
You find all changes if you search for "Sephi"
You find all changes related to CAR mod if you search for "CAR MOD" (so if you have already CAR mod or BTS Better AI you shouldn't need this)
You find all changes that block python callbacks if you search for "Block Python"
You can allow modmodders to reenable python callbacks you block. see comment in CvCity::canCreate for details.
Make sure if you block a python callback that your mod isn't actually using it. This can be a bit tricky if you have a lot of mods merged into your mod that have a lot of python code (like BUG for example).
thank you so much for the effort!
Finished merging, if I got it right the new things would be:
- a few more Python callbacks
- bit of promotion code moved to DLL
- more efficient pathing in CvUnitAI
- CvCity::doCulture disabled for Barbs (does it really have no effect?)
It's kind of difficult to measure speed in RFC but the code looks good. Also, you are missing some speed tweaks from Lead From Behind/BBAI. Adding them would be another significant boost (getAnyDanger vs. getDanger change, caching of selection group states, declared globals for frequently used XML defines, and other minor tweaks). Unless it's meant to be merged with it!
calculation of trade routes is also much faster (and probably causes most of the speed increase).
if CvCity::doCulture has an effect or not depends on your mod.
I really doubt that creating globals for XML defines speeds up the game in any significant, it just makes it more difficult to merge. Of course you can just do it but I wanted to keep this mod very easy to merge.
Thanks for the source! But...
What code is responsible for this? The files you provided only include the changes mentioned by embryodead.
Edit: Never mind. Found it in CvCityAI.cpp.
Edit2: Actually I don't see how that function is used for trade route calculation. I've only been able to spot it's used to calculate the best path to build a road between cities.
yes exactly. I just saw route in that function and thought it has something to do with traderoutes but it seems that function caches some value for the automated Worker AI. Makes it even more weird why this function sometimes takes up so much time.
Finding the best route between two cities for purposes of building a road requires extensive pathfinding. Sometimes you need to go around foreign territory and bodies of water, and this needs to be updated whenever cultural borders change I would guess.
It is updated once per turn in a subfunction of CvCity::doTurn, it's not related to culture border changes. I don't even know if it checks for things like culture etc. It's just a bunch of generic generatePath() calls. But sometimes they take even 300ms. The time for pathfinding should increase with the pathlength l, probably by the factor l^2. Either the factor is much higher or the pathfinding code has some bugs/performance issues.
IIRC that code is used for all AI workers, not just automated human workers. Aren't you handicapping the AI roadbuilding with your change, causing them to move in random directions and change their mind on what is the best route each turn?
yes AI workers and automated workers use the exact same functions. They shouldn't change their target every turn as their destination plot is saved in Missionplot. While they target a random city they probably will always end up using a pretty good path to the existing trade network.
well if you have BUG installed, the UI is gone... so it is a bit unfortunate that this does not work together, as it would be good to try the speed up out.
in the past BUG had no custom DLL. Maybe you installed BULL as well? either that or the BUG mod includes a modified DLL nowadays.
Nope, BUG doesn't have a DLL. It's possible you installed BULL or maybe this mod has some custom Python that is required?
hmmm... not sure what is causing this, but with BUG 4.4, this speed mod has no UI, while with BUG uninstalled, it is fine...
while it would be nice to have a speed boost, I have in principle given up playing the vanilla game without mods, so this is not that important for me, still - to report what I found out while trying it.
Separate names with a comma.