Skip to content

Deckbuilding Environment

gwent.rl.pettingzoo_deckbuilding exposes an opt-in meta environment that lets each agent decide whether to play a baseline deck or draft a deck before the match starts.

from gwent.rl.pettingzoo_deckbuilding import env, raw_env

The meta environment is still a two-agent AEC environment with player_0 and player_1.

Constructor

raw_env(
    *,
    baseline_decks=None,
    seed=0,
    first_player=0,
    strict_effects=True,
    catalog_version=STANDALONE_VERSION,
    render_mode=None,
)

baseline_decks is the meta-environment equivalent of the match wrapper's decks argument. reset(options=...) can override baseline_decks, first_player, and strict_effects.

Stages

Each builder moves through these stages:

Stage Meaning
choice Choose baseline deck or start building.
leader Pick a leader card.
stratagem Pick a stratagem.
cards Add deck cards or finish when the draft validates.
done This builder has selected a valid deck.
match Both decks are ready and the inner match environment is active.

player_0 builds or chooses first, then player_1. After both decks are selected, the wrapper starts an inner GwentPettingZooEnv with those decks.

Spaces

The meta action space is padded to cover both deckbuilding actions and match actions. During the match phase, ids 0..348 retain their match meanings and all deckbuilding-only action ids are masked off.

Generated references:

Diagnostics

The raw environment exposes trainer and test diagnostics:

  • deckbuilding_action_space_size: full padded action-space size.
  • selected_decks: the selected or built decks, or None before selection.
  • drafts: the current DeckDraft objects.
  • action_metadata(): static metadata for trainer-side action embeddings.
  • core_state: the inner match core state once the match has started.

Rewards

Deckbuilding steps have zero rewards. Once the match starts, rewards and terminations are copied from the inner match environment.