Skip to content

gamv-io/sample-strategy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gamvio Sample: Strategy & Puzzle Games

5 strategy and puzzle games built with the Gamvio Game SDK — deeper gameplay, same simple integration.

Next.js 15 React 19 TypeScript Gamvio SDK License: MIT

Live Demo · SDK Docs · Developer Portal


Game Showcase

Game Description Highlights
:castle: Tower Defense Command the battlefield across 15 increasingly brutal waves. Place and upgrade 4 tower types (Cannon, Tesla, Frost, Missile) to hold the line against 5 enemy types — from swarm runners to armored bosses. Every tower placement is a strategic decision. 15 waves, 4 towers, 5 enemies, upgrade paths, boss wave
♟️ Shadow Chess Chess reimagined with fog of war. You can only see squares near your own pieces — the rest of the board is shrouded in darkness. Follows full FIDE chess rules, but information is power. Blunders feel different when you can't see them coming. Fog of war, full chess rules, visibility radius, AI opponent
🦠 Infection A territory-control strategy game on a hex grid. Clone to adjacent cells or jump two spaces to convert enemy cells. Simple rules, deep emergent strategy. Capture the majority of the board to win. Hex grid, clone & jump mechanics, AI difficulty levels, territory scoring
⚗️ Merge Lab An alchemy-style discovery puzzle. Start with 4 base elements and combine pairs to discover new ones. 50+ elements to find, each with its own recipe. How many can you unlock? Scores are based on discovery count and speed. 50+ discoverable elements, drag-and-drop combining, discovery journal, timed mode
🕳️ Portal Maze Navigate procedurally generated mazes where teleport portals link distant rooms. Step into a portal and emerge somewhere unexpected. Find the exit in the fewest moves possible — the leaderboard rewards efficiency. Procedural generation, portal teleportation, move counter, increasing maze size

Quick Start

git clone https://github.com/gamv-io/sample-strategy.git
cd sample-strategy
cp .env.example .env.local   # Add your SDK keys from dev.gamv.io
npm install
npm run dev                   # Open http://localhost:3200

Five games, running locally in under a minute.

Test Mode

When running on localhost, the SDK automatically activates test mode:

  • No platform login required — a test player token is issued automatically
  • Scores are submitted to a sandboxed leaderboard (not production)
  • Session HMAC signing works identically to production
  • Perfect for development, QA, and demos

To connect to the real platform, deploy your build and configure production API keys.

SDK Integration

Every game follows the same integration pattern using Next.js Server Actions — your secrets never leave the server.

games/
├── tower-defense/
│   ├── tower-defense-game.tsx  ← Client component (game logic + rendering)
│   └── actions.ts              ← Server actions (SDK calls)
├── shadow-chess/
│   └── ...
└── registry.ts                 ← Game metadata registry

How It Works

  1. lib/gamvio.ts — Shared server-side SDK setup. Creates a GameServer instance with your API credentials. Secrets stay server-side.

  2. games/*/actions.ts — Each game exports server actions wrapping SDK methods:

    • startGameSession() — Begin a scored session with HMAC anti-cheat
    • submitScore() — Server-signed score submission (tamper-proof)
    • resolveGameId() — Multi-game slug resolution
  3. games/*/[game]-game.tsx — Client-side game component calling server actions directly.

// Example: submitting a Tower Defense score with rich metadata
import { submitScore } from './actions';

async function handleVictory(score: number) {
  await submitScore(accessToken, sessionId, hmacKey, score, {
    wavesCleared: 15,
    towersBuilt: 12,
    perfectWaves: 3,
  });
}

Key Features

Feature How
Anti-cheat HMAC-signed sessions — scores are cryptographically verified server-side
Leaderboards Global rankings with game-specific metadata (waves cleared, moves taken, etc.)
Multi-game Single project hosts 5 games — each resolved by slug via resolveGameId()
Zero client secrets All SDK calls run in Server Actions — nothing sensitive reaches the browser
Rich metadata Submit structured game data alongside scores for detailed leaderboard views

Tech Stack

Layer Technology
Framework Next.js 15 (App Router)
UI React 19 + TypeScript 5.7
Game SDK @gamvio/game-sdk
Rendering Canvas API / React components (per game)
Server Logic Next.js Server Actions ('use server')

Project Structure

sample-strategy/
├── app/                    # Next.js App Router pages
├── games/
│   ├── tower-defense/      # Each game is self-contained
│   ├── shadow-chess/
│   ├── infection/
│   ├── merge-lab/
│   ├── portal-maze/
│   └── registry.ts         # Game metadata & routing
├── lib/
│   └── gamvio.ts           # Shared SDK server setup
├── public/                 # Static assets
├── .env.example            # Required env vars template
└── package.json

Links

License

MIT -- see LICENSE for details.


Built with Gamvio -- the Web3 game platform for developers who ship.

About

Sample strategy & puzzle games built with @gamvio/game-sdk — Tower Defense, Shadow Chess, Infection, Merge Lab, Portal Maze

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors