cat-wars
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.
Viewing readonly version of main branch: v102View latest version
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.
- 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
- Register or log in.
- Check market prices for each breed.
- Buy cats where prices are low.
- Travel to another city (travel advances day and raises heat).
- Sell for profit.
- Manage debt before deadline.
- 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
- Account identity and avatar key.
- Cookie-token sessions with expiry.
- Current market, cash, debt, heat, day, cargo, debt due day, borrow tier.
- City list and enforcement risk profile.
- Base economy metadata for each cat breed.
- Owned quantity per breed per user.
- Daily per-market generated prices per user.
POST /api/registerPOST /api/loginPOST /api/logoutGET /api/me
POST /api/buyPOST /api/sellPOST /api/travelPOST /api/borrowPOST /api/pay-debt
POST /api/avatar/presetGET /api/pixel-avatar/:avatarIdGET /api/avatar/:userId
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.
- Server-side validation and rate limiting per action.
- Structured logging for action events (travel, bust, borrow, bankruptcy).
- Multiplayer market ticker with shared city economy state.
- Profile page customization layer (Myspace-style modules/theme settings).
