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
This commit is contained in:
Ryan Hamamura
2026-02-04 06:50:18 -10:00
parent 038c4b3f22
commit 2dc75107d1
9 changed files with 307 additions and 1770 deletions

View File

@@ -64,8 +64,9 @@ func SnakeBoard(sg *snake.SnakeGame) h.H {
case ci.snakeIdx >= 0:
s := state.Snakes[ci.snakeIdx]
colorIdx := ci.snakeIdx
bg := ""
if colorIdx < len(snake.SnakeColors) {
bg := snake.SnakeColors[colorIdx]
bg = snake.SnakeColors[colorIdx]
style += fmt.Sprintf("background:%s;", bg)
}
if !s.Alive {
@@ -73,6 +74,9 @@ func SnakeBoard(sg *snake.SnakeGame) h.H {
}
if ci.isHead {
class += " snake-head"
if bg != "" {
style += fmt.Sprintf("box-shadow:0 0 8px %s;", bg)
}
}
}