# flatland3-gfx
Macroquad + egui graphical play client for [Flatland3](https://github.com/bvelasquez/flatland3).
## Install
```bash
cargo install flatland3-gfx
```
Run from a checkout that includes `assets/` (or set `FLATLAND_ASSETS` to your content tree) so terrain tiles and sprites resolve.
## Quickstart
```bash
flatland3-gfx
# or pick a character by name:
flatland3-gfx --name traveler
```
On first launch (or when the saved session is expired **and** no remembered password is available), the client shows **Login** / **Create account**. After a successful login, email/password are saved to platform config `flatland/login.json` (mode `0600`). When Redis/dev restarts invalidate the control-plane session token, the client silently re-logs in with those credentials and keeps your last character.
New accounts continue to **Create character**. Accounts with **two or more** characters always get a **Select character** screen (last played is marked ★ and remembered after you pick). A single character is used automatically.
In-game (**F2**): **Switch character** returns to the picker; **Log out** clears the session token and returns to Login (saved email/password remain for autofill).
Session file: platform config dir `flatland/session.json` (same as `flatland3 auth login`). Login autofill: `flatland/login.json`. Game server defaults to `127.0.0.1:7373` from `client.json`.
**One-shot remote host** (does not write `client.json`):
```bash
flatland3-gfx --host server2.flatland3.com
# optional character:
flatland3-gfx --host server2.flatland3.com --name traveler
```
`--host` accepts DNS or IP; gateway port defaults to **7373**, API to **7380**. Session for that host is stored separately (`session.<host>.json`) so your local `session.json` is left alone. Prefer `--host` over `--server` (IP:port only). Set `FLATLAND_API_TOKEN` to skip interactive onboarding (agents/CI).
## Crates.io stack
| `flatland-protocol` | Wire types and codecs |
| `flatland-client-lib` | TCP session and game state |
| `flatland-client-ui` | Engine-agnostic play UI (input, world grid, presentation) |
| `flatland-gfx-engine` | Macroquad map renderer + egui HUD |
| `flatland3-gfx` | This binary (`cargo install flatland3-gfx`) |
The terminal client remains `cargo install flatland3`.
## Monorepo dev
```bash
make dev-play-gfx
# or
cargo run -p flatland3-gfx -- --name traveler
```