smeagolheart
Monarch
I attempted to get this integrated in my mod but failed after a couple of compiles of the SDK, I couldn't cleanly get the code out of the revolutions SDK posted. Shame that it isn't updated.
What compile error did you get?I attempted to get this integrated in my mod but failed after a couple of compiles of the SDK, I couldn't cleanly get the code out of the revolutions SDK posted. Shame that it isn't updated.
I meant to re-release this as a standalone mod for 3.19 but haven't had the time ...
DynamicCivNames.DynamicCivNames(customEM, config)
The latest version of this is in RevolutionDCM, you can try pulling it out as follows:
1) XML
Copy over the DynamicCivNames text file. Then, you'll need to copy over some of the new civics tags added in Revolution (isCommunism, canDoElections, isFreeSpeech, democracyLevel, laborFreedom, religiousFreedom, more?).
2) Python
This is where all the renaming happens. You'll need DynamicCivNames.py, plus you'll need to have DynamicCivNames register its Python event handlers with your CustomEventManager. It's set up to be pretty easy, you'd want something like:
Code:DynamicCivNames.DynamicCivNames(customEM, config)
Then, you'll also want several functions from RevCivicsUtils.py. In DynamicCivNames.py, search for "RevUtils." (without the Civics ...), then find those functions in RevCivicsUtils.py and copy them over. I think you can just paste them before the class definition in DynamicCivNames. You then of course want to remove the "RevUtils." from each function call.
There's another detail to deal with, where right now the mod stores a list of each player's civics from the previous turn ... you'll need to decide how to handle that. I think you can actually just call the renaming logic every turn instead of waiting for civics changes. Anyway, wherever there's a reference to "SDTK" in DynamicCivNames.py you'll need to do something.
Some of DynamicCivNames is setup to work with rebel civs in Revolution or for ex-barbarians in BarbarianCiv ... this probably doesn't apply to you, so you should remove these parts (they should be easy to spot).
3) Config file
There's not much in Revolution.ini devoted to DynamicCivNames, you could decide to just set defaults in Python.
4) SDK
This is the trickier part. Basically, the changes in the SDK are just to support renaming in Python. You'll certainly need the changes marked DynamicCivNames which effect which name is returned for things like getCivilizationDescription. Then, you'll also need the CvInfos changes to handle the new XML civics tags. What beyond those you'll need I'm not exactly sure ... it may require an iterative process where you build a DLL, automate for a while and see if Python barfs some errors asking where some function is, adding that function/exposing it to Python in the SDK, rebuilding the DLL, repeat.
I can of course answer some questions if you get stuck, but if you're willing to poke around and figure out how different Python/SDK mod pieces work I'm certain you'll succeed.
Depends on which version you have ... originally it was all Python, in the current RevDCM version Python still controls the naming but draws names from a DynamicCivNames text XML file.
To do what you describe, you'd need to change Python to make it dependent on religion.
Sorry, the all python comment was about how the names were determined. Determining names is now a mixture of XML definitions and python.
To have names change in game you have to have some SDK changes, there's no ability to change player names from python in plain BTS.
The main difficulty is getting the necessary programs set up to compile your own DLL and then learning how to do the merge the first time. The up front time depends on whether you've ever taken a C++ or similar programming class, but you could expect it to take 10-15 hours to get setup but it could of course take longer if something goes wrong or the mods modify the same functions.
There are several threads around for getting started with the SDK, I'd recommend going the MS Visual Studio Express route over Codeblocks as you can do debugging in the future and the tools are better ...
Here are the steps:
1. Install a C++ compiler with the necessary extras for Civ, per one of the tutorial threads. (3 - 10hrs)
2. Run a test compilation of an existing mod. (1 hr)
3. Merge sourcecode into a new SDK mod, using Winmerge or some other merging software. (1 - 4hrs)
4. Try compiling your new mod, work through whatever errors arise. (1 - 5hrs)
5. Test your newly compiled DLL in game to make sure it doesn't crash. (1 hr)
Do you mind if I PMed you/bothered you for advice while I'm trying to figure this stuff out?