streetmesh / chess-2d
The first StreetMesh Experience.
Package info
Language:Blade
pkg:composer/streetmesh/chess-2d
Requires
- php: ^8.3
- bacon/bacon-qr-code: ^3.1
- illuminate/support: ^12.0|^13.0
- livewire/flux: ^2.13
- livewire/livewire: ^4.1
- streetmesh/laravel: ^0.1
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.18
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^11.4
README
Chess2D
Chess as a StreetMesh venue experience — and the first thing to use the framework rather than be it.
Two people who live on different servers play a game, and each of them ends up holding their own verifiable record of it. That sentence is the whole of v0, and this package is the part of it that is actually chess.
Installing it
composer require streetmesh/chess-2d npm install colyseus.js@^0.16
The second line is not optional and is not something this package can do for
itself. The board talks to its room over Colyseus, and a Composer package cannot
install a Node dependency — so it declares what its browser code imports, under
extra.streetmesh.npm, and the venue installs it.
Miss it and the build fails on an unresolved import naming a file in vendor/,
which says nothing about a PHP package wanting it. A venue on
streetmesh/laravel v0.1.2 or later says so plainly instead, before Vite ever
reaches the import.
Restart Vite afterwards. It reads what packages declare when it starts.
What an experience turns out to be
Everything hard is asked for rather than built. Arriving from another server,
being seated, a room with an authoritative referee, a signed record at the end —
all of that belongs to Laravel and
Hub.
What is left is three things:
room/src/room.ts |
The rules, enforced where a browser cannot argue with them. |
resources/views/livewire/ |
The screens: a lobby, and a board. |
src/Games.php |
What a finished game is worth writing down. |
The rules exist once. They are in the hub and nowhere else — the board draws what the room reports and asks for what somebody clicked, and PHP never learns how a knight moves. Two implementations of the rules would be two chances to disagree about who won.
The record
Each player gets their own, signed by the venue, written into the store they chose to live on. Separate records rather than one shared one, because there is no shared place for one to live: the players are on different servers, and after tonight this venue may not exist.
Written from each player's point of view — result: win rather than
winner: white — because it is their record of a thing that happened to them
rather than a row in somebody's database. It carries the moves, the final
position, and how it ended, since "checkmate" and "the other player left" are
different stories about the same result.
A player whose server refuses is skipped rather than failing the other. Somebody having withdrawn permission is an ordinary answer, and their opponent should still get their record.
Where this fits
| Where | What it is |
|---|---|
| Glossary | Every term here in plain words — venue, ticket, attestation, gathering. Start here if any of the above was unfamiliar. |
Protocol |
What StreetMesh is. |
Laravel |
The venue this sits on: the door, and who is at which table. |
Hub |
The rooms this puts rules into. |
Server |
Where to start if you want to run one. |
License
MIT.