Match’n Gacha Admin Guide ๐Ÿ”งโš™๏ธ

“With great power comes great responsibility… to make cool themes” - Admin Spider-Man, probably

Welcome to the admin side of Match’n Gacha! This guide covers everything you need to know about managing themes, collectible assets, and system configuration. Perfect for when you want to add that kawaii cat theme or introduce limited-edition collectibles.

๐ŸŽจ Theme Management System

Theme File Structure

Themes are stored as JSON manifests in /public/data/themes/. Each theme defines colors, visual styles, and asset mappings.

/public/data/themes/
โ”œโ”€โ”€ default.json          # Base theme (always required)
โ”œโ”€โ”€ neon.json             # Optional: Cyberpunk theme  
โ”œโ”€โ”€ kawaii.json           # Optional: Cute anime theme
โ””โ”€โ”€ seasonal/             # Optional: Event themes
    โ”œโ”€โ”€ halloween.json
    โ”œโ”€โ”€ christmas.json
    โ””โ”€โ”€ summer.json

Theme JSON Structure

{
    "name": "Theme Display Name",
    "version": "1.0.0",
    "description": "Brief theme description",
    "colors": {
        "primary": "#4a148c",
        "secondary": "#7b1fa2", 
        "accent": "#ffc107",
        "background": "#1a0033",
        "surface": "rgba(255, 255, 255, 0.1)",
        "text": "#ffffff",
        "textSecondary": "rgba(255, 255, 255, 0.7)"
    },
    "blocks": {
        "red": { "color": "#e53935", "glow": "#ff5722" },
        "blue": { "color": "#1e88e5", "glow": "#2196f3" },
        "green": { "color": "#43a047", "glow": "#4caf50" },
        "yellow": { "color": "#fdd835", "glow": "#ffeb3b" },
        "purple": { "color": "#8e24aa", "glow": "#9c27b0" },
        "orange": { "color": "#fb8c00", "glow": "#ff9800" }
    },
    "collectibles": {
        "common": { "color": "#9e9e9e", "border": "#757575" },
        "uncommon": { "color": "#4caf50", "border": "#388e3c" },
        "rare": { "color": "#2196f3", "border": "#1976d2" },
        "epic": { "color": "#9c27b0", "border": "#7b1fa2" },
        "legendary": { "color": "#ffc107", "border": "#f57f17" },
        "mythic": { "color": "#e91e63", "border": "#c2185b" }
    },
    "effects": {
        "particles": {
            "match": "#ffffff",
            "combo": "#ffc107",
            "powerup": "#e91e63"
        },
        "animations": {
            "speed": 1.0,
            "easing": "Back.easeOut"
        }
    },
    "audio": {
        "volume": 0.7,
        "variants": ["default", "8bit", "orchestral"]
    }
}

Adding New Themes

  1. Create Theme File: Add new JSON file in /public/data/themes/
  2. Follow Naming Convention: Use kebab-case (e.g., cyberpunk-neon.json)
  3. Test Colors: Ensure sufficient contrast for accessibility
  4. Update Theme Manager: No code changes needed - themes auto-load!

Theme Hot-Swapping

The ThemeManager system supports real-time theme switching:

// Load theme programmatically
await window.themeManager.loadTheme('neon');

// Get available themes
const themes = await window.themeManager.getAvailableThemes();

// Apply theme to running game
window.themeManager.applyTheme(gameScene);

๐Ÿ–ผ๏ธ Asset Management System

Asset Directory Structure

/public/assets/
โ”œโ”€โ”€ sprites/
โ”‚   โ”œโ”€โ”€ blocks/           # Block graphics
โ”‚   โ”‚   โ”œโ”€โ”€ red.png
โ”‚   โ”‚   โ”œโ”€โ”€ blue.png
โ”‚   โ”‚   โ””โ”€โ”€ [color].png
โ”‚   โ”œโ”€โ”€ collectibles/     # Collectible card art
โ”‚   โ”‚   โ”œโ”€โ”€ common/
โ”‚   โ”‚   โ”œโ”€โ”€ rare/
โ”‚   โ”‚   โ””โ”€โ”€ mythic/
โ”‚   โ”œโ”€โ”€ ui/              # Interface elements
โ”‚   โ”‚   โ”œโ”€โ”€ buttons/
โ”‚   โ”‚   โ”œโ”€โ”€ icons/
โ”‚   โ”‚   โ””โ”€โ”€ backgrounds/
โ”‚   โ””โ”€โ”€ effects/         # Particle and effect sprites
โ”‚       โ”œโ”€โ”€ sparkles/
โ”‚       โ””โ”€โ”€ explosions/
โ”œโ”€โ”€ audio/
โ”‚   โ”œโ”€โ”€ sfx/             # Sound effects
โ”‚   โ”‚   โ”œโ”€โ”€ match.ogg
โ”‚   โ”‚   โ”œโ”€โ”€ combo.ogg
โ”‚   โ”‚   โ””โ”€โ”€ powerup.ogg
โ”‚   โ”œโ”€โ”€ music/           # Background music
โ”‚   โ”‚   โ”œโ”€โ”€ menu.ogg
โ”‚   โ”‚   โ””โ”€โ”€ gameplay.ogg
โ”‚   โ””โ”€โ”€ voice/           # Character voices (optional)
โ””โ”€โ”€ themes/              # Theme-specific assets
    โ”œโ”€โ”€ default/
    โ”œโ”€โ”€ neon/
    โ””โ”€โ”€ kawaii/

Asset Loading with Fallbacks

The AssetManager automatically handles missing assets:

  1. Try theme-specific asset (/assets/themes/neon/blocks/red.png)
  2. Fall back to default (/assets/sprites/blocks/red.png)
  3. Generate placeholder (procedural graphics if nothing found)

Adding New Assets

For Block Graphics:

# Add to default set
/public/assets/sprites/blocks/[color].png     # 64x64 px, PNG format

# Add theme variant
/public/assets/themes/[theme]/blocks/[color].png

For Collectibles:

# Rarity-based organization
/public/assets/sprites/collectibles/[rarity]/[name].png   # 100x140 px

# Examples:
/public/assets/sprites/collectibles/mythic/dragon-card.png
/public/assets/sprites/collectibles/legendary/phoenix-gem.png

For UI Elements:

/public/assets/sprites/ui/buttons/[name].png              # Variable size
/public/assets/sprites/ui/icons/[name].png                # 32x32 px

Audio Asset Guidelines

๐Ÿ’Ž Collectibles System

Collectible Data Structure

Collectibles are defined in /public/data/collectibles/ with JSON manifests:

{
    "id": "dragon_card_001",
    "name": "Ancient Dragon Card",
    "type": "card",
    "rarity": "mythic", 
    "description": "A legendary card depicting the first dragon",
    "value": 10000,
    "tradeable": true,
    "category": "fantasy",
    "series": "ancient_legends",
    "attributes": {
        "power": 95,
        "luck": 85,
        "special": "combo_bonus"
    },
    "drop_conditions": {
        "min_level": 10,
        "combo_threshold": 5,
        "chance": 0.001
    },
    "visual": {
        "sprite": "dragon_card_001.png",
        "animation": "mythic_glow",
        "particles": true
    }
}

Rarity Distribution System

Default drop rates (configurable in CollectibleSystem.js):

const rarityWeights = {
    common: 60,      // 60% drop rate
    uncommon: 25,    // 25% drop rate  
    rare: 10,        // 10% drop rate
    epic: 3,         // 3% drop rate
    legendary: 1.5,  // 1.5% drop rate
    mythic: 0.5      // 0.5% drop rate (ultra rare!)
};

Adding New Collectibles

  1. Create Asset: Add sprite to /public/assets/sprites/collectibles/[rarity]/
  2. Define Metadata: Create JSON file in /public/data/collectibles/
  3. Configure Drops: Set conditions and rarity in the JSON
  4. Test Generation: Use browser console to test drops

Limited Edition Events

For special events (holidays, anniversaries):

{
    "event": "halloween_2025",
    "duration": {
        "start": "2025-10-01T00:00:00Z",
        "end": "2025-11-01T00:00:00Z"
    },
    "collectibles": [
        "pumpkin_king_card",
        "ghost_gem", 
        "witch_artifact"
    ],
    "bonus_rates": {
        "legendary": 2.0,  // 2x legendary drop rate
        "mythic": 1.5      // 1.5x mythic drop rate
    }
}

๐Ÿ› ๏ธ Development Workflow

Local Testing

# Navigate to project directory
cd /home/thrax/unified-services/match-n-gacha

# Edit theme files
vim public/data/themes/your-theme.json

# Test theme loading in browser console
window.themeManager.loadTheme('your-theme')

# Rebuild and deploy
docker compose build match-n-gacha && docker compose up -d match-n-gacha

Asset Optimization

Images:

# Optimize PNG files
optipng -o7 public/assets/sprites/**/*.png

# Convert to WebP for better compression
cwebp -q 80 input.png -o output.webp

Audio:

# Convert to OGG
ffmpeg -i input.wav -c:a libvorbis -q:a 4 output.ogg

# Normalize audio levels
ffmpeg -i input.ogg -filter:a "dynaudnorm" output_normalized.ogg

Version Control

Theme and asset files should be versioned:

{
    "name": "Neon Theme",
    "version": "1.2.0",
    "changelog": [
        "1.2.0: Added Halloween collectibles",
        "1.1.0: Improved block animations", 
        "1.0.0: Initial release"
    ]
}

๐Ÿ”ง Configuration Files

Game Constants (/public/js/config/constants.js)

const GAME_CONFIG = {
    GRID_SIZE: { cols: 8, rows: 10 },
    BLOCK_SIZE: 60,
    BLOCK_TYPES: ['red', 'blue', 'green', 'yellow', 'purple', 'orange'],
    MATCH_THRESHOLD: 3,
    MAX_THEMES: 10,
    COLLECTIBLE_DROP_BASE_CHANCE: 0.1
};

Feature Flags (/public/js/config/features.js)

const FEATURES = {
    MARKETPLACE_ENABLED: true,
    DAILY_CHALLENGES: true,
    SOCIAL_FEATURES: false,
    BETA_THEMES: false,
    DEBUG_MODE: false
};

๐Ÿ“Š Analytics & Monitoring

Theme Usage Tracking

// Track theme switches
window.themeManager.on('themeChanged', (oldTheme, newTheme) => {
    analytics.track('theme_changed', {
        from: oldTheme,
        to: newTheme,
        timestamp: Date.now()
    });
});

Asset Loading Performance

// Monitor asset load times
window.assetManager.on('assetLoaded', (asset, loadTime) => {
    console.log(`${asset.name} loaded in ${loadTime}ms`);
});

๐Ÿšจ Troubleshooting

Common Issues

Theme Not Loading:

Assets Missing:

Performance Issues:

Debug Commands

Browser console commands for testing:

// Reload all themes
await window.themeManager.reloadThemes();

// Force collectible drop
window.collectibleSystem.awardCollectible('mythic');

// Clear all cached assets
window.assetManager.clearCache();

// Show performance stats
window.game.debug.showStats = true;

๐Ÿ“ Best Practices

Theme Design

Asset Management

Testing Protocol


๐ŸŽฎ Quick Reference

File Paths

Key Classes

Useful Commands

# Rebuild game
docker compose build match-n-gacha && docker compose up -d match-n-gacha

# View logs  
docker logs match-n-gacha

# Access container
docker exec -it match-n-gacha sh

๐Ÿ”ง Admin powers activated! Remember: with great theme comes great responsibility to make it look awesome.

๐Ÿ“… Last updated: August 2025 | For Match’n Gacha v1.0.0