This guide is meant to give light to issues that arise when trying to make your Civ4 mods Multiplayer compatible. It explains the ideas of how the Civ4 multiplayer system works, including some of the differences between Hotseat, PBEM, Internet, and Simultaneous games. It will also discuss various ways to avoid and debug OOS (Out of Sync) errors that can so easily plague LAN and Internet-based mods. What I've collected are ideas that through experimentation or through other people on the board I have gathered that Civ4 should work. There is still the possibility for mistakes, so don't take most of it as absolute, but the majority of it I've been able to use as my guiding principles and have been able to successfully work with creating Civcraft as a solid multiplayer experience. It's pretty long, but it's intended for people who want to be super serial about their mod's working with multiplayer. First and foremost, I would like to introduce this idea: As far as I’ve seen, XML files, so long as they remain equivalent on each machine that plays the mod, can NOT cause OOS errors. If your files differ from one machine to the next, you’re going to have problems, but in many cases these discrepancies will be caught in the game lobby. As for graphics and sound files, those too will not cause OOS problems. If your game is experiencing OOS problems, the problem is most likely in the python or c++ code. So, unless you’re REALLY interested, XMLers and graphics/sound guys can skip this one. I wrote this guide because I felt that it was a field that I was particulary strong in where others may not be, and I know how thankful I am for those who write guides and tutorials about topics that I am not so strong in. I want to thank all those people who take the time out of creating their own mods and projects to make tutorials, be they graphical, coding or simply theory. And I encourage those who find that they have a particular strength, especially if that doesn’t particularly seem to be well-known or well-understood so far in the modding community, to come out and share it to help better the entire community. Ok, enough banter. Most of this guide assumes that you have knowledge in python, and have had some experience using it to mod Civ4, since many examples are from the CvEventManager.py file Although there might be some c++ samples, they will probably not be very complicated, and understanding the individual lines of code won’t be as important as understand what it’s doing, which I will hope to explain. ----------------------------------- Table of Contents: Section 1: Introduction to Multiplayer Games This section will concentrate on the ideas of multiplayer gaming on a general scale. It talks briefly about how multiplayer games communicate, how some data needs to be sent to other computers while some can be calculated locally, how random numbers can be generated on many different computers to all have the same number generated, and what exactly is meant by game-state, checksum, and OOS error. It is meant to give you a general overview that is not game-specific, but uses Civ4 for all it’s examples. This is meant to be a quick introduction for those who have never dealt with these concepts. Some people might be able to skip this section, although I highly recommend a quick read through for anyone who isn’t too sure. I promise to try to keep it short. Section 2: Civilization 4 Multiplayer Concepts: This section gives a summary of the various multiplayer game styles (Hotseat, PBEM, Simultaneous, etc.) and each they work. It explains how the onBeginGameTurn, onBeginPlayerTurn, onEndGameTurn, and onEndPlayerTurn functions work for each one, and how order is determined. In most styles of gameplay, they work the same, but some, especially Simultaneous, have some peculiarities. Section 3: Introduction to OOS errors: Global vs. Local Context This section will use two phrases I have completely made up for Civ4 modding: “Global Context” and “Local Context.” The idea it to define a terminology for dealing with how code is written so that one can be confident that what they’re writing code-wise won’t cause OOS problems by knowing what context you’re writing your code in. Section 4: The concept of “Active Player” and the getActivePlayer functions. This section explains what the concept of being the “Active Player” of a game means. Most OOS problems will result from improper use of the active player functions, so it’s important to understand what the results are actually telling you, as well as how to use the results properly. Section 5: Debugging OOS Errors No matter how hard you try, eventually, if you make a big-enough mod, you’ll probably end up with OOS problems. This section gives tips on how to go through debug such errors, as well as provides a script that will probably be useful in this task. Note: My ability for formatting is pretty crappy, you might want to try the word version: Second Note: I've made changes over the mon...erm, years, nothing large, just fixing stuff to hopefully make it easier to read. However, the word document has not been updated, so you're better off sticking with the crappy forum post.