• We created a new subforum for the Civ7 reviews, please check them here!

Guide: How to add a Civilization to DoC

If you are fluent in regexes, yes. I usually end up wasting more time looking up the correct syntax and/or cleaning up all the errors I made with sloppy regexes.
 
How to add a Civilization to DoC.... as modules?

Something so I can put in all the player's created Civ like that Sweden or Aussie and also determine their chance of spawning in a similar fashion where you can set the chance of Tibet or Kongo to appear as 0%
 
How to add a Civilization to DoC.... as modules?
Not sure what you mean ... is the following an explanation or expansion of what you're trying to do?

Something so I can put in all the player's created Civ like that Sweden or Aussie and also determine their chance of spawning in a similar fashion where you can set the chance of Tibet or Kongo to appear as 0%
That's very easy actually.

1. Add an entry in GlobalDefinesAlt.xml for them (I suggest following the convention of namking the tag PLAYER_OCCURENCE_[CIV])
2. Add the civilization to the lSecondaryCivs array in Consts.py
3. Include the civilization in the determineEnabledPlayers() method in RiseAndFall.py, you can basically copy what is already there for any other civ
 
Yeah. I don't know the term haha..I thought whatever optional is called modules but looks like not :p
 
Step 24): DynamicCivs.py

In the beginning, you should make a copy of the constant from Consts.py and get the PyPlayer and PyTeam objects for your player. (same as step 19)

Add the new civ in self.defaultNames and self.peopleNames.


If you don't do this, you will get some python errors when launching a game. (Which happened to me) Adding the default name and people name will resolve them. The other dynamic names can be added later on.
 
Yeah. I don't know the term haha..I thought whatever optional is called modules but looks like not :p
A module in my opinion is more something that can either be installed separately or not and the game will work in any case. Which is basically impossible for civilizations.
 
What is the context of this question? Which coordinates?
 
Coordinates on the map, for plotting cities.

Also, the Python seems a little abstract to me. If I add a constant for a unit like IMan, what is guaranteeing that the Python will know I'm referring to UNIT_MAN on the XML?

And how can I place units outside of its starting location, like on a specific plot?
 
Coordinates on the map, for plotting cities.
Do you just want to know which coordinates belong to which tile? Simply hold Ctrl while hovering over it and the tooltip will display its coordinates.

Also, the Python seems a little abstract to me. If I add a constant for a unit like IMan, what is guaranteeing that the Python will know I'm referring to UNIT_MAN on the XML?
The constants you define have to be in the same order as the units in the XML file. This is also why you have to define a constant for a unit even if you don't intend to use it.

The magic happens in the "range(iNumUnits)" part which creates a tuple of incremental values (0, 1, 2, 3, ..., iNumUnits-1) which is then assigned to the constant list you have created. So you only need to make sure they're in the right order and the ID will match.

And how can I place units outside of its starting location, like on a specific plot?
utils.createUnit() can take arbitrary coordinates as a parameter. In createStartingUnits() it uses the capital location in some form (I suppose tCapitals[iCiv]), but that's just a tuple of coordinates (x, y).
 
When you say, "Compile your code", what does that mean (In terms of DLL changes)?

I have finished everything the guide asked me to do (With the exception of adding a unique power, because I could not see clearly where to add it), the mod was able to open. However, when I went on scenario 3000 BC and played as the Egyptians as a test run, it told me that I have been defeated without the turn even beginning. What could have caused this?

Sorry for all these questions. I have virtually zero experience in coding.
 
Most of my programming knowledge comes from editing XML files from the game Age of Empires III, so I am very knowledgeable about XML files.

I have never done .DLL or Python files before.
 
When you say, "Compile your code", what does that mean (In terms of DLL changes)?
There are compiled and interpreted programming languages.

Python is an interpreted language, which means that the processor can read your code as it is while it's running. You can change a line in Python even while the game is running and the changes will immediately be in effect.

C++ is a compiled language. That means the code you write as a programmer (the .cpp and .h files) cannot be read by the processor and has to be converted to a format that is readable first (called machine code). This is called compiling. The DLL is the product of your compilation process. To do that, you need a compiler program. There are plenty of guides out there in the tutorial section on how to set up a compiler for the DLL.

I have finished everything the guide asked me to do (With the exception of adding a unique power, because I could not see clearly where to add it), the mod was able to open. However, when I went on scenario 3000 BC and played as the Egyptians as a test run, it told me that I have been defeated without the turn even beginning. What could have caused this?
"You have been defeated" is always a dead ringer for a Python exception (the underlying problem might still be somewhere else, but it's always good to read the exception).
 
So to make things clear, I can't just enter .cpp and .h files and change the text. Using an XML program. I need to compile them.

Do you think the Python exception is likely to do with the auto play? I managed to load the mod and it did not tell me of any python exception. Neither did I receive any message when I tried to load the 3000 bc scenario.
 
So to make things clear, I can't just enter .cpp and .h files and change the text. Using an XML program. I need to compile them.
Yes.

Do you think the Python exception is likely to do with the auto play? I managed to load the mod and it did not tell me of any python exception. Neither did I receive any message when I tried to load the 3000 bc scenario.
Have you enabled Pyhton exceptions in the first place?
 
See the first post of the main mod thread.
 
Top Bottom