Skip to content

Game Flow

Game Modes

SpriteBox supports multiple game modes, each with its own phase flow:

ModeDescriptionPlayer Count
pixel-battleClassic mode: draw prompts, vote on artwork5-100
copy-catMemory mode: recreate a reference image2 (1v1)
copy-cat-soloSolo memory practice: recreate images alone1 (solo)
pixel-guesserPictionary mode: one draws, others guess2-20
pixel-survivorRoguelike survival: draw to survive 30 days1 (solo)
zombie-pixelInfection game: zombies chase survivors1-100 (bots fill)
copycat-royaleBattle royale elimination: recreate images, lowest accuracy eliminated3-100

Game Phases (Pixel Battle)

The classic Pixel Battle mode uses a state machine with 6 phases:

type GamePhase = 'lobby' | 'countdown' | 'drawing' | 'voting' | 'finale' | 'results';

Phase Flow Diagram

LOBBY (0-30s) COUNTDOWN (5s) DRAWING (30s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Players │ Auto or │ Prompt │ │ Draw on │
│ Join Room │ ──────────► │ Revealed │ ──────────► │ 8×8 Grid │
│ (5-100) │ Manual │ │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
┌────────────────────────────────────────────────────────┘
VOTING (2-7 rounds) FINALE (15s) RESULTS (15s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Pick A or │ After │ Top 10% │ Final │ Podium + │
│ B (5s/rd) │ ──────────► │ Compete │ ──────────► │ Gallery │
│ Elo-based │ all rds │ │ ranking │ │
└─────────────┘ └─────────────┘ └─────────────┘
│ │
│ │
└────────────────────── Back to LOBBY ◄──────────────────┘

Phase Timings

PhaseDurationNotes
LobbyUntil readyMin 5 players, auto-start after 30s timer
Countdown5 secondsPrompt revealed
Drawing30 seconds8×8 pixel canvas active
Voting5 sec × rounds2-7 rounds based on player count
Finale15 secondsTop 10% compete
Results15 secondsRankings displayed

Phase Details

1. Lobby

Players join and wait for minimum player count.

Triggers for game start:

TriggerCondition
Auto-start5+ players in public lobby, 30s timer
Manual startHost clicks start (private rooms only)
Instant start100 players (capacity reached)

Private rooms: Host must manually start, no auto-timer.

2. Countdown (5 seconds)

  • Prompt indices generated on server
  • Prompt revealed to all players
  • Players prepare to draw

Prompt generation:

// ~70% have prefix, ~50% have suffix, subject always present
{
prefixIdx: 5, // "blue" or null
subjectIdx: 20, // "pizza" (always)
suffixIdx: null // "on fire" or null
}

3. Drawing (30 seconds)

  • 8×8 pixel canvas active
  • 16-color palette available
  • Real-time submission to server

Validation requirements:

  • Minimum 5 non-background pixels (anti-AFK)
  • Minimum 3 seconds draw time (anti-bot)
  • 64-character hex string format

After timer: Players without submission become spectators.

4. Voting (2-7 rounds × 5 seconds each)

  • Elo-based pairing algorithm
  • Two artworks shown per round
  • Players vote A or B
  • Ratings updated after each vote

Round calculation:

// Based on player count
1-10 players: 3 rounds
11-20 players: 4 rounds
21-30 players: 5 rounds
31-50 players: 6 rounds
50+ players: 7 rounds

Early ending: If all players vote before timer, round ends immediately.

5. Finale (15 seconds)

Top performers compete for final ranking.

Finalist selection:

finalistCount = ceil(playerCount × 0.10) // Top 10%
finalistCount = min(10, max(3, finalistCount))
  • All players (including spectators) can vote
  • Each finalist receives vote count
  • Early end if all votes received

6. Results (15 seconds)

  • Podium: Top 3 displayed prominently
  • Gallery: All artworks with rankings
  • Statistics: Elo scores, vote counts

After results:

  • Spectators return to active players
  • Submissions/votes cleared
  • New round starts in lobby

Elo Voting System

Instead of simple upvotes, SpriteBox uses chess-style Elo ratings.

How it works

  • Every artwork starts at 1000 Elo
  • Each vote is a 1v1 match between two artworks
  • Winner gains points, loser loses points
  • Amount depends on rating difference

Elo Formula

// Expected win probability
expected = 1 / (1 + 10^((loserElo - winnerElo) / 400))
// Rating change (K-factor = 32)
winnerChange = 32 × (1 - expected)
loserChange = -winnerChange

Example

  • Player A: 1000 Elo vs Player B: 1100 Elo
  • If A wins (upset): A +21, B -21
  • If B wins (expected): B +10, A -10

Fairness Guarantees

  • Each image shown approximately equal times
  • No image faces the same opponent twice
  • Fairness validation: max_shows - min_shows ≤ 2

Anti-Cheat Mechanisms

Phase Timing Validation

function isWithinPhaseTime(instanceId: string, gracePeriodMs = 2000): boolean {
return now <= phaseEndsAt + gracePeriodMs;
}

All submissions validated against phase timing.

Drawing Phase

  • Minimum 3 seconds before submission allowed
  • Minimum 5 non-background pixels required
  • 64-char hex format validated

Voting Phase

  • Can only vote for assigned matchup images
  • Cannot vote for own submission
  • One vote per round enforced

CopyCat Mode

CopyCat is a 1v1 memory-based game mode with a different phase flow.

Phase Flow

LOBBY COUNTDOWN (5s) MEMORIZE (5s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ 2 Players │ Auto │ Get │ │ Reference │
│ Join Room │ ───────► │ Ready │ ───────► │ Image │
│ (1v1) │ start │ │ │ Shown │
└─────────────┘ └─────────────┘ └─────────────┘
┌───────────────────────────────────────────────────┘
DRAWING (30s) RESULT (10s) REMATCH?
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Draw from │ │ Compare │ Vote │ Both vote │
│ Memory │ ───────► │ Accuracy │ ───────► │ for new │
│ │ │ Winner │ │ round │
└─────────────┘ └─────────────┘ └─────────────┘

CopyCat Phases

PhaseDurationDescription
LobbyUntil 2 playersInstant start when 2nd player joins
Countdown5 secondsPlayers prepare
Memorize5 secondsReference image shown
Drawing30 secondsRecreate from memory
Result10 secondsAccuracy comparison
Rematch15 secondsOptional: vote for new round

Accuracy Calculation

accuracy = (matchingPixels / totalPixels) × 100
// Higher accuracy wins
// Tie: faster submission wins

CopyCat Solo Mode

CopyCat Solo is a single-player practice mode for memory-based pixel art recreation.

CopyCat Solo Phase Flow

LOBBY MEMORIZE (5s) DRAWING (30s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Player │ Instant │ Reference │ │ Draw from │
│ Joins │ ───────► │ Image │ ───────► │ Memory │
│ (Solo) │ start │ Shown │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
┌───────────────────────────────────────────────────┘
RESULT (8s) NEXT ROUND
┌─────────────┐ ┌─────────────┐
│ Accuracy │ Play │ Back to │
│ Shown │ ─────────►│ Lobby │
│ │ again │ │
└─────────────┘ └─────────────┘

CopyCat Solo Phases

PhaseDurationDescription
LobbyInstantGame starts immediately when player joins
Memorize5 secondsReference image shown
Drawing30 secondsRecreate from memory
Result8 secondsAccuracy displayed

Key Differences from 1v1 CopyCat

  • No countdown phase: Starts immediately
  • No opponent: Practice at your own pace
  • Shorter result phase: 8s instead of 10s
  • No rematch voting: Simply play again
  • No private rooms: Solo mode uses public queue only

Pixel Guesser Mode

Pixel Guesser is a Pictionary-style game where one player draws while others guess.

Pixel Guesser Phase Flow

LOBBY COUNTDOWN (3s) GUESSING (45s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ 2-20 │ Auto │ Next │ │ Artist │
│ Players │ ───────► │ Round │ ───────► │ Draws Live │
│ Join │ start │ Starts │ │ Others Guess│
└─────────────┘ └─────────────┘ └─────────────┘
┌───────────────────────────────────────────────────┘
REVEAL (5s) NEXT ROUND? RESULTS (15s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Correct │ More │ Back to │ Game │ Final │
│ Answer + │ ───────► │ Countdown │ ───────► │ Rankings │
│ Scores │ rounds │ │ over │ │
└─────────────┘ └─────────────┘ └─────────────┘

Pixel Guesser Phases

PhaseDurationDescription
LobbyUntil 2+ playersAuto-start when threshold reached
Countdown3 secondsPrepare for next round
Guessing45 secondsArtist draws, others guess the word
Reveal5 secondsShow correct answer and round scores
Results15 secondsFinal rankings after all rounds

How It Works

  1. Artist Rotation: Each player takes a turn as the artist
  2. Secret Prompt: Artist sees a word to draw (localized EN/DE)
  3. Live Drawing: Canvas updates stream to guessers in real-time
  4. Guessing: Players type guesses, matched against both languages
  5. Scoring: Faster correct guesses earn more points

Scoring System

Time to GuessPoints
Under 10s100 + position bonus
Under 20s75 + position bonus
Under 30s50 + position bonus
Over 30s25 + position bonus

Position Bonus: 1st: +20, 2nd: +10, 3rd: +5

Artist Bonus: 20% of total points earned by guessers

Pixel Survivor Mode

Pixel Survivor is a single-player RPG where your pixel art determines your character’s stats, element, and personality trait.

Core Concept

  • Draw your character: Stats determined by pixel art properties (shape, color, density)
  • Element system: Dominant colors determine elemental affinity (Fire, Water, Earth, Air, Light, Dark)
  • Trait system: Drawing style determines personality traits affecting gameplay
  • Engine-based: Flexible RPG engine with stats, modifiers, effects, and dice rolls

Pixel Survivor Phase Flow

MENU CHARACTER GAMEPLAY
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ New Run / │ Start │ Draw Your │ Done │ RPG │
│ Continue / │ ─────────►│ Character │ ────────►│ Gameplay │
│ Stats │ │ (8x8 grid) │ │ (Engine) │
└─────────────┘ └─────────────┘ └─────────────┘
▲ │
│ │
└───────────────── Exit / Game Over ────────────────┘

Pixel Survivor Phases

PhaseDescription
MenuNew run, continue saved run, or view statistics
CharacterDraw 8x8 character, see live stat preview
GameplayActive gameplay with the created character

Character Creation System

When you draw your character, the engine analyzes the pixel art in real-time:

Stats from Drawing

PropertyStat AffectedHow It Works
Pixel countMax HPMore filled pixels = more HP
AsymmetryAttackAsymmetric designs = higher attack
SymmetryDefenseSymmetric, compact designs = higher defense
DensitySpeedSparse/light designs = higher speed
Color varietyLuckMore colors used = higher luck

Element Detection

The dominant colors in your drawing determine your elemental affinity:

ElementColorsStrengths
FireRed, OrangeStrong vs Earth, weak vs Water
WaterBlue, CyanStrong vs Fire, weak vs Earth
EarthGreen, BrownStrong vs Water, weak vs Air
AirWhite, Light GrayStrong vs Earth, weak vs Fire
LightYellow, GoldStrong vs Dark
DarkPurple, BlackStrong vs Light
NeutralMixed/GrayNo weaknesses, no strengths

Trait Detection

Your drawing style determines personality traits:

TraitDetectionEffect
AggressiveHigh asymmetry, warm colors+Attack, -Defense
DefensiveHigh symmetry, compact+Defense, -Speed
SwiftLow density, sparse+Speed, -HP
LuckyHigh color variety+Luck, +Critical chance
BalancedEven distributionNo bonuses or penalties
ChaoticComplex patternsRandom stat variations

Engine Systems

The game uses a modular RPG engine:

StatManager

Manages all character stats with base values and modifiers:

  • Resources: HP, Mana, Shield
  • Combat: Attack, Defense, Speed, Luck
  • Progression: Level, XP, XP to next level

EffectProcessor

Handles buffs, debuffs, and status effects:

  • Time-based effects (poison, regeneration)
  • Triggered effects (on hit, on critical)
  • Stackable modifiers

DiceRoller

Handles skill checks and damage calculations:

  • D20-based skill checks
  • Damage rolls with modifiers
  • Critical hit/miss system

Combat System

The gameplay loop centers around turn-based combat using a D20 dice system.

Combat Flow

ENCOUNTER PLAYER TURN RESOLUTION
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Monster │ Init │ Choose │ Roll │ Apply │
│ Spawns │ ─────────►│ Action │ ───────► │ Damage │
│ │ │ │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
┌────────────────────────────────────────────────────┘
MONSTER TURN CHECK OUTCOME
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Monster │ │ Victory? │ Yes │ XP + Loot │
│ Attacks │ ─────────►│ Defeat? │ ───────► │ or │
│ │ │ Continue? │ │ Game Over │
└─────────────┘ └─────────────┘ └─────────────┘

Combat Phases

PhaseDescription
player_turnPlayer chooses an action
player_rollingD20 dice roll animation
player_attackAttack animation plays
monster_turnMonster AI decides action
monster_attackMonster attack animation
victoryPlayer defeated the monster
defeatPlayer was defeated
fledPlayer successfully escaped

Combat Actions

ActionDescription
attackBasic attack using stats
defendDefensive stance (+defense)
abilityUse special ability
fleeAttempt to escape (40% base chance)

D20 Damage Modifiers

The D20 roll modifies damage dealt:

RollCategoryDamage Modifier
1Critical Failure-50% damage
2-5Poor-20% damage
6-14NormalNo modifier
15-19Good+20% damage
20Critical Hit+50% damage

Damage Formula

// 1. Base damage (fixed value + trait bonus)
// Player: 5 + trait bonus (offensive +1, defensive -1, utility 0)
// Monster: 5
baseDamage = 5 + traitBonus
// 2. Apply D20 modifier
d20Modified = baseDamage × d20Multiplier
// 3. Apply ability multiplier (if using special ability)
afterAbility = d20Modified × abilityMultiplier
// 4. Apply attack stat multiplier (1 + attack/100)
// Examples: 40 attack = 1.4×, 100 attack = 2.0×
afterAttack = afterAbility × (1 + attackStat / 100)
// 5. Apply defense multiplier (1 - defense/100, soft capped)
// Defense is capped at 50% reduction by default
defenseMultiplier = max(0.1, 1 - min(defense, 50) / 100)
afterDefense = afterAttack × defenseMultiplier
// 6. Apply element multiplier
finalDamage = max(1, afterDefense × elementMultiplier)

Monster System

Monsters are the primary enemies in Pixel Survivor.

Monster Properties

PropertyDescription
elementFire, Water, Earth, Air, Light, Dark, Neutral
raritycommon, uncommon, rare, epic, legendary, boss
behavioraggressive, defensive, balanced, berserker, tactical
sizetiny, small, medium, large, huge

Monster Rarity Effects

RaritySpawn RateXP MultiplierStat Bonus
CommonHigh1.0×None
UncommonMedium1.25×+10%
RareLow1.5×+25%
EpicVery Low2.0×+50%
LegendaryRare3.0×+100%
BossScripted5.0×+200%

Zone System

Monsters spawn based on zones and round progression:

interface ZoneDefinition {
id: string; // 'forest', 'cave', 'volcano'
startRound: number; // When zone becomes available
endRound: number; // When zone ends (-1 = unlimited)
monsterIds: string[]; // Which monsters can spawn
environmentElement?: ElementType; // Element bonus
}

Monster Abilities

Monsters can have special abilities:

Ability TypeExampleEffect
DamageBite1.5× damage multiplier
BuffHowlIncreases own attack
HealRegenerateRecover HP over time
DebuffPoisonDeal damage over time

Technical Notes

  • Single-player: Runs entirely client-side
  • LocalStorage: Character and run data persisted locally
  • No server rooms: Registered as game mode for consistency
  • Real-time preview: Stats update as you draw

Zombie Pixel Mode

Zombie Pixel is a real-time infection game on a 32x32 grid arena. One player starts as a zombie and must infect all survivors before time runs out.

Zombie Pixel Phase Flow

LOBBY COUNTDOWN (3s) GAMEPLAY (90s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Players │ Bots │ Roles │ │ Zombies │
│ Join │ ───────► │ Assigned │ ───────► │ Chase │
│ (1-100) │ fill │ │ │ Survivors │
└─────────────┘ └─────────────┘ └─────────────┘
┌───────────────────────────────────────────────────┘
RESULTS
┌─────────────┐
│ Winner + │
│ Stats │
│ Shown │
└─────────────┘

Zombie Pixel Phases

PhaseDurationDescription
LobbyUntil readyBots fill to 100 players, auto-start
Countdown3 secondsRoles assigned, positions revealed
Gameplay90 secondsReal-time movement and infection
Results10 secondsWinner announced with game stats

How It Works

  1. Bot Filling: Lobby fills with AI bots up to 100 players
  2. Role Assignment: One random player starts as zombie
  3. Movement: 8-directional movement via keyboard, touch joystick, or swipe
  4. Infection: Zombies infect survivors by touching them on the grid
  5. Win Condition: Last survivor wins, or zombies win if all infected

Controls

InputMethod
KeyboardArrow keys or WASD for 8-directional movement
TouchVirtual joystick or swipe gestures
GamepadD-pad or left stick

Game Mechanics

  • Grid Size: 32x32 cells
  • Viewport: 13x13 visible area centered on player
  • Infection: Zombie and survivor on same cell = infection
  • Movement Rate: Server-controlled tick rate (100ms)
  • Bot AI: Zombies chase nearest survivor, survivors flee from zombies

Technical Notes

  • Real-time: Uses Socket.io for low-latency game state sync
  • Server authoritative: All movement validated on server
  • Bot system: Server-side AI fills empty slots
  • Rate limited: Movement commands rate-limited to prevent spam

CopyCat Royale Mode

CopyCat Royale is a battle royale elimination game combining memory-based pixel art with competitive elimination rounds. Players draw images, then compete to recreate them from memory with the lowest accuracy players being eliminated each round.

CopyCat Royale Phase Flow

LOBBY COUNTDOWN (5s) INITIAL DRAW (30s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ 3-100 │ Auto │ Get │ │ All Draw │
│ Players │ ───────► │ Ready │ ───────► │ Freely │
│ Join │ start │ │ │ (Pool) │
└─────────────┘ └─────────────┘ └─────────────┘
┌───────────────────────────────────────────────────┘
SHOW REF (5s) DRAW (25s) RESULTS (8s)
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Random │ │ Recreate │ │ Accuracy │
│ Pool Image │ ───────► │ From │ ───────► │ Ranked │
│ Shown │ │ Memory │ │ Eliminate │
└─────────────┘ └─────────────┘ └─────────────┘
▲ │
│ │
└──── More players? ────────────────────────────────┘
WINNER (15s)
┌─────────────┐
│ Final │
│ Rankings │
│ Shown │
└─────────────┘

CopyCat Royale Phases

PhaseDurationDescription
LobbyUntil 3+ playersAuto-start after timer
Countdown5 secondsPlayers prepare
Initial Drawing30 secondsAll players draw freely (creates image pool)
Show Reference5 secondsRandom pool image shown
Drawing25 secondsRecreate from memory
Results8 secondsAccuracy ranked, eliminations shown
Winner15 secondsFinal rankings displayed

How It Works

  1. Initial Drawing: All players draw freely, creating the image pool
  2. Round Start: A random image from the pool is displayed
  3. Memorize: Players have 5 seconds to memorize the image
  4. Recreate: Players draw from memory (reference hidden)
  5. Scoring: Accuracy calculated by pixel-by-pixel comparison
  6. Elimination: Lowest accuracy players eliminated each round
  7. Repeat: Continue until one player remains

Elimination Mechanics

  • Each round eliminates approximately 1/3 of remaining players
  • Elimination count adapts based on player count
  • Finale triggers when 3 or fewer players remain
  • Ties broken by submission time (faster = better)

Royale Accuracy Scoring

accuracy = (matchingPixels / 64) × 100
// Higher accuracy survives
// Tie: faster submission time wins

Final Rankings

RankDescription
1stLast player standing (winner)
2nd-3rdEliminated in finale round
OthersRanked by round eliminated (later = better)

Technical Notes

  • Image Pool: Player drawings from initial round become references
  • Fair Selection: Images selected randomly, avoiding repeats
  • Early Submit: All players submitting ends phase early
  • Spectator Mode: Eliminated players can watch remaining rounds