๐ฅ Stark Brawl is an offline shooter where players face waves of enemies, using NFT characters on Starknet. The game integrates Dojo, an on-chain game engine in Cairo, allowing game mechanics to be managed in a decentralized way while remaining a fully local experience.
- Offline gameplay with no multiplayer or online requirements.
- Wave-based enemies with increasing difficulty.
- Starknet integration for NFT character ownership.
- Cairo + Dojo contracts to store player progression on-chain.
- Reward system with tokens for surviving more waves.
- 2D graphics with PixiJS/Phaser.js.
- Web3 wallet connection (Argent X, Braavos).
| Component | Technology |
|---|---|
| Frontend | React + Vite + TypeScript |
| Graphics | PixiJS or Phaser.js |
| Blockchain | Starknet + Cairo + Dojo |
| Local State | localStorage + IndexedDB |
| Contracts | Starknet.js + Dojo |
Ensure you have the following installed:
- Node.js (>= 16.x)
- npm or yarn
- Starknet Wallet Extension (Argent X or Braavos)
- Dojo CLI (to compile Cairo contracts)
curl -L https://install.dojoengine.org | bash
๐ฅ Clone the Repository
git clone https://github.com/youruser/stark-brawl.git
cd stark-brawl
๐ฆ Install Dependencies
npm install
# or
yarn install
๐ Run the Project
npm run dev
# or
yarn dev
Open http://localhost:3000/ in your browser to play.๐ Blockchain Implementation with Dojo This project uses Dojo to handle on-chain game logic on Starknet. The Cairo contracts store:
Ownership of characters as NFTs. Player progression (waves survived, rewards earned). Token system for upgrades and skins.
๐ Deploying Contracts with Dojo ๐๏ธ Compile Cairo Contracts cd contract dojo build
๐ Deploy to Starknet Testnet dojo deploy --network testnet
๐ Connect the Frontend to the Contracts Update contract addresses in client/src/blockchain/config.ts: export const CONTRACT_ADDRESS = "0xYOUR_CONTRACT"; export const NETWORK = "testnet";
๐ฎ How to Play Log in with your Starknet wallet. Select your NFT character. Survive waves of enemies and earn token rewards. Use tokens to upgrade skills or buy NFT skins.
๐ Project Structure
stark-brawl/
โโโ client/ # Frontend (React + Vite)
โ โโโ public/ # Static assets (images, sounds, etc.)
โ โโโ src/
โ โ โโโ assets/ # Game assets (sprites, animations, etc.)
โ โ โโโ components/ # UI Components (buttons, HUD, menus)
โ โ โโโ game/ # Game logic (PixiJS/Phaser.js)
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ blockchain/ # Starknet smart contract interactions
โ โ โโโ utils/ # Utility functions
โ โ โโโ styles/ # Global styles
โ โ โโโ App.tsx # Main React App
โ โ โโโ main.tsx # React root rendering
โ โ โโโ config.ts # Game configuration settings
โ โโโ index.html # Main HTML file
โ โโโ vite.config.ts # Vite configuration
โ โโโ package.json # Project dependencies
โ โโโ tsconfig.json # TypeScript configuration
โโโ contract/ # Smart Contracts (Cairo + Dojo)
โ โโโ src/
โ โ โโโ components/ # Dojo components (NFTs, Tokens, etc.)
โ โ โโโ systems/ # Game logic in Cairo
โ โ โโโ resources/ # Game state management
โ โโโ manifest.yaml # Dojo contract manifest
โ โโโ Scarb.toml # Scarb package manager config
โ โโโ Makefile # Automation scripts
โโโ .gitignore # Git ignored files
โโโ README.md # Project documentation
โโโ LICENSE # License file
# Initialize Dojo
sozo init
# Build the project
sozo build
# Run migrations (optional)
sozo migrate
# Start the project locally
sozo start
# Run tests
sozo test
# Clean previous builds
sozo clean
# Display help and available commands
sozo help๐ค Contributions If you want to contribute, fork the repository, create a new branch with your changes, and submit a pull request. git checkout -b my-new-feature git commit -m "Added new feature" git push origin my-new-feature
All contributions are welcome! ๐