18 Commits
Author SHA1 Message Date
TMCandClaude Opus 5.5 ebae0a2d05 Server: save what players have seen before a shutdown, and steady tests
Release / build (push) Successful in 6m30s
CI failed once on aGameInProgressSurvivesARestart: a room took its
snapshot after an event was handled, but sent the new table during it,
so a server stopping in between saved the game one move behind what the
players had already seen. A room now takes its snapshot before it sends
a table or the seating.

A refused connection (too many from one address, or too many messages)
now flushes its error before the socket closes, so the client reads it.
The connection-limit test waits for the server to see the first
connection close before opening another, instead of racing it.

Failing server tests now print their full message in the build log, as
CI runs them inside the image build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 17:03:38 +01:00
TMCandClaude Opus 5.5 8f5211cb2d Web: keep the browser's own touch gestures off the page
Release / build (push) Failing after 2m55s
A finger sliding a card up the page could be taken by the browser for
scrolling, the bounce or pull-to-refresh (or a long press for selecting
text), which cancels the drag and the card goes back into the hand.
The page now hands every touch to the app (touch-action: none,
overscroll-behavior: none, no selection or callout).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 16:32:58 +01:00
TMCandClaude Opus 5.5 4031197ac1 Deal the cards 3, 3 and 2 on screen, and let a card be thrown by dragging
Release / build (push) Successful in 4m42s
A new hand is now dealt as at a real table: packets of 3, 3 and then
the 2 talon cards fly from the dealer to each player in turn, starting
after the dealer, and cards appear in the hand and the fans only as
they arrive (DealPlan, DealOverlay). The deal takes about 1.6 s, over
before the first bot calls, and nobody is shown to act meanwhile. Its
sound plays with each round, and "your turn" only once all the cards
are out.

A card that may be played can also be dragged onto the table: held,
it straightens and comes up a little; let go above the hand and it is
played, landing from where it was dropped and shrinking to its size on
the table; let go lower and it goes back into the hand. A click still
plays it too.

Hand cards are now keyed at the loop level, so a card keeps its state
when the hand is sorted again as more cards arrive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 16:09:22 +01:00
TMCandClaude Opus 5.5 ca402e1270 Make the card sounds from the card's slide, not its harsh landing
Release / build (push) Successful in 4m32s
The card recording is very quiet with rumble all through it, and its
landing turns into a harsh crack once brought up to the others'
loudness. The slide is clean above 1 kHz, so the recording is now
filtered below 900 Hz and the slide used instead, as chosen by ear:

- a card played: the slide
- the deal: three slides, each a little faster or slower
- a trick gathered: the slide played slower and deeper

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 15:29:59 +01:00
TMCandClaude Opus 5.5 6c55ebc7ae Use the recorded sounds, all at one quieter loudness
Release / build (push) Successful in 5m13s
The sounds now come from the recordings in audio_assets/, cut and
cleaned up by tools/make_sounds.py into one WAV per sound (shared
composeResources/files/sounds), loaded by both apps instead of being
synthesised at runtime:

- your turn: the nudge ring; to call trump: the nudge twice
- 10 seconds left: the reminder ring; someone joins: its first strikes
- the last seconds: the clock's tick
- a card played, the deal, a trick gathered: the card recording
- won, lost: the happy and the sad melody
- trump called, the hand over: still synthesised (no recording yet)

Each is trimmed so it starts at once, faded out instead of cut, the
card recording's rumble filtered out, and every sound set to the same
loudness, its loudest 100 ms at -20 LUFS (K-weighted, BS.1770), about
6 dB below the old chimes, with peaks under -4 dBFS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 15:13:08 +01:00
TMCandClaude Opus 5.5 fb37180c89 Sounds, an online turn timer, and the suits' usual names
Release / build (push) Successful in 4m31s
Sounds: your turn to play or to call, 10 seconds left and the last five
ticking (online), cards, the deal, a trick gathered, trump called, the
end of a hand, winning or losing, and someone sitting down in your room.
They are synthesised in code (struck bells, filtered noise), so there
are no audio files to license, and played through SoundPool on Android
and Web Audio in the browser. The cues follow the game state outside of
composition, so a browser tab in the background still chimes when it is
your turn. A speaker button on the table and a switch in the settings
turn them off.

Online, every move and call now has 30 seconds; then the server's bot
makes it. Two in a row and the bot plays for that player without
waiting until they tap "Vraćam se" (or, with nobody else at the table,
the game waits for them). After a hand the next one is dealt within 30
seconds. The time shows as a ring round the portrait of whoever is to
play, on your own plate while you play and under the trump offer while
you call. Tables carry the time left and the autoplay state as new
optional fields, so older clients still work.

The suits are now called as players call the Hungarian cards: Herc,
Bundeva, Zelje, Žir ("zove bundevu").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 14:19:10 +01:00
TMCandClaude Opus 5.5 59a37277f2 Limit what one address can do, and close idle rooms
Release / build (push) Successful in 4m20s
Someone scripting the server could guess the 4-character room codes
without limit (one connection, thousands a second), open all 2000 rooms
in seconds, or flood it with connections and messages. Per IP address
now:

- 10 wrong room codes in a row, then one a minute; while cut off even a
  right code gets no answer. Coming back to your seat with a token is
  not limited, and answers the same whether the room or the seat is
  gone, so it tells nothing about which codes are in use.
- 10 new rooms in a row, then one every 3 minutes.
- 32 connections at a time; 40 messages in a burst, then 10 a second.

The address comes from X-Forwarded-For only when the connection is from
the local or Docker network (the TLS proxy); the server warns once if
such connections arrive without the header.

A room where no player did anything for 3 hours now closes even with
screens still connected (a forgotten tab), telling them why. Rooms
nobody is connected to already closed after 10 minutes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 11:22:17 +01:00
TMCandClaude Opus 5.5 ca87d53632 Make the home screen QR code readable from a monitor
Release / build (push) Successful in 4m29s
The desktop home screen showed the 53-module code at 132 dp, about two
blurred pixels per module. It now takes up to 200 dp when the window is
tall enough, and every QR code draws its modules in whole pixels so the
edges stay sharp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 10:52:04 +01:00
TMCandClaude Opus 5.5 e1a84f6b70 Web: desktop layout for wide screens
Release / build (push) Successful in 4m38s
In a wide landscape window (at least 900 x 560 dp, 16:9 and similar) the web
app no longer shows the phone column with black bars:

- Table: an oval card table with a wooden rail across the window, players
  around it, larger cards (sized to the window, never above the artwork's
  width), and a side panel with the score, trump, the hand so far, the last
  trick and the score sheet always in view.
- Home: the logo as a hero on the left, the menu on a panel to the right,
  with the Android QR code in the browser.
- Online lobby and room: two columns.
- Training: a centred column.
- With a mouse, playable cards rise further under the pointer, and
  buttons, suit tiles and free seats get a hand cursor and a soft hover.

Phones, narrow windows and the Android app keep the existing layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 09:34:38 +01:00
TMCandClaude Opus 5.5 2ab639cf12 Docker: make a mounted /data folder writable whoever owns it
Release / build (push) Successful in 4m41s
A host folder mounted on /data (owned by root, or by uid 1000) was not
writable for the server's uid 10001, so the rooms were not saved
("Permission denied"). The image now starts as root only to hand $DATA_DIR
to the bela user, then runs the server as bela via setpriv
(docker-entrypoint.sh). Started with another user (compose `user:`), it runs
as that user directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:53:25 +01:00
TMCandClaude Opus 5.5 6ecb844ae2 Server: keep open rooms across restarts
Release / build (push) Successful in 4m45s
A redeploy no longer ends the games in progress. The server writes the open
rooms (players, tokens, host, and each game as its seed and moves) to
$DATA_DIR/rooms.json every few seconds when something changed and once more
on shutdown (SIGTERM via Ktor's shutdown hook), and loads them before it
accepts connections. Clients reconnect with their saved token and get the
same table back; bots wait 30 s for them after a restart. Saves older than
10 minutes are ignored, and a game the new rules cannot replay leaves the
room in the lobby.

The image sets DATA_DIR=/data (owned by the bela user) and the compose file
mounts the bela-data named volume on it.

Also fixes a flaky test: the guest ignored its first table, so the game
waited forever whenever the random dealer made the guest call first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:32:26 +01:00
TMCandClaude Opus 5.5 9c77ffd3a7 Docker build: make the Gradle wrapper executable
Release / build (push) Successful in 5m49s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 23:25:46 +01:00
TMCandClaude Opus 5.5 767857d0ff Web app and online play: shared Compose UI, Ktor game server, Docker image
Release / build (push) Failing after 1m29s
- shared: the whole UI moves to Compose Multiplatform (Android + Kotlin/Wasm). Platform pieces
  (card images, storage, links, back button) come in through a Platform interface; fonts, logo and
  suit icons are compose resources; images are reduced by halving so they stay sharp everywhere.
- web: the browser app (bela.mariosem.es), with 1x card faces, localStorage and room links (?soba=KOD).
- Online play: lobby (name, open a room, join by code), waiting room with seats, then the usual
  table. The server runs every game with the engine and sends each player only their own view;
  bots fill empty seats; same pacing as the local game. Reconnect with a saved token (also after
  closing the app or reloading the page), 10 s grace before a bot plays for an absent player,
  heartbeat so dead connections are noticed.
- server: Ktor (WebSocket /ws, /health, serves the web app with pre-compressed files). Tests cover
  a whole two-player game, resume and leaving.
- Dockerfile (one image: web + server, tests run in the build), docker-compose.yml and a Gitea
  Actions workflow like Keep's (build, Trivy scan, push msemes/bela:<sha> and :latest).
- Android talks to the server with Ktor CIO; the update section stays Android-only. The QR code is
  precomputed (QrMatrix) and checked against ZXing in a unit test.
- -PbelaNoAndroid=true builds without the Android SDK; -PbelaDownloadNode=false reuses the local Node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 23:23:34 +01:00
TMCandClaude Opus 5.5 df7825c598 app: table UI renders the player's TableView; neutral caller wording
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:34:34 +01:00
TMCandClaude Opus 5.5 a4bfb38be7 engine: Kotlin Multiplatform (JVM + Wasm), serializable wire types, TableView per seat
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:32:30 +01:00
TMCandClaude Opus 5.5 66912efb5d Slower, clearer trump calling
- Pause after each deal before the first bot calls; bots take 1.3 s per answer
- Every answer stays on show as a pill at the seat ("Dalje", or "Zove" + suit)
- "Na redu" panel in the middle of the table while the bots call
- The player's calling panel says who has already passed
- "X zove SRCE" announcement for 2.3 s before the first card; caller named under the trump coin

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:17:32 +01:00
TMCandClaude Opus 5.5 f71d7d0346 Release pipeline: build-release.ps1 and README for releases, icon and updates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:45:53 +01:00
TMCandClaude Opus 5.5 90acbcb4e6 Bela v0: local game against bots, counting training, settings with self-update
- engine: Croatian Bela rules (deal, trump call, declarations, play rules, scoring),
  heuristic bot, counting drill; unit tests and a 1000-game simulation
- app: Jetpack Compose table with partner and two bot opponents, Hungarian deck,
  card-counting training, settings with in-app update and a QR code for sharing
- tools: card import/render/upscale scripts and the launcher icon generator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 20:40:57 +01:00