Firaxis has gone through extremely lengths to give the game unprecedented modding power: all in-game data is stored in XML -- almost nothing is hardcoded -- a scripting language is included and even an SDK with some of the game's source code has been released. Modding in Civilization IV is tiered, there are four different levels on which the game can be changed:
- World Builder: This is the map editor, similar to what is availabe in pretty much all Civ-like games: you can create custom maps with preplaced cities, units, buildings, etc. Anyone can do this, it's as simple as point-and-click. The World Builder stores the maps created with it in a text-based format that can be opened in any text-editor. This makes it easy to edit such files even without starting up the game, but the two biggest advantages of this are: (1) it's easy to develop external tools that read in Civ4 maps and somehow manipulate these (e.g. convert them to other game formats, auto-generate Python code based on it); (2) it's easy to develop tools that generate Civ4 map files themselves, without having to use the World Builder (e.g. user-made map editors or conversion utilities such as BMP-to-Civ4, Civ3-to-Civ4, CtP2-to-Civ4, etc). Firaxis expects that the World Builder will be used extensively because it's so simple to use and open to anyone who wants to have a go.
- XML Files: All in-game data is stored in XML files: things like Unit, Building, Civic, Civ, Terrain and Resource stats, difficulty levels, paths to the graphics files, map properties, text info, etc, but also camera controls, the scales of graphics objects (so you can resize things), keyboard and mouse mappings, hooks to Python, audio script parameters, etc. Even the layout of cities in the game is stored in XML (though it has hooks to Python as well), using a so-called L-System (Lindenmayer systems), which is typically used for simulating plants and trees. This makes cities look natural(ly random) while allowing all important buildings to be easy to see.
Note that XML is not a programming language as some people seem to think, but rather an (eXtensible) Markup Language, which means that it's just a convenient format to store and order information, much like an Excel spreadsheet (but simpler), or a phonebook (but slightly more complex). In many ways it's similar to rules.txt from Civilization 2 (only presumably much, much more powerful), or the txt files from the Call to Power games. Sure, it might look slightly intimidating the first time you see it, but once you dive in and learn to understand how to read it, changing things is no more complicated than filling in a form (and if you live in a country as bureaucratic as mine, you've got plenty of experience in doing that ). The only skill required for modding XML is the ability to read and write. So that means that unless someone is reading this to you, you're already half-way there XML files can be read and changed by any text editor (such as Notepad), though there are many freeware, shareware and commerical XML editors available that offer specific XML tools for making the job easier.
- Python: Python has been added to the game as a scripting language (and a powerful one at that), which allows modders to add events to the game, change game rules, change the User Interface, modify the map generation algorithm, etc. To an extent you can even overrride AI behaviour with it. The team at Firaxis themselves made extensive use of Python during the development of Civilization IV, it proved so useful they ended up using it for much more than what they had originally planned. Originally they only wanted to use it in map generation and for scripting events, but they also ended up using it to for the User Interface, AI overrides, the L-System city graphics, coloured map overlays and development tools such as the World Builder, a formation editor and various debug tools. The tutorial that the game comes with has also been coded in Python, as is the Civilopedia. To help with the development of both the Python tools and other parts of the game, they added a Python interpreter to the game, which can be opened in-game to check the state of certain variables or to generate some code 'on-the-fly'. This will be extremely helpful to modmakers as well.
Unfortunately coding Python is not trivial. It's not like XML where you only need to be able to read and write to be able to modify it. To modify Python, you actually need to know a thing or two about programming. Not everyone can do this. Or rather, not everyone will be willing to invest the time to learn, as basic things like displaying a message at a given turn or creating a unit when a city is conquered or simple things like that aren't really all that hard, but the do take time to learn. Anyone who is willing to invest a little time should be able to accomplish at least simple things fairly easily, and more complicated ones given enough time. Prior programming experience is a premium but not a must when it comes to working with Python. If you want to learn Python, this (particularly chapters 1-10 and appendix A) would be an excellent place to start if you have little or no programming experience. If you do have a fair amount of programming experience, the documentation on the Python website will suit your needs. You can find a whole bunch of tutorials and guides for Python on all kinds of levels (from total newbies to l33t h4x0rs to professional ITers) here.
- Game/AI SDK: Finally and most spectacularly, Firaxis has released a good portion of the game's source code as part of the game/AI SDK -- this is not very uncommon for some other types of games such as FPS games, but is almost unprecedented for strategy games. This SDK contains all the source code related to the rules of the game and all the AI code (but not other things like network code or the graphics engine). Using this package, modders will be able to do everything from writing their own game types to pretty much building their own game loosely based on Civilization; they can change literally anything they want. This is not for the faint-of-heart though, one will have to be a capable programmer to do really meaningful things with the SDK. Prior programming experience is pretty much a necessity.
These are the basic levels of modding that are available to mod and scenariomakers, but of course there are also other areas of modding that are not covered here, such as modding the graphics or sound, which are not explained here. See the Creation forum for more info on all things modding.
All of the tools described here are used in day-to-day development of the game, so they are all very robust. All tools will also be hot-swappable, which will greatly simplify the task of making changes to them, as you can immidiately load your changes into a running game and test to see if they work as expected. If not, fix the problems you found, reload the resources and test again. This saves a great amount of development time, time which users can spend on actually making new products, rather than troubleshoooting them. It also has the added advantage that a lot of the time regular players should be able to switch mod mid-game if they want, no need to finish all their old games before migrating to a new version. (Of course, this is all theory, in reality your mileage may vary.)
MPers and tournament players need not have fear: the game will ship with protected copies of all the original files, which guarantees that eveyrone in an MP game or tournament is playing with the same ruleset. Even for (both fan-made or official) mods and scenarios some security mechanisms have been built in.