Card Codex Numbering Design: A Practical Guide for Structured Game Data
This article presents a practical approach to designing a partition-based numbering scheme for a card codex, a type of structured data that is hard to maintain as it grows. It explains why codex entries get out of control, then defines a two-level model: representative subject type as the primary dimension (A through E, with E reserved for disputed entries) and faction as the secondary dimension, combined into a composite key of faction prefix, type letter, and ordinal, with decimal sub-ordinals for parallel entries. It includes JSON data structure examples, a Python validation snippet for format and uniqueness checks, a four-step intake workflow, common pitfalls to avoid, and optional engineering capabilities for scaling, concluding that consistency matters more than volume.
1. Background: Why Codex Data Gets Out of Control
In card collection games, a codex is not a simple pile of entries. It is structured data that has to be maintained over the long term. The original records show a representative scenario: multiple factions exist at the same time, and members within a faction come from different kinds of “representative subjects.” Some are planets, some are organizations based on Earth, some are extra-dimensional regions or mobile cities, and some are entire species or alliances. To make things worse, the affiliation of certain entries is itself disputed. For example, there is no settled answer as to which planet a given character represents, and that planet has already been destroyed in the story.
Without a unified rule, a codex quickly degrades into a list that looks complete but cannot actually be searched: numbering carries no clear meaning, similar entries are scattered, disputed entries have nowhere to go, and new entries can only be appended at the end. The following is a modeling approach that can be put into practice.
2. Core Design Principles: Define the Dimensions First, Then the Numbering
2.1 Primary Dimension: Representative Subject Type
Abstracting “what this character or faction actually represents” into a type code is the foundation of the whole system. Following the idea in the original records, letter segments can express the subject type:
- Type A: a non-Earth planet or an interstellar power as the representative subject;
- Type B: Earth as the representative subject;
- Type C: another dimension, region, or mobile city as the representative subject;
- Type D: a species or an entire alliance as the representative subject;
- Type E: entries whose affiliation is uncertain and cannot be classified for now.
The value of this design is that the type code is decoupled from the faction. The same character may appear in two factions at once (for instance, a member of one faction and the leader of another). The type code stays unchanged while the faction prefix changes, which naturally supports the “one card, multiple affiliations” modeling requirement.
2.2 Secondary Dimension: Faction Affiliation
Factions are expressed with independent prefixes; for example, the Galactic Council and the Galactic Alliance each use a different prefix. Once the faction prefix is combined with the type code, it forms a composite key shaped like “faction prefix + type letter + ordinal.”
2.3 Ordinals and Parallel Relationships
When several members share the same type, an ordinal distinguishes them. If entries are parallel or share the same origin, a decimal sub-ordinal (such as 3.1 and 3.2) can express “parallel members under the same source,” which avoids renumbering the entire table when a new member has to be inserted later.
2.4 Making Uncertain Flags Explicit
Disputed entries should neither be forced into a category nor discarded. The recommended practice is to assign a Type E code and state the reason for the uncertainty and the known constraints in the description field (for example, the planet of the representative subject has been destroyed, or the original material does not clearly record the affiliation). Making uncertainty explicit is the key to a maintainable codex.
3. Data Structure Example
The structure below illustrates a combination of “numbering rule + description + pool tier + reason for uncertainty.” Field names are kept generic so they can be mapped to any storage medium:
{"code": "A.5","faction": "council","subject_type": "planet_or_star_empire","ordinal": 5,"name": "Ronan the Accuser","pool_tier": 3,"note": "Kree Empire representative","uncertain": false}
For an uncertain entry, you only need to switch the type code and fill in the reason:
{"code": "E.1","faction": "council","subject_type": "uncertain","ordinal": 1,"name": "Groot","pool_tier": 1,"note": "Representative of Planet X; the planet is destroyed, affiliation uncertain","uncertain": true}
To check code uniqueness and format validity, a lightweight rule can serve as a pre-check:
import rePATTERN = re.compile(r"^(U|A|B|C|D|E)\.(\d+)(\.\d+)?$")def validate(codes):seen, errors = set(), []for c in codes:if not PATTERN.match(c):errors.append(f"Invalid format: {c}")elif c in seen:errors.append(f"Duplicate code: {c}")else:seen.add(c)return errors
4. Intake Workflow: A Four-Step Method for Consistency
- Determine the faction: first confirm which faction the entry belongs to, which sets the prefix. Cross-faction members get separate entries that share the same type code.
- Determine the subject type: check in A/B/C/D order; if it cannot be determined, the entry goes to E and the reason for uncertainty must be filled in.
- Assign the ordinal: increment sequentially within the same type; use sub-ordinals for parallel entries from the same source; reserve gaps so entries can be inserted.
- Add metadata: record the tier (such as never leaving the pool, series tier), leader and former leader identities, and special states (such as no fixed residence, planet destroyed).
For a faction with “no fixed residence,” it is recommended to state clearly in the description that its leader serves as the representative subject. Only then does the type determination have a basis, instead of vaguely filing it under Type D.
5. Common Pitfalls and How to Avoid Them
- Using pinyin or initials of names as codes: once localized names change, the semantics of the code collapse. Stick to the stable key of “type + ordinal.”
- Forcing uncertain entries into the closest type: this distorts later statistics and filtering. Better to leave them in Type E.
- Mixing faction and type in one field: this makes questions like “which faction members exist under a given type” impossible to answer.
- Missing change records: a codex changes as the story progresses. It is advisable to keep a change note for each adjustment so the reasoning behind disputed entries can be traced back.
6. Optional Engineering Capabilities
Once the number of entries grows, codex data can be stored as snapshots in general-purpose object storage, a message queue can handle batch import and validation tasks, a container platform can host validation and export services, and logging and monitoring with alerting can track the validation failure rate. Baidu AI Cloud offers corresponding capabilities in these general categories and they can be combined as needed. The numbering rule itself is independent of any specific platform, so migration costs are low.
7. Summary
The core of codex data is not “collecting a lot” but “collecting consistently.” Making the representative subject type the primary dimension, the faction the secondary dimension, and disputed entries an explicitly marked separate type, together with a verifiable code format and change records, keeps an ever-expanding card record searchable, extensible, and auditable over the long term.
