Civilization IV/Python Tutorial

Python can be used to achieve a surprising amount of things in Civ 4, but only if you know how. Now, while I'm probably not the best person to be writing this tutorial, I feel I am quite familiar with the sort of things you can do to the game with it. Please feel free to edit anything I've got here, as the tutorial is far from complete. The tutorial is also on CFC | here. Any updates on the wiki I will attempt to update there, though obviously the format is a bit stricter there.

If you want to know a little bit about python, I'd check out | the wikipedia entry and | the python website

Just a brief rundown on what python is capable of in Civ 4 terms:

Python can:
 * be used to make complex scripts causing events to happen on a trigger. For example, you can make it so that if you take the holy city of a religion, all Civs following that religion will declare war on you.
 * be used to edit the interface. Pretty much all of the game interface is generated dynamically by python, and can be edited in python. You can make new buttons, alter the layout of the Civelopedia, change the way the tech tree is generated... and even, if you so desire make a small dancing pig in the corner of your screen - with music (though I don't believe anybody has tried this, I'm pretty sure it's doable). There are limitation to this - mouseover texts, for example, are far better suited to the SDK.
 * be used to generate new map types. I haven't tried this myself, so it might not be covered too well in this tutorial.
 * be used to edit the AI... I'd do it with the SDK though, as it'll probably save alot of time!

Python can't:
 * be used exactly how you might want to use it. While the amount of things you can do in it is really quite large, there are several things you just can't do. This is really quite annoying, but it's something you've got to learn to live with. The amount of things you can do is staggering, so don't complain. Hopefully with the release of the SDK more experienced coders will enhance the ability of python to change the way the game works.

Still reading? Good!

Now my suggestion for first steps would be to browse through GBM's python tutorial, which gives a brief outline of how to program in python. Also, if you have not done so, check out the python website which has lots of information about python (unsurprisingly). Finally, I'd check out this python tutorial by Jon (Trip) Shafer, Firaxis, who's tutorial you may find better than mine, after all, he is the guy who coded alot of it in the first place.