Deck Codec
Programming Libraries
Heroicc's open source deck codec was created for sharing Digimon Card Game (2020) decks within the community and encouraging portability with an expansive feature set not present in other community formats.
While implementations of the codec exist in numerous languages, the Clojure library is the reference implementation and the most frequently updated.
The deck codec encodes the following attributes:
§ name
A deck name is a string composed of a maximum of 63 bytes.
In cases where an emoji or other non-Latin character is used this can take more than a single byte per character. e.g. Agumon is 6 characters and 6 bytes, but アグモン is 4 characters and 12 bytes.
§ language
Supported languages in the codec match supported languages in officially printed cards;
- Japanese
ja - English
en - Chinese (Simplified)
zh-Hans - Korean
ko
It is not legal to mix cards of various languages into a deck so all cards within a deck belong to the same specified language.
If this attribute is not provided, English is encoded as default.
§ icon
The deck icon is an optional attribute used as a way of specifying a card number to be used as a representative card image for the entire deck. This is a convention used on both the official Bandai TCG+ as well as a variety of other deck viewers in the community.
While the deck codec does not enforce the icon attribute to be a card number that belongs to the deck, specfying anything other than a card number present in the cards within the deck is undefined behaviour.
§ digi-eggs
An optional array of card objects for the digi-egg deck. There is no guarantee by the encoder for these objects to be a Digi-Egg. This is the responsibility of the application doing the encoding to enforce.
Each card object has a required number and count attribute with an optional parallel-id. Refer to the API documentation for further information.
The encoder supports a maximum of 7 card objects in this attribute. This limitation is fine for legal decks that only support a maximum of 5 cards.
§ deck
An array of card objects for the main deck. There is no guarantee by the encoder for these objects to be exclusively Digimon, Tamer, and Option. This is the responsibility of the application doing the encoding to enforce.
Each card object has a required number and count attribute with an optional parallel-id. Refer to the API documentation for further information.
The encoder has no limits on how many card objects can be encoded in this attribute.
§ sideboard
An array of card objects for a sideboard allowed in some formats. This is an optional attribute.
The encoder supports a maximum of 127 card objects in this attribute.
Putting it all together, you might have a decoded deck that looks like this:
Which encodes to:
DCGUbtlgJydAUEDAZydAU8DAgMBAwEDAQMBAQEDAQMBAQEBAQMBAwEDAQEBAQFTVDEtMTEgIFN0YXJ0ZXIgRGVjaywgR2FpYSBSZWQgW1NULTFd