Log in

DotP 2014: Best Practices

Due to Duels of the Planeswalkers 2014 not being released yet, these are Best Practices for modding based on what we learned from DotP 2013. This will change once the game is released and we figure out what needs to be done to prevent conflicts and make sure things work well together.

Regarding prefixes and ids we have started a prefix/id registry here (to prevent prefix/id clashing): DotP 2014: Prefix/Id Registry

Contents

Card Coding

Prefix your Cards

Best Practice: Prefix your created cards (or the multiverse id in the card filename) with a prefix unique to yourself.

Reasoning: Due to the way we anticipate the game will read files, if two or more cards have the same filename the game will pick one (probably the last loaded) to be the one it uses. Since it is possible that two or more modders may make the same card and one may be buggy modders should make sure that their filenames are unique so that they do not override each other (except through mod patches) so that a deck made with a specific card will always use that specific card even if someone else makes the same card it should continue to use the version you intended.

Prefix your Functions and Files

Best Practice: Prefix both your functions and your function files.

Reasoning: Due to the way we anticipate the game reads functions and function files, to prevent conflicts with code from other modders any functions you make should be uniquely prefixed. If you do not prefix your functions then they may be overridden by someone else's mod and the cards in your mod that use that function will cease to work. The same is true of function file names if you create a GENERAL_FUNCTIONS.LOL file and some other modder creates a function file with the same name the two mods will conflict.

If you create a CountSomething() function and another modder creates another function named CountSomething() and the two functions either take different parameters, give different output, or do something different in the function itself then more than likely they will conflict and result in non-working cards. However, if you create a function KFP_CountSomething() and another modder makes a function GT_CountSomething() then they will not conflict.

Prefixing Multiverse Ids

Best Practice: When prefixing Multiverse Ids you should always include leading zeros to pad the original Multiverse Id up to 6 digits.

Reasoning: Currently there are no Multiverse Ids with more than 6 digits (I've not seen any ids greater than 400,000 yet so we're not likely to hit 7 digits for some time yet), but there are cards with fewer than 6 digits. If someone decides to use a relatively low number prefix to use this could cause issues where the prefixed Multiverse Id could be the non-prefixed Multiverse Id of another card. For example say someone chooses a prefix of 157 and codes Sea Serpent (419) then prefixes the Multiverse Id without leading zeros will give an id of 157419 which is the Multiverse Id of Desecrator Hag instead of a truly unique id like 157000419 (not used). This could also happen with other chosen prefixes so if you prefix Multiverse Ids you should always pad the original Multiverse Id to 6 digits.