Commit Graph

45 Commits

Author SHA1 Message Date
Ryan Hamamura
ffd44ae56b deps: update ryanhamamura/via to v0.19.0
All checks were successful
Deploy c4 / deploy (push) Successful in 54s
v0.1.1
2026-02-19 12:13:00 -10:00
Ryan Hamamura
5a5cd08abb fix: use correct runner label in deploy workflow
All checks were successful
Deploy c4 / deploy (push) Successful in 59s
The workflow was hanging because `ubuntu-latest` doesn't match the
Gitea Actions runner registered with the `games` label.
v0.1.0
2026-02-19 11:20:42 -10:00
Ryan Hamamura
884650c68d feat: integrate via v0.18.1 context suspension and key throttling
Some checks failed
Deploy c4 / deploy (push) Has been cancelled
Upgrade via to v0.18.1 and configure context suspension timeouts
(5min suspend, 30min TTL) for clean reconnection behavior. Throttle
snake direction key inputs to 100ms to prevent wasted SSE round-trips
when keys are held down.
2026-02-19 11:14:35 -10:00
Ryan Hamamura
c5b863efdd chore: trigger CI/CD
Some checks failed
Deploy c4 / deploy (push) Has been cancelled
2026-02-19 09:38:00 -10:00
Ryan Hamamura
968c2cdb61 feat: add glowing effect to active player's pieces
All checks were successful
Deploy c4 / deploy (push) Successful in 42s
Pulsing box-shadow on the current turn's placed pieces makes the
turn state visible directly on the board rather than only in the
status banner.
2026-02-13 12:34:19 -10:00
Ryan Hamamura
c541ba56d4 fix: responsive C4 board on mobile and preserve chat input during morph
All checks were successful
Deploy c4 / deploy (push) Successful in 42s
Shrink board cells to 36px with tighter gaps on <768px screens so the
board fits on 375px phones. Add DataIgnoreMorph to the C4 chat input
so typing isn't disrupted when new messages arrive.
2026-02-13 12:26:24 -10:00
3593197271 feat: persist chat messages to SQLite (#1)
All checks were successful
Deploy c4 / deploy (push) Successful in 44s
2026-02-13 22:00:01 +00:00
Ryan Hamamura
08c20a1732 chore: re-upgrade via to v0.15.1
All checks were successful
Deploy c4 / deploy (push) Successful in 43s
The login bug was caused by missing RenewToken(), not the via update.
2026-02-13 11:43:31 -10:00
Ryan Hamamura
deff9b3859 fix: renew session token after login/register to persist session data
All checks were successful
Deploy c4 / deploy (push) Successful in 42s
Without RenewToken(), session data set during the action handler
wasn't surviving the redirect — the old pre-auth token was stale.
2026-02-13 11:35:37 -10:00
Ryan Hamamura
645d958041 revert: downgrade via to v0.15.0 to debug login regression
All checks were successful
Deploy c4 / deploy (push) Successful in 4s
Login on deployed server stopped persisting session data after the
v0.15.1 update. Reverting to isolate whether the via update caused it.
2026-02-13 11:29:17 -10:00
Ryan Hamamura
f238e126d3 chore: update via to v0.15.1
All checks were successful
Deploy c4 / deploy (push) Successful in 54s
2026-02-13 10:59:00 -10:00
Ryan Hamamura
9069530e47 feat: add in-game chat to Connect 4
All checks were successful
Deploy c4 / deploy (push) Successful in 43s
Add real-time chat alongside the game board, mirroring the snake chat
implementation. Fix mobile layout for both C4 and snake chats — expand
chat to full width and reduce history height on small screens.
2026-02-13 10:54:19 -10:00
Ryan Hamamura
e45559ecb3 chore: update APP_URL to games.adriatica.io
All checks were successful
Deploy c4 / deploy (push) Successful in 39s
2026-02-13 09:24:49 -10:00
Ryan Hamamura
e85271ab29 feat: stealth mode — replace game-related text with discrete symbols
All checks were successful
Deploy c4 / deploy (push) Successful in 40s
Replace "Game Lobby", "Connect 4", and "Snake" headings with colored
circles (●●●●) and tildes (~~~~) so the UI is less obviously a game
at a glance. Also neutralize the lobby description text and shorten
the back link.
2026-02-13 09:22:07 -10:00
Ryan Hamamura
9799387a32 fix: ensure data directory has correct ownership before starting container
All checks were successful
Deploy c4 / deploy (push) Successful in 41s
On a fresh VM, Docker creates the bind-mounted data/ directory as
root:root, but the container runs as games (UID 5). This causes
SQLite to fail with SQLITE_CANTOPEN. Create the directory with
correct ownership in the deploy pipeline.
2026-02-13 09:03:33 -10:00
Ryan Hamamura
dfc2111be5 feat: add CI/CD workflow and switch to bind mount for data
All checks were successful
Deploy c4 / deploy (push) Successful in 1m19s
Use a Gitea Actions workflow to deploy on push to main via
act_runner on the games VM. Switch from a Docker named volume
to a ./data bind mount for easier backup and persistence across
deploys.
2026-02-13 08:42:51 -10:00
Ryan Hamamura
427521505b feat: add Docker Compose deployment and serve assets via StaticFS
Embed full assets directory and serve with via's StaticFS instead of a
custom HTTP handler. Move SQLite DB to data/c4.db for clean volume
mounting. Add multi-stage Dockerfile, docker-compose.yml, and
.dockerignore.
2026-02-13 08:02:15 -10:00
Ryan Hamamura
b0449fbeb9 chore: rebuild CSS output 2026-02-12 15:10:38 -10:00
Ryan Hamamura
d2ed3cffd9 deps: update via to v0.15.0, remove vianats dependency
NATS is now built into via.New() automatically. Stores use the new
v.PubSub() accessor instead of the removed vianats package.
2026-02-12 15:10:18 -10:00
Ryan Hamamura
3d019fd948 feat: add snake multiplayer chat as sidebar with vivid player colors
Move chat to the right of the board using a flex wrapper that stacks
vertically on narrow screens. Restore original snake player colors by
removing the desaturation filter added with the dark theme.
2026-02-05 10:15:26 -10:00
Ryan Hamamura
0279615b36 feat: add back to lobby navigation on game pages 2026-02-05 09:55:43 -10:00
Ryan Hamamura
73128dc119 style: dark stealth theme with teal/burgundy pieces and cache-busting
Darken the DaisyUI theme and game board colors for a muted, low-chroma
aesthetic. Pieces use dark teal vs burgundy for subtle contrast.
Add MD5-based cache busting to the DaisyUI stylesheet link so CSS
changes are picked up without a hard refresh.
2026-02-05 09:51:36 -10:00
Ryan Hamamura
9a3d1fd164 refactor: reduce snake animation delays for snappier gameplay
Remove transitions and simplify head-pop animation to feel more
responsive at higher speed settings.
2026-02-04 10:04:27 -10:00
Ryan Hamamura
e239e948ae feat: add configurable speed and expanded grid presets for snake
- Add per-game speed setting with presets (Slow/Normal/Fast/Insane)
- Add speed selector UI in snake lobby
- Expand grid presets with Tiny (15x15) and XL (50x30)
- Auto-calculate cell size based on grid dimensions
- Preserve speed setting in rematch games
2026-02-04 10:02:40 -10:00
Ryan Hamamura
f454e0d220 feat: add single player snake mode
Add solo mode where players survive as long as possible while tracking
score (food eaten). Single player games start with a shorter 3-second
countdown vs 10 seconds for multiplayer, maintain exactly 1 food item
for classic snake feel, and end when the player dies rather than when
one player remains.

- Add GameMode type (ModeMultiplayer/ModeSinglePlayer) and Score field
- Filter single player games from "Join a Game" lobby list
- Show "Ready?" and "Score: X" UI for single player mode
- Hide invite link for single player games
- Preserve game mode on rematch
2026-02-04 07:33:02 -10:00
Ryan Hamamura
7faf94fa6d feat: make invite link base URL configurable via APP_URL
Load environment variables from .env file using godotenv.
Defaults to https://demo.adriatica.io if APP_URL is not set.
2026-02-04 07:02:52 -10:00
Ryan Hamamura
20ed4807d9 Ignore deploy tarball artifacts 2026-02-04 06:52:19 -10:00
Ryan Hamamura
2dc75107d1 Add visual smoothing for snake game and systemd deployment
CSS animations for smoother 60fps feel despite 7Hz game ticks:
- 130ms transitions on cell background/box-shadow
- Head pop-in animation on direction changes
- Food pulse animation
- Smooth death state fade with grayscale

Per-snake colored glow on head cells.

Make server port configurable via PORT env var (default 8080).

Add deploy/ with systemd service and scripts:
- setup.sh: create games user, /opt/c4, install unit
- deploy.sh: build and install binary, restart service
- package.sh: cross-compile, tarball, base64 split for transfer
- reassemble.sh: decode and extract on target server
2026-02-04 06:50:18 -10:00
Ryan Hamamura
038c4b3f22 Update via to v0.4.0 and decouple tick rate from snake speed
Use via.OnKeyDownMap for snake keybindings, replacing the manual
dataExpr/rawDataAttr workaround. Window-scoped key handling removes
the need for tabindex/focus hacks, and WithPreventDefault on arrow
keys prevents page scrolling during gameplay.

Introduce a 60 FPS tick loop with a separate snake movement speed
(7 cells/s) so direction input is polled every frame but game state
only advances at the configured rate.
2026-02-02 09:18:13 -10:00
Ryan Hamamura
7e78664534 WIP: Add multiplayer Snake game
N-player (2-8) real-time Snake game alongside Connect 4.
Lobby has tabs to switch between games. Players join via
invite link with 10-second countdown. Game loop runs at
tick-based intervals with NATS pub/sub for state sync.

Keyboard input not yet working (Datastar keydown binding
issue still under investigation).
2026-02-02 07:26:28 -10:00
Ryan Hamamura
a6b5a46a8a Replace polling loop with NATS pub/sub for game updates
Use via's embedded NATS server to notify players of state changes
instead of a 100ms polling ticker. Each player subscribes to
"game.<id>" on page load; via auto-cleans subscriptions on disconnect,
eliminating the need for manual player tracking and RegisterSync.
2026-01-31 10:26:31 -10:00
Ryan Hamamura
d079b90a33 Update via dependency from v0.2.5 to v0.3.1 2026-01-31 09:30:32 -10:00
Ryan Hamamura
f590a2444a Replace PicoCSS with DaisyUI + Tailwind v4
Use gotailwind (standalone Tailwind v4 via Go tool) with DaisyUI
plugin files — no npm needed. CSS is compiled at build time and
embedded via a Via Plugin that serves it as a static file.

Custom "connect4" theme: light, warm, playful palette with red/yellow
accents matching game pieces and board blue accent.
2026-01-31 07:31:29 -10:00
Ryan Hamamura
dcab4343e5 Add login prompt for game invite links
When unauthenticated users visit a game invite link, show a prompt
with options to log in, register, or continue as guest. After
login/register, redirect back to the original game URL.
2026-01-22 21:50:50 -10:00
Ryan Hamamura
5e1712c4a0 Use SQLite for session storage
Upgrade via to v0.2.5 and switch from in-memory sessions to SQLite-backed
sessions for persistence across server restarts.
2026-01-22 16:53:47 -10:00
Ryan Hamamura
ee762fb841 Fix player reconnection by re-registering sync context
When an existing player reconnects to a game, their sync context
is now updated so they continue receiving real-time updates.
2026-01-14 21:54:07 -10:00
Ryan Hamamura
2cd5b1d289 Add play again button for rematch after game ends
When a game finishes (win or draw), players see a "Play again" button.
Clicking it creates a new game and the opponent sees a "Join Rematch"
link to join the same game.
2026-01-14 18:02:26 -10:00
Ryan Hamamura
5f452914f8 Add game deletion with authorization check
- Add Delete method to GameStore and Persister interface
- Add delete button to game list on home page
- Verify user owns game before allowing deletion
- Use status constants instead of magic numbers
- Remove unused variable in persister
2026-01-14 17:44:09 -10:00
Ryan Hamamura
d96f7dcc29 Show user's active games on home page after login 2026-01-14 17:11:27 -10:00
Ryan Hamamura
2153b6ad75 Add c4.db to gitignore 2026-01-14 16:59:45 -10:00
Ryan Hamamura
b264d8990b Add user authentication and game persistence with SQLite
- User registration/login with bcrypt password hashing
- SQLite database with goose migrations and sqlc-generated queries
- Games and players persisted to database, resumable after restart
- Guest play still supported alongside authenticated users
- Auth UI components (login/register forms, auth header, guest banner)
2026-01-14 16:59:40 -10:00
Ryan Hamamura
03dcfdbf85 Revert "Auto-generate nicknames for invitees joining via link"
This reverts commit 32e4e61635.
2026-01-14 15:41:43 -10:00
Ryan Hamamura
32e4e61635 Auto-generate nicknames for invitees joining via link
Invitees no longer need to enter a nickname - they automatically
join with a random name like "Swift Tiger" or "Happy Falcon".
Game creators still enter their nickname manually.
2026-01-14 14:45:04 -10:00
Ryan Hamamura
63d0773ab5 Simplify codebase and fix Enter key on home page
- Enter key now triggers createGame action on home page
- Remove redundant setNickname action from home page
- Remove unused code: join channel, Leave(), Stop() methods
- Consolidate ID generation into game.GenerateID()
- Remove unused CreatedAt field from Game struct
2026-01-14 14:10:18 -10:00
Ryan Hamamura
389fc12bf2 Add Connect 4 multiplayer game server
Real-time two-player Connect 4 using Via framework with:
- Game creation and invite links
- SSE-based live updates for both players
- Win detection with animated highlighting
- Session-based nickname persistence
2026-01-14 12:57:57 -10:00