games: the word you owe the table, and the hand you were already holding
Three things, and the first one was a bug. Your own hand didn't move until the lap ended. bump() keeps the bots' fans honest and has always refused seat zero, and nothing else touched yours — so a +4 landing on you at the top of a lap put four backs into your hand and then nothing, and the cards themselves turned up seconds later when the script finished and paint() finally ran. You spent the whole lap looking at a hand you no longer held. The engine now stamps your hand onto every event that changes it (Event.Hand, seat zero only, which is the one hand the browser is already entitled to see) and the table redraws as the cards land. Measured in the running app: 2 -> 3 cards at 414ms into a 1791ms lap. You couldn't call UNO, and not because the button was missing: going down to one card *was* the call. discard() fired the uno event by itself, which made it a thing that happened to you rather than a thing you did, and a rule nobody can fail is not a rule. So now you say it or you don't (Move.Uno), and if you don't, every bot still in the game gets one look at you before any of them plays — because a bot that has moved on is a bot that has stopped watching your hand. It runs the other way too, and that half is the fun one: a bot forgets often enough to be worth watching for, and when it does it says *nothing*. No event, no badge, no tell on the felt except the count beside its fan reading "1 card". Catch it and it takes two; call a seat that had nothing to hide and you take two yourself, which is what stops the catch button from being a thing you simply mash. Which cards owe the call is the engine's answer, not a count of your hand: No Mercy's "discard all" takes every card of its colour with it, so a six-card hand can land on one, and a browser subtracting one from six walks you into a catch it never warned you about. And the room was silent. Every sound in here is *made* — an oscillator, a burst of filtered noise, an envelope — the same bargain the weather engine takes with its clouds. A card is a slap of noise through a bandpass, a chip is two detuned sines with a knock on the front, a win is four notes going up. No asset files, no round trips, and a sound can be pitched and detuned per call instead of being the same wav three hundred times. Hooked into the FX layer rather than into the games, so every table that throws a chip or turns a card got it at once. The multiples moved, and the test that exists to catch that caught it. The naive strategy now calls UNO, because calling is a button and not a strategy — what these tiers price is bad card play, not a player who ignores the felt shouting at them — and on that footing the normal tables come back to where they were (40.1 / 28.5 / 23.1). No Mercy Full House did not: it was paying a *negative* house edge, which is the house paying you to sit down. Re-priced 3.8 -> 3.5. Claude-Session: https://claude.ai/code/session_013M5nD7PgUboJXoDcYHzpuJ
This commit is contained in:
@@ -18,6 +18,14 @@
|
||||
var reduced =
|
||||
window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
|
||||
// The room's noise, if it's loaded. Everything that flies through this file
|
||||
// makes a sound when it lands, which is how every table got sound at once
|
||||
// without any of them being told about it: a chip is a chip wherever it's
|
||||
// thrown from. A game that wants something more specific says so per call.
|
||||
function sfx(name, opts) {
|
||||
if (window.PeteSFX) window.PeteSFX.play(name, opts);
|
||||
}
|
||||
|
||||
var layer = null;
|
||||
function stage() {
|
||||
if (!layer) {
|
||||
@@ -107,13 +115,23 @@
|
||||
// than averaging itself back down to nothing.
|
||||
var sMid = Math.max(s0, s1) * 1.12;
|
||||
|
||||
var wait = reduced ? 0 : opts.delay || 0;
|
||||
|
||||
// It makes a noise when it lands, and the noise is scheduled on the audio
|
||||
// clock for the moment it lands — not fired by a timer that goes off when the
|
||||
// animation ends. A timer that drifts thirty milliseconds is a card you hear
|
||||
// before you see, and that is worse than silence.
|
||||
if (opts.sound) {
|
||||
sfx(opts.sound, { delay: (wait + dur) / 1000, v: opts.index || 0 });
|
||||
}
|
||||
|
||||
var anim = node.animate(
|
||||
[
|
||||
{ transform: t(a.x, a.y, s0, opts.fromSpin || 0), opacity: 1, offset: 0 },
|
||||
{ transform: t(midX, midY, sMid, spin * 0.6), opacity: 1, offset: 0.5 },
|
||||
{ transform: t(b.x, b.y, s1, spin), opacity: opts.fade ? 0 : 1, offset: 1 },
|
||||
],
|
||||
{ duration: dur, easing: "cubic-bezier(0.33, 0, 0.25, 1)", delay: reduced ? 0 : opts.delay || 0, fill: "both" }
|
||||
{ duration: dur, easing: "cubic-bezier(0.33, 0, 0.25, 1)", delay: wait, fill: "both" }
|
||||
);
|
||||
|
||||
return anim.finished
|
||||
@@ -127,6 +145,9 @@
|
||||
// was — UNO wanted the same throw with a card in it, so the throw moved out.
|
||||
function fly(from, to, opts) {
|
||||
opts = opts || {};
|
||||
// A chip clinks. Every table in the room bets, pays and sweeps through this
|
||||
// one function, so saying it once here is every table having chip sounds.
|
||||
if (opts.sound === undefined) opts = Object.assign({ sound: "chip" }, opts);
|
||||
return flyNode(disc(opts.denom || 25), from, to, opts);
|
||||
}
|
||||
|
||||
@@ -225,6 +246,7 @@
|
||||
var n = amount == null ? api.amount : amount;
|
||||
var left = api.amount - n;
|
||||
if (n <= 0) return Promise.resolve();
|
||||
sfx("sweep"); // the pile leaving the felt, under the chips landing
|
||||
var chain = flyMany(els.spot, to, chipsFor(n, 8), Object.assign({ gap: 40, lift: 0.8 }, opts || {}));
|
||||
api.render(left > 0 ? left : 0);
|
||||
return chain;
|
||||
@@ -233,8 +255,10 @@
|
||||
return api;
|
||||
}
|
||||
|
||||
// burst: confetti out of a point. Saved for the things worth celebrating.
|
||||
// burst: confetti out of a point. Saved for the things worth celebrating — so
|
||||
// it is also, everywhere in the room, the sound of winning.
|
||||
function burst(target, opts) {
|
||||
sfx("win"); // before the reduced-motion bail: no confetti still deserves the fanfare
|
||||
if (reduced) return Promise.resolve();
|
||||
opts = opts || {};
|
||||
var c = centre(target);
|
||||
@@ -326,6 +350,7 @@
|
||||
|
||||
window.PeteFX = {
|
||||
reduced: reduced,
|
||||
sfx: sfx, // so a table can make a noise without reaching past this file
|
||||
chipsFor: chipsFor,
|
||||
disc: disc,
|
||||
jitter: jitter,
|
||||
|
||||
Reference in New Issue
Block a user