Skip to content

JafetCHVDev/space-invaders-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Space Invaders Soroban

A classic Space Invaders game with on-chain state powered by Soroban smart contracts on the Stellar network.

Build Status Stellar License

🎮 Features

  • Play Space Invaders - Classic arcade gameplay in your browser
  • Zero Friction - No wallet installation or setup required
  • Embedded Wallet - Auto-generated wallet stored locally (testnet auto-funded)
  • On-chain Game State - Game logic runs on Stellar Soroban
  • ECS Architecture - Uses cougr-core Entity-Component-System framework
  • Premium UX - Modern dark theme with neon glow effects

📦 Tech Stack

Component Technology
Smart Contract Soroban (Rust) + cougr-core ECS
Frontend Vite + TypeScript
Wallet Embedded (auto-generated, localStorage)
Network Stellar Testnet (auto-funded)

🏗️ Project Structure

├── contracts/game/     # Soroban smart contract
│   └── src/
│       ├── lib.rs          # Contract entry points
│       ├── game_state.rs   # ECS components
│       └── test.rs         # Unit tests (13 tests)
├── frontend/           # Web game client
│   └── src/
│       ├── main.ts         # Entry point
│       ├── game.ts         # Game logic
│       ├── contract.ts     # Stellar SDK calls
│       └── styles.css      # Modern UI
├── scripts/            # Deployment & automation
│   ├── setup-repo.sh       # GitHub CLI setup
│   └── deploy-testnet.sh   # Testnet deployment
├── .github/workflows/  # CI/CD
│   └── ci.yml
└── docs/               # Documentation

🚀 Quick Start

Prerequisites

Setup

# Clone the repository
git clone https://github.com/JafetCHVDev/space-invaders-game.git
cd space-invaders-game

# Add wasm32 target
rustup target add wasm32-unknown-unknown

Run Contract Tests

cargo test

Build Contract

cargo build --target wasm32-unknown-unknown --release

Deploy to Testnet

# Setup identity (first time only)
stellar keys generate --global deployer --network testnet
stellar keys fund deployer --network testnet

# Deploy contract
./scripts/deploy-testnet.sh

Run Frontend

cd frontend
npm install
npm run dev

Open http://localhost:5173

🎯 Contract API

Game Functions

Function Parameters Description
init_game - Initialize new game
move_ship direction: i32 Move ship (-1=left, 1=right)
shoot - Fire bullet
update_tick - Advance game state

Query Functions

Function Returns Description
get_score u32 Current score
get_lives u32 Remaining lives
get_ship_position i32 Ship X position
get_active_invaders u32 Invader count
check_game_over bool Game over status

🎮 Game Controls

Key Action
Move left
Move right
Space Shoot

✅ MVP Checklist

  • Contract: Player ship movement
  • Contract: Shooting mechanics
  • Contract: Invader grid with types (Squid, Crab, Octopus)
  • Contract: Collision detection
  • Contract: Score tracking by invader type
  • Contract: Lives and game over
  • Contract: 13 unit tests
  • Frontend: Canvas game rendering
  • Frontend: Keyboard controls
  • Frontend: Wallet integration (in progress)
  • Frontend: Contract calls

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing)
  5. Open a Pull Request

Setup GitHub Labels & Issues

# After configuring gh cli
./scripts/setup-repo.sh

📄 License

MIT License - see LICENSE


Built with 💜 for the Stellar ecosystem

About

Space invaders game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors