• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
pchinjr

pchinjr

cat-wars

Cat Wars 2029 trading game MVP
Public
Like
cat-wars
Home
Code
2
README.md
H
main.ts
Environment variables
Branches
1
Pull requests
Remixes
History
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v79
View latest version
README.md

Cat Wars 2029

A retro-styled browser trading game inspired by the Drug Wars gameplay loop.

Players move between real U.S. city markets, buy/sell illegal cat breeds, manage heat risk, and survive escalating debt pressure.

Stack

  • Runtime: Val Town HTTP Val (main.ts)
  • Web framework: Hono
  • Persistence: Val Town sqlite
  • Binary/media: Val Town blob (currently avatar system uses pixel presets)
  • Frontend: server-rendered HTML + vanilla JS

Core Gameplay Loop

  1. Register or log in.
  2. Check market prices for each breed.
  3. Buy cats where prices are low.
  4. Travel to another city (travel advances day and raises heat).
  5. Sell for profit.
  6. Manage debt before deadline.

Debt System

  • Debt has a due day (debt_due_day).
  • Borrowing:
    • increases cash and debt
    • applies escalating fee by borrow tier
    • extends due window, capped to at most 90 days ahead
  • Missing debt deadline while debt > 0 triggers bankruptcy:
    • inventory wiped
    • run reset to baseline state

Data Model

users

  • Account identity and avatar key.

sessions

  • Cookie-token sessions with expiry.

player_state

  • Current market, cash, debt, heat, day, cargo, debt due day, borrow tier.

markets

  • City list and enforcement risk profile.

breeds

  • Base economy metadata for each cat breed.

inventory

  • Owned quantity per breed per user.

user_market_prices

  • Daily per-market generated prices per user.

API Surface

Auth/session

  • POST /api/register
  • POST /api/login
  • POST /api/logout
  • GET /api/me

Economy/actions

  • POST /api/buy
  • POST /api/sell
  • POST /api/travel
  • POST /api/borrow
  • POST /api/pay-debt

Avatar/presets

  • POST /api/avatar/preset
  • GET /api/pixel-avatar/:avatarId
  • GET /api/avatar/:userId

Local Behavior Notes

  • initDb() is idempotent and performs lightweight schema migration for existing rows.
  • Price generation is deterministic-ish with random volatility per day/market and breed risk inputs.
  • Debt deadline is enforced on read and write endpoints to prevent bypass.

Next Suggested Improvements

  1. Server-side validation and rate limiting per action.
  2. Structured logging for action events (travel, bust, borrow, bankruptcy).
  3. Multiplayer market ticker with shared city economy state.
  4. Profile page customization layer (Myspace-style modules/theme settings).
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.