- Import getActiveEquipmentSpells and getTotalDPS from computed-stats.ts instead of store.ts - Remove duplicate local function definition in SpireTab.tsx - Clean up unused imports
Mana Loop
An incremental/idle game about climbing a magical spire, mastering skills, and uncovering the secrets of an ancient tower.
Overview
Mana Loop is a browser-based incremental game where players gather mana, study skills and spells, climb the floors of a mysterious spire, and craft enchanted equipment. The game features a prestige system (Insight) that provides permanent progression bonuses across playthroughs.
The Game Loop
- Gather Mana - Click to collect mana or let it regenerate automatically
- Study Skills & Spells - Spend mana to learn new abilities and unlock upgrades
- Climb the Spire - Battle through floors, defeat guardians, and sign pacts for power
- Craft Equipment - Enchant your gear with powerful effects
- Prestige - Reset for Insight, gaining permanent bonuses
Features
Mana Gathering & Management
- Click-based mana collection with automatic regeneration
- Elemental mana system with five elements (Fire, Water, Earth, Air, Void)
- Mana conversion between raw and elemental forms
- Meditation system for boosted regeneration
Skill Progression with Tier Evolution
- 20+ skills across multiple categories (mana, combat, enchanting, familiar)
- 5-tier evolution system for each skill
- Milestone upgrades at levels 5 and 10 for each tier
- Unique special effects unlocked through skill upgrades
Equipment Crafting & Enchanting
- 3-stage enchantment process (Design → Prepare → Apply)
- Equipment capacity system limiting total enchantment power
- Enchantment effects including stat bonuses, multipliers, and spell grants
- Disenchanting to recover mana from unwanted enchantments
Combat System
- Cast speed-based spell casting
- Multi-spell support from equipped weapons
- Elemental damage bonuses and effectiveness
- Floor guardians with unique boons and pacts
Familiar System
- Collect and train magical companions
- Familiars provide passive bonuses and active abilities
- Growth and evolution mechanics
Floor Navigation & Guardian Battles
- Procedurally generated spire floors
- Elemental floor themes affecting combat
- Guardian bosses with unique mechanics
- Pact system for permanent power boosts
Prestige System (Insight)
- Reset progress for permanent bonuses
- Insight upgrades across multiple categories
- Signed pacts persist through prestige
Tech Stack
| Technology | Purpose |
|---|---|
| Next.js 16 | Full-stack framework with App Router |
| TypeScript 5 | Type-safe development |
| Tailwind CSS 4 | Utility-first styling |
| shadcn/ui | Reusable UI components |
| Zustand | Client state management with persistence |
| Prisma ORM | Database abstraction (SQLite) |
| Bun | JavaScript runtime and package manager |
Getting Started
Prerequisites
- Node.js 18+ or Bun runtime
- npm, yarn, or bun package manager
Installation
# Clone the repository
git clone git@gitea.tailf367e3.ts.net:Anexim/Mana-Loop.git
cd Mana-Loop
# Install dependencies
bun install
# or
npm install
# Set up the database
bun run db:push
# or
npm run db:push
Development
# Start the development server
bun run dev
# or
npm run dev
The game will be available at http://localhost:3000.
Other Commands
# Run linting
bun run lint
# Build for production
bun run build
# Start production server
bun run start
Project Structure
src/
├── app/
│ ├── page.tsx # Main game UI (single-page application)
│ ├── layout.tsx # Root layout with providers
│ └── api/ # API routes
├── components/
│ ├── ui/ # shadcn/ui components
│ └── game/ # Game-specific components
│ ├── tabs/ # Tab-based UI components
│ │ ├── CraftingTab.tsx
│ │ ├── LabTab.tsx
│ │ ├── SpellsTab.tsx
│ │ ├── SpireTab.tsx
│ │ └── FamiliarTab.tsx
│ ├── ManaDisplay.tsx
│ ├── TimeDisplay.tsx
│ ├── ActionButtons.tsx
│ └── ...
└── lib/
├── game/
│ ├── store.ts # Zustand store (state + actions)
│ ├── effects.ts # Unified effect computation
│ ├── upgrade-effects.ts # Skill upgrade definitions
│ ├── skill-evolution.ts # Tier progression paths
│ ├── constants.ts # Game data definitions
│ ├── computed-stats.ts # Stat calculation functions
│ ├── crafting-slice.ts # Equipment/enchantment actions
│ ├── familiar-slice.ts # Familiar system actions
│ ├── navigation-slice.ts # Floor navigation actions
│ ├── study-slice.ts # Study system actions
│ ├── types.ts # TypeScript interfaces
│ ├── formatting.ts # Display formatters
│ ├── utils.ts # Utility functions
│ └── data/
│ ├── equipment.ts # Equipment definitions
│ ├── enchantment-effects.ts # Enchantment catalog
│ ├── familiars.ts # Familiar definitions
│ ├── crafting-recipes.ts # Crafting recipes
│ ├── achievements.ts # Achievement definitions
│ └── loot-drops.ts # Loot drop tables
└── utils.ts # General utilities
For detailed architecture documentation, see AGENTS.md.
Game Systems Overview
Mana System
The core resource of the game. Mana is gathered manually or automatically and used for studying skills, casting spells, and crafting.
Key Files:
store.ts- Mana state and actionscomputed-stats.ts- Mana calculations
Skill System
Skills provide passive bonuses and unlock new abilities. Each skill can evolve through 5 tiers with milestone upgrades.
Key Files:
constants.ts- Skill definitions (SKILLS_DEF)skill-evolution.ts- Evolution paths and upgradesupgrade-effects.ts- Effect computation
Combat System
Combat uses a cast-speed system where each spell has a unique cast rate. Damage is calculated with skill bonuses, elemental modifiers, and special effects.
Key Files:
store.ts- Combat tick logicconstants.ts- Spell definitions (SPELLS_DEF)effects.ts- Damage calculations
Crafting System
A 3-stage enchantment system for equipment. Design effects, prepare equipment, and apply enchantments within capacity limits.
Key Files:
crafting-slice.ts- Crafting actionsdata/equipment.ts- Equipment typesdata/enchantment-effects.ts- Available effects
Familiar System
Magical companions that provide bonuses and can be trained and evolved.
Key Files:
familiar-slice.ts- Familiar actionsdata/familiars.ts- Familiar definitions
Prestige System
Reset progress for Insight, which provides permanent bonuses. Signed pacts persist through prestige.
Key Files:
store.ts- Prestige logicconstants.ts- Insight upgrades
Contributing
We welcome contributions! Please follow these guidelines:
Development Workflow
- Pull the latest changes before starting work
- Create a feature branch for your changes
- Follow existing patterns in the codebase
- Run linting before committing (
bun run lint) - Test your changes thoroughly
Code Style
- TypeScript throughout with strict typing
- Use existing shadcn/ui components over custom implementations
- Follow the slice pattern for store actions
- Keep components focused and extract to separate files when >50 lines
Adding New Features
For detailed patterns on adding new effects, skills, spells, or systems, see AGENTS.md.
License
This project is licensed under the MIT License.
MIT License
Copyright (c) 2024 Mana Loop
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Acknowledgments
Built with love using modern web technologies. Special thanks to the open-source community for the amazing tools that make this project possible.