Show HN: Playing LongTurn FreeCiv with Friends

A self-hosted Freeciv 3.2.3 multiplayer server designed for longturn games (23-hour turns), featuring AI-generated newspapers and automated notifications.
A self-hosted Freeciv 3.2.3 multiplayer server designed for longturn games (23-hour turns), running on Fly.io with email notifications, a live status page, and an AI-generated newspaper.
An active 16-player game is running on this codebase right now. Check out the status page to see live rankings, turn countdowns, history charts, diplomacy tracking, and the AI-generated wartime newspaper.
Longturn is a style of Freeciv multiplayer where each turn lasts ~23 hours instead of minutes. Players log in once a day, make their moves, click "Turn Done", and go about their lives. When all players have ended their turn (or the timer runs out), the next turn begins.
┌─────────────────────────────────────────────────┐
│ Fly.io Container │
│ │
│ entrypoint.sh │
│ ├── busybox crond (status page refresh) │
│ └── start.sh │
│ ├── freeciv-server (port 5556) │
│ ├── busybox httpd (port 8080 → 80/443) │
│ ├── FIFO command writer │
│ ├── Turn change watcher │
│ ├── Auto-saver (every 5 min) │
│ └── Turn reminder checker │
│ │
│ /data/saves (persistent volume) │
│ ├── lt-game-*.sav.gz (save files) │
│ ├── freeciv.sqlite (player auth DB) │
│ ├── status.json (live game state) │
│ ├── history.json (per-turn stats) │
│ ├── attendance.json (missed turns) │
│ ├── diplomacy.json (relationships) │
│ └── gazette.json (AI newspaper) │
└─────────────────────────────────────────────────┘
The server communicates via a FIFO pipe (/tmp/server-input) — scripts send commands to the running Freeciv server by writing to this pipe.
Key Components
- Orchestration:
start.shhandles the Freeciv server lifecycle, auto-saves, and turn timer preservation across restarts. - Status Monitoring:
generate_status_json.shextracts game state into JSON every 5 minutes, powering a client-side dashboard with Chart.js. - Notifications:
turn_notify.shandturn_reminder.shuse AWS SES to keep players engaged and informed of deadlines. - AI Integration:
generate_gazette.shcalls OpenAI to generate era-appropriate wartime news based on in-game events.
Deployment
Deployment is handled via flyctl with a persistent volume for saves. Player management is simplified through manage_players.sh, which handles SQLite database entries and automated welcome emails. Mid-game state can be adjusted by editing the plaintext save files directly, providing high flexibility for game administrators.
Source: Hacker News









