Norseman2 said:
What can I mod using python? I notice the SDK is in C++, there's a fair amount of xml, which appears to govern all or most of the in-game numbers, and of course the art and sounds have nothing to do with python. What does learning python let me do in civ 4?
Basically, XML controls all the data you can use. The SDK controls the rules of the game. Python controls the interface (the different screens, etc.). However, there are many times where the SDK allows python to do some of the decision making for it. For example, the CvGameUtils.py file contains many functions allowing you to change some things like if a unit can do a certain action. Also, there are plenty of ways to have events scripted because of the multiple events that have python callbacks (a function where you can put your code to have it run whenever an event occurs, such as "onCityBuilt" or "onUnitKilled"). To get an idea of what you can change rule-wise, check out CvGameUtils.py and CvEventManager.py. Even if you don't know python, you can take a look at all the different functions (functions are the lines of code that have "def someName" at the top of them, which describes when that function will "run"). So, you might see:
Code:
def [b]onBeginGameTurn[/b](self, argsList):
'Called at the beginning of the end of each turn'
iGameTurn = argsList[0]
CvTopCivs.CvTopCivs().turnChecker(iGameTurn)
def [b]onEndGameTurn[/b](self, argsList):
'Called at the end of the end of each turn'
iGameTurn = argsList[0]
def[B] onBeginPlayerTurn[/B](self, argsList):
'Called at the beginning of a players turn'
iGameTurn, iPlayer = argsList
Seeing there, you see that you can call any python code within those functions to do what you want. So, what can the python code do? Almost anything. Each unit, city, plot, etc. can be changed using python code. For a complete list of all the different things, check out this
API.. So, python can make many changes to in-game things at specified times. The event system will probably be the basis of a mod doing game-rule changing things, so it's probably good to take a look at that and see what's available to you. So, if you wanted, by adding to the "onBeginPlayerTurn" function, you could affect most anything in the game whenever a player's turn starts, from killing any one of your units at random, to making an event where every 30 turns the person who abandoned the most units during the last 30 turns gets free gold (that one would take a pretty good understanding of the python code).
Also, python is the basis for map scripting, which is the way that random maps are generated.
Hope that gives you a good idea.