> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Solana Game Development Examples

> Open source games, tools, and guides for building games on Solana, with live demos you can play.

These games, tools, and guides show how common game features work on Solana,
from moving a player onchain to hiding game state and running real-time
multiplayer games. Looking at these examples and seeing how certain features
are implemented can vastly improve your development speed. Many of the
community games below use Anchor versions before 1.0, so their entries link to
live demos.

## Moving a player onchain

Tiny adventure is a simple example of moving a player left and right onchain
with the Anchor framework and a TypeScript client.

- [Tutorial Guide](/developers/cookbook/games/hello-world)

## Saving SOL in a PDA

Learn how to save SOL in a PDA seed vault and send it back to a player. This
backend is written in Anchor, and the guide plays the game from a TypeScript
client.

- [Tutorial Guide](/developers/cookbook/games/store-sol-in-pda)

## Use Solana Pay QR codes to control a game

Solana Pay transaction requests can not only be used for payments but for
signing any transactions on a phone wallet or a link, including for games. Tug
of war is a multiplayer game which can be player with many people on a big
screen, using Solana Pay QR codes to pull the rope one way or the other, which
in turn changes data in an account. The rewards will be payed out to the team
that manages to the rope pull completely to one side. The backend is Anchor and
the frontend is React.js and Next.js 13.

- [Live version on devnet](https://tug-of-war-solana-pay.vercel.app/?network=devnet)

## How to build a round-based multiplayer game

A simple multiplayer tic tac toe game written with MagicBlock Bolt, an entity
component system built on Anchor.

- [Magic Block Bolt Tic Tac Toe](https://github.com/magicblock-labs/bolt-tic-tac-toe)

## Onchain Chess

Complete onchain playable chess game written in Anchor with a 3D Unity
implementation. Send someone a link to start a game.

[Play](https://magicblock-labs.github.io/Solana-Unity-Chess/)

## Entity component system examples

### MagicBlock Bolt

MagicBlock Bolt is an onchain entity component system. MagicBlock is also  
working on an ephemeral rollup system for super fast transactions.

- [Bolt Source](https://github.com/magicblock-labs/bolt)

## Hide game state from other players

Hiding data onchain is difficult because all accounts, including data accounts,
are public and can be read by anyone. There are some solutions to the problem
though.

### Light protocol

Light protocol is a ZK layer solution on Solana that lets you built on Solana  
with ZK compression, a new primitive that enables the secure scaling of state
directly on the L1.

- [Source](https://github.com/Lightprotocol/light-protocol)
- [Website](https://lightprotocol.com/)

### Race Protocol

Race protocol is building an onchain poker game and have two solutions for  
hiding data. One is server-based and one relies on players sending encrypted  
data to each other.

[Source](https://github.com/RACE-Game)

## Real-time pvp onchain game

### Solana Civ

A Civilization-style game where you can build cities, trade with other players,
and fight wars. Progress through the ages by unlocking new technologies, conquer
lands, and build a civilization that will stand the test of time. All open source
and crowd-built by the Solana community, through gib.work.

- [Website](https://solciv.com/)
- [Participate](https://gib.work)

### Seven Seas

Seven Seas is a real-time Solana Battle Royale game. Using an Anchor program,
the UnitySDK, and WebSocket account subscriptions. Players can spawn their ships
represented as NFTs on a grid and move around. If a player hits another player
or chest he collect its SOL and some Pirate Coin SPL tokens. The grid is
implemented as a two dimensional array where every tile saves the players wallet
key and the NFT public key. There is also a QR code in the top left corner that
triggers a Solana Pay transaction request, which players can sign on their
phones, to let Cthulhu shoot at the closest ship.

- [Example](https://solplay.de/sevenseas)

## Tale of Kentridge

This is a game built with the Turbo game engine.
[Turbo](https://turbo.computer/) is a from the ground up freshly written Rust
game engine which focuses on lightweight architecture and fast iteration times
always with Solana in mind. It is beginner friendly and comes with full Solana
RPC support. You can even use its AI tools to generate complete games.

- [Example games](https://github.com/super-turbo-society/turbo-demos)
- [Docs](https://docs.turbo.computer/learn/getting-started/)

## Roguelike game

A game where you can explore a cave and find treasures. The game is written in
Anchor and the frontend is a Unity client. You progress through a cave from
level 0 to 100 to fight the ultimate enemy. Every time you die you start again
from level 1. There are chests that offer items and resources and the items from
blue chests can be kept for the next run. A special feature is that a floor can
be owned by a certain player and when you pass that floor you either need to
fight that player or pay a little fee to be able to pass.

- [Devnet example](https://solplay.de/ancientcave/)

## Onchain city builder example

This example shows you how you can build an onchain city builder. The special
feature is that it is a competitive but also cooperative city builder since all
resources are shared between the players, but depending if you build your
buildings on the left or the right you either support the goblins or the humans.

- [Devnet example](https://solplay.de/humansandgoblins/)

## Onchain Matchmaking

A multiplayer match three game which uses NFT stats for the character stats in
the game and has an interesting onchain matchmaking system.

- [Live Version](https://deezquest.vercel.app/)
