Simultaneous chess on an infinite onchain board. Stake an army, capture kings, betray your allies.
Infinite Gambit is chess rebuilt for a persistent, permissionless world. Anyone can stake ETH (or any token) to deploy an army (a king and nineteen pieces) at a spawn point they choose in secret. Every cycle, every army moves up to three of its pieces, committed as a hash and then revealed together, and all moves resolve simultaneously against the board as it was at the start of the cycle.
Plain chess cannot survive that: it is sequential, two-player, ends at checkmate and is 8 by 8. So the rules change. A piece that moves away dodges the capture aimed at it. Two pieces that swap squares both complete their moves. Two pieces arriving on one square both die, while a piece that stayed put falls to a single arriver. Checkmate means nothing: you have to actually capture a king, and when you do you take its whole stake, its army vanishes from the board, and the piece that took it becomes a queen. Moving three pieces at once is what stops a lone attacker from chasing a king forever: the king steps away while another of its pieces lands on the square it left, and the attacker dies there with it. To take winnings home you bring your king to an exit square. Miss a reveal and your army freezes forever.
Staked two-player chess does not really play well onchain, because engines beat humans and nobody stakes against them. With unbounded players and hidden simultaneous moves, the game becomes social as well as tactical: armies can ally against a third, but nothing forces them to keep the promise, so every cycle is a small prisoner's dilemma.
The core technical rule is that the order in which reveals land onchain never decides anything, and most of the design follows from it. The same rules also run fully offline on a chain inside the browser, for hotseat and single-player play.
The game is based on a template : https://github.com/wighawag/template-commit-reveal that bring Solidity, Hardhat v3, Hardhat-deploy v2 along with a commit-reveal setup that include offline play (using an embedded evm and indexer running in your browser)
The main challenge for making the game of chess work on an infinite board with no bound to the number of players was due to the simultaneous nature of commit+reveal scheme, that require order-independent resolution.
So it was more a game-design challenge than anything. For example if 2 units move to the same destination, what should happen? (I chose to have them both dead, with special rule for kings). What about 2 piece swaping space or moving on the way of another. I decided that it goes through to not have to track to many thing onchain (storage is expansive, and each reveal come in a different transaction)
What I also did (thanks again to webevm) is to not replicate logic of solidity in typescript, instead when I needed to compute the expected outcome in the client, I executed eth_call right in the browser. One good advantage of it is that it does not reveal what data you are interested to fetch, which you need for your move to remain secret, a crucial element for a game like this.
I used AI to help us implement the spec we needed. It was a conversation where AI could see many of the potential issue but was left wondering what to do. And while we could get a version working quite quickly, the game design issue mentioned above became aparent and fix them. We also spent the last hours to polish the visuals.
One annoying thing I left for later is the spawning mechanism that let someone technically use multi account to prevent anyone from spawning. I intend to fix with an auction mechanism later

