Mod Backwards Compatibility

From Warzone Wiki
Jump to: navigation, search

As a mod developer, you have to make sure your mod stays backwards compatible with previous versions of itself.

Whenever you click the Reload Code button, Warzone loads the newest version of the code files and throws away the old ones. Because of this, a game may play the first half on one version of your mod, and the second half on a different version. You must take care to ensure your mod doesn't break games in that scenario.

For example, if the first version of your mod has no configuration options (writes nothing to Mod.Settings), but then a later version adds a new setting, called Mod.Settings.Foo, then games created with the first version of your mod will show Mod.Settings.Foo as nil. You must check for this before using the field and take the appropriate action to ensure the game continues working as player's expect.

It doesn't only apply to Mod.Settings: It's also important to think about things you may change in the game. For example, if at the start of the game you create neutral territories of size 100 to mean something specific, but in a later revision of the mod you change that number to 500, some games could exist with neutrals of size 100. If it helps, you can write a version identifier into Mod.Settings in Client_SaveConfigureUI that you can check for later to see what version of the mod each game was created with.

Create a new mod

If it becomes too much work to maintain backwards compatibility (say, for instance, that you add a ton of settings to Mod.Settings and don't want to check for all of them), then you can also elect to simply create a new mod and put your new code in there. Then old games can continue reading from the first mod, and new games can be created with the new one.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox