A terminal-based Dungeons & Dragons (D&D) adventure game built with React and Ink. The application provides an interactive CLI interface for a simple combat game where players create characters and engage in battles against enemies.
- Character Creation: Create and customize your character with a name
- Turn-based Combat: Engage in battles with enemies
- Visual Terminal UI: Rich terminal interface using Ink (React for terminals)
- Chinese Localization: Fully localized in Chinese
- Cross-platform: Builds available for Windows, macOS, and Linux
- Self-contained Executables: Single-file executables with no external dependencies
- Runtime Environment: Bun (primary) / Node.js
- Framework: React (v18.3.1) with Ink for terminal UI
- Language: TypeScript
- Build System: Bun with esbuild
- UI Library: Ink (React-based terminal UI framework)
- Input Handling: ink-text-input for character creation
- Bun (recommended) or Node.js with npm
# Clone the repository
git clone <repository-url>
# Navigate to project directory
cd dnd_cli
# Install dependencies
bun install
# or if using npm: npm install
# Run in development mode
bun run dev# Build for Linux/macOS (executables placed in build/ directory)
bun run build
# Build for Windows
bun run build:win
# Build for macOS specifically
bun run build:macAfter building:
- Linux/macOS:
./build/dnd - Windows:
./build/dnd.exe(in the build directory)
Or install globally:
npm link # or bun link if using bunThen run with dnd command anywhere.
- Players start with 100 HP, 15 attack, and 5 defense
- Enemies (currently only Goblins) have 50 HP, 10 attack, and 3 defense
- Player attacks by pressing 'A' key during their turn
- Damage calculation: max(attack - opponent.defense, 1)
- 20% chance for critical hits that deal double damage
- Turn alternates between player and enemy automatically
src/
├── CharacterCreation.tsx # Handles character creation
├── Combat.tsx # Manages battle mechanics
├── Game.tsx # Main game controller
├── index.tsx # Entry point
└── types.ts # Type definitions
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.

