_Protocol Pawns_ is your very first turn based fully on chain chess game. Try out the [dapp](https://near.org/chess-game.near/widget/ChessGameLobby)! Features: - play against an AI (3 difficulties) - PvP - ELO ranking, if [I-Am-Human](https://i-am-human.app/) verified Upcoming features: - gaming token backed by treasury - money matches ### FAQ #### How it works Turn based games are very well suited to run fully on chain. All game logic can be executed via WebAssembly (WASM) directly on the blockchain. The same is true for an AI that you can play against. I've been looking through [crates.io](https://crates.io) to see whether there are suitable chess engines written in Rust that I could use as a starting point. I found a [suitable one](https://github.com/adam-mcdaniel/chess-engine) so I forked it and added all the things necessary to store the game state on chain. The AI initially consumed too much gas on higher difficulties, so what I did was optimize it a little and prevent too much recursion in the algorithm. I also added some randomness. You can also challenge another player for a PvP match. If both you and the challenged player have an I-AM-HUMAN SBT, then you will also receive an ELO rating, which updates respectively once a game is finished. #### How will money matches work? You will be able to challenge another wallet for a game and attach any arbitrary amount of NEAR. The attached NEAR will be the price pool for that game and if the challenged wallet accepts, it also needs to attach the same amount of NEAR adding it as well to the price pool. If the challenger decides to cancel the game creation after sending funds he can do so as long as the challenged wallet hasn't accepted and he will receive a full refund. The price pool will be automatically distributed to the winner's wallet, but there is a 5% fee that will be moved to the smart contract's treasury. #### How does the treasury accrue value? The treasury will receive 5% of price pools from PvP money matches. It will also receive 50% of the burnt gas on every AI game transaction. On Near every transaction only burns 70% of the gas that it should have burnt. 30% will instead go to the executed smart contract's wallet as a developer incentive. Chess On Chain will share 50% of this gas incentive (resulting in 15% of total burnt gas) and move it to the treasury. #### How does the P2E token work? After winning a PvP or AI match some amount of fungible token (FT) will be minted and moved to the winner's wallet. The amount of minted FT still needs to be decided. The FT will be fully backed by the treasury. There will be a burning mechanism similar to Skyward Finance token where you can receive a share of the treasury for burning FT. This mechanism effectively gives the FT a lower bound for its value. The lower bound changes depending on token inflation/burn and treasury size. The received share of the treasury is based on the ratio of burnt tokens compared to circulating supply. _Example:_ - Circulating supply: 1k FT - burnt supply by user: 10 FT - burnt / circ = 1% => user receives 1% of NEAR in treasury There are also plans to introduce protocol owned liquidity. Additional utility for the FT yet needs to be decided. Possible solutions: - OG NFT mint with unlimited cap, but every mint increases future mint prices. Minting burns FT. - establishing partnerships with other NFT projects, where said NFT gives you an advantage. #### When? _Soon_. ----- _developed by [Mario](https://marior.near.social)_