Dynamic Civ Names

Hmm, that is a shame. This isn't necessarily an important modcomp, but its a really nice touch. I guess I'll have to either wait and see if anyone figures it out, or try on my own. Although I'm a graphics guy, not really a coder.
 
I tried extracting from RevDCM. Got a complile error for a segment of code that was labelled Dynamic Civ Names but it didnt really have anything to do with it. So i deleted it lol. Then it compilled and im getting Crashes to desktop as the game loads. It gets passed all the XML and Python loads but im not sure whats tripping it up.

Does anyone know if there is any way to find logs of what problem is occuring?

I got these source files containing the Dynamic Civ name code (Some notes of mine too):
CvDllwidgetData.cpp
Cvplayer.cpp NB. Line 3595 Piece of code suspect to dynamic Civ names but not labelled Dynamic Civ name, its only labeled Rev Mod.
CyEnumsInterface.cpp
CyPlayer.cpp "SetFoundedFirstCity...Blah" - Removed it because of compile error.
CyPlayerInterface.cpp
CvDefinesModtools.h Non-existent in standard BTS source files.
CvEnums.h .
CvPlayer.h
CyPlayer.h

Anyone know if im missing some files?

CvEnums.h and CyEnumsInterface.cpp contain the code to allow the options for RevDCM parts on Custom Game screen. Im not sure if i should remove these :/

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?
 
How difficult would this be to alter to 3.19 or at least add it to a mod?

If you know what files need to be edited and where/how I can do it, or if it is at least relatively easy to do I can do it even if it is tedious. I really like this modcomp and my mod is for 3.19.
 
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.
 
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.

Damn, that's a lot of work for a graphics modder like me. But when I get to that point in the mod I'll try it out. I'll post back here and let you guys know how I did. Thanks.
 
Did you have a list of which names are linked to which civics or tags? How easy is it to mod in additional names or take a few out?

I noted on the previous page that a theocracy adds the descriptor "Holy" to the beginning of the country's name. Would I just have to update Python if I wanted it to take the religious descriptor (like if the state religion is Christianity and I picked Theocracy, it would say Christian Republic or Christian Kingdom of Spain, or something like that)?
 
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.

You say that it was originally all python, does this mean I can get this effect without an SDK or do I still need an SDK?
 
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.

Excuse me if this is a stupid question, but I'm making a mod and there are a few components I wanted to merge into it, but some of them have a custom SDK. How difficult would it be to merge them together and how would I go about doing this?
 
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)
 
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)

Wow, scary. I'll try to learn it. And I didn't take anything remotely close to C++ (I was a Political Science major) so this seems a bit daunting, but I am sure it isn't as bad as it sounds. I'm currently working on some leaderheads for my mod, and this type of thing sounds like I should ONLY work on this while I'm doing it. So when I finish up these LHs I'll take this up. Do you mind if I PMed you/bothered you for advice while I'm trying to figure this stuff out?
 
Top Bottom