Skip to content

feat: local-network Pokémon battles between PokeTokenBar users #213

Description

@dabass51

Summary

Let two PokeTokenBar users on the same local network battle their current
companions. No server, no accounts, no internet — discovery via Bonjour,
direct peer-to-peer connection.

Motivation

Right now the companion loop is entirely single-player: hatch → evolve →
graduate → Pokédex. In a team that all runs Claude Code / Codex side by side,
the obvious next social step is "my Charmeleon vs. your Machoke". It turns the
menu bar into a shared team thing without changing anything about the tracker
underneath.

Starting LAN-only keeps this consistent with the project's on-device privacy
stance: nothing leaves the local network, no backend to run or pay for.

Proposed scope (v1)

  • Discovery: advertise/browse _poketokenbar._tcp via Bonjour
    (NWListener / NWBrowser), opt-in in Settings, off by default.
  • Challenge flow: peer list in a new tab → send challenge → accept/decline
    → battle → result. Timeout on no answer.
  • Battle resolution: deterministic, driven by data the app already has —
    species base stats from PokéAPI, a level derived from accumulated token
    spend, nature modifiers, small shiny bonus. Both sides exchange a seed and
    resolve the same rounds locally, so results always match.
  • Result: notification + a simple win/loss record shown on the Pokédex
    entry.

Explicitly out of scope

  • Internet play, matchmaking service, ranked ladder
  • Trading Pokémon
  • Any reimplementation of the official battle system, type chart or damage
    formulas — the mechanic should be an original, simplified one, in line with
    the project's IP rules in CONTRIBUTING.md
  • Bundling any assets; sprites stay runtime-fetched from PokéAPI as today

Notes / open questions

  • macOS 15+ requires local network authorization — needs the usage
    description string and a graceful fallback when denied.
  • Suggest TLS with a PSK derived from a short pairing code shown in both UIs,
    so random machines on a corporate LAN can't spam challenges.
  • Cheating is possible in principle (token counts are read from local logs),
    but for LAN play among colleagues an honor system seems fine. Worth deciding
    early whether that's acceptable.
  • Optional later: wager Rare Candy or tokens on the outcome.
  • Would you be open to a PR for this, and does the direction (LAN-only,
    deterministic, original mechanic) match how you'd want it built?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions