XMage Documentation

repository·master·Indexed 22 days ago

https://github.com/magefree/mage

XMage is a multiplatform Magic: The Gathering game engine supporting Windows, Linux, and MacOS. It features full rules enforcement for tens of thousands of cards and supports formats like Commander and Standard. The documentation covers installation, server configuration via Java system properties, performance optimization using Java flags, and technical guides for developers on implementing card abilities, custom SVG icons, and server extensions.

Tokens
8.3K
Snippets
4
Records
52
Agent score
80%

What's inside XMage

  1. Requirements for creating custom card icons

    master

    When contributing or creating new icons for XMage, ensure they meet the following technical specifications to ensure compatibility with the in-game stroke effects and rendering engine:

    • License: Must use a free open-source license (e.g., Creative Commons).
    • Format: Must be in SVG format.
    • Proportions: Must be square-proportional, including 1-2 pixels of free space on the border.
    • View Box: Use a small view box (e.g., 16 x 16 px). Using large image scales will prevent the in-game stroke effect from being visible.
    • Styling: Icons must use a glyph/solid style and follow this color mapping:
      • White: Retained as white.
      • Black: Replaced by the current theme color.
      • Non-color/None: Rendered as transparent.
    • Strokes: Do not include strokes in the SVG; XMage applies its own strokes automatically.
  2. Use Perl scripts to generate card classes

    master

    XMage provides several Perl scripts to automate the generation of Java classes for Magic: The Gathering cards. These scripts allow you to generate classes for single cards, entire sets, or sets with existing implementations.

    Available Scripts

    • gen-card.pl: Generates Java classes for a specific card. You will be prompted to enter the card name.
    • gen-existing-cards-by-set.pl: Generates Java classes for cards within a specific set that already have an implementation.
    • gen-simple-cards-by-set.pl: Generates Java classes for cards within a specific set that can be completely generated (simple cards).
    • update-list-implemented-cards.pl: Compares current implementations against a previous state to generate:
      • oldList.txt: List of cards implemented at the time the script was last run.
      • newList.txt: List of cards implemented since the last run.
    • gen-list-cards-for-set.pl: Generates a file listing cards for a specific set.
    • gen-list-unimplemented-cards-for-set.pl: Generates a file listing unimplemented cards for a specific set.
  3. Improve performance with Java flags

    master

    If you have a dedicated GPU, you can significantly increase performance by passing extra Java flags to the client.

    To enable these flags:

    1. Launch the XMage launcher.
    2. Click on Settings in the menu bar.
    3. Navigate to the Java tab.
    4. Enter your desired flags in the Client java options text field.
  4. Optimize XMage for Linux

    master

    Linux users can apply specific tweaks via the Client java options in the launcher settings to improve rendering or memory usage:

    Enable OpenGL

    Use this flag to enable OpenGL rendering: -Dsun.java2d.opengl=true Note: There is a known bug with the file chooser when OpenGL is enabled. If using the i3 window manager, you can work around this by toggling the window's "floating" capability to force a re-render.

    Enable XRender

    Use this flag to enable XRender: -Dsun.java2d.xrender=true

    Increase Memory Usage

    You can increase the maximum heap size if you have sufficient RAM. For example, to set it to 2GB: -Xmx2G

    -Dsun.java2d.opengl=true
    -Dsun.java2d.xrender=true
    -Xmx2G
  5. Install and run XMage

    master

    To use XMage, follow these steps:

    1. Download the latest XMage launcher and app files from xmage.today.
    2. Unpack the files into your desired directory (e.g., D:\games\xmage).
    3. Ensure you have Java version 8 or later installed on your system to run the launcher.

    XMage is multiplatform and supports Windows, Linux, and MacOS.

    N/A
  6. What is Test Mode in MAGE?

    master

    Test mode is a specialized configuration designed for developers and testing. When testMode is enabled, the server provides several quality-of-life features and bypasses certain restrictions:

    • Fast Game Buttons: Accelerated game interaction.
    • Cheat Commands: Access to administrative/cheat commands.
    • No Deck Validation: Bypasses checks on deck legality.
    • No Draft Clicks Protection: Removes timeout protections during drafting.
    • No Connection Validation: Disables ping-based disconnects (useful when using IDE debuggers).
    • Sideboarding: Allows loading any deck during the sideboarding phase.
    • Simplified Auth: Simplified registration and login (no password checks).
    • Debug Main Menu: Enables debug menus for GUI and rendering testing (requires -debug flag on the client app).
  7. Undercity Dungeon Room Map and Effects

    master

    The UndercityDungeon is a structured sequence of DungeonRoom objects. Each room provides a specific effect and leads to one or more subsequent rooms. Below is the functional map of the Undercity dungeon:

    RoomEffectLeads To
    Secret EntranceSearch library for a basic land, reveal it, put it into hand, then shuffle.Forge, Lost Well
    ForgePut two +1/+1 counters on target creature.Trap!, Arena
    Lost WellScry 2.Arena, Stash
    Trap!Target player loses 5 life.Archives
    ArenaGoad target creature.Archives, Catacombs
    StashCreate a Treasure token.Catacombs
    ArchivesDraw a card.Throne of the Dead Three
    CatacombsCreate a 4/1 black Skeleton creature token with menace.Throne of the Dead Three
    Throne of the Dead ThreeReveal top ten cards of library. Put a creature card from among them onto the battlefield with three +1/+1 counters on it. It gains hexproof until your next turn. Then shuffle.(End of Dungeon)
  8. Use the Astral Arena plane

    master

    The AstralArenaPlane is a specific game plane in XMage that imposes combat restrictions and provides a special ability triggered by rolling the planar die.

    Combat Restrictions

    While this plane is active, the following restrictions apply:

    • Attack Restriction: No more than one creature can attack each combat.
    • Block Restriction: No more than one creature can block each combat.

    Planar Die Ability

    • Trigger: Whenever any player rolls {CHAOS} on the planar die.
    • Effect: This plane deals 2 damage to each creature.
    • Activation: The ability can be activated by any player (via TargetController.ANY) when the main phase stack is empty, using a RollPlanarDieEffect.
  9. Definition of Edge of Malacol Plane

    master

    The EdgeOfMalacolPlane is a specific plane type in XMage with the following mechanics:

    1. Static Ability: If a creature you control would untap during your untap step, put two +1/+1 counters on it instead.
    2. Active Ability: The active player can roll the planar die. Whenever you roll {CHAOS}, untap each creature you control. This ability can be activated when the main phase stack is empty and has a mana cost of 0.
  10. Rules for Feeding Grounds Plane

    master

    The FeedingGroundsPlane is a specific plane type in XMage with the following mechanics:

    1. Cost Reduction: Red spells cost {1} less to cast. Green spells cost {1} less to cast.
    2. Chaos Effect: Whenever a player rolls {CHAOS} on the planar die, the active player can target a red or green creature to put X +1/+1 counters on it, where X is that creature's mana value.