fightbook 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +238 -0
- package/dist/assets/index-C-_XA-_f.js +357 -0
- package/dist/assets/index-DDAi7vIJ.css +1 -0
- package/dist/cli.js +171 -0
- package/dist/cli.js.map +7 -0
- package/dist/engine/FightEngine.js +605 -0
- package/dist/engine/FightEngine.js.map +7 -0
- package/dist/favicon.ico +0 -0
- package/dist/hero-logo.png +0 -0
- package/dist/index.html +33 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +7 -0
- package/dist/placeholder.svg +1 -0
- package/dist/robots.txt +14 -0
- package/dist/types/agent.js +425 -0
- package/dist/types/agent.js.map +7 -0
- package/dist/types/fight.js +71 -0
- package/dist/types/fight.js.map +7 -0
- package/package.json +131 -0
package/README.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# FightBook 🥊
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/fightbook)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
**AI Combat Arena** — Configure fighters with skills.md, simulate MMA combat in real-time.
|
|
7
|
+
|
|
8
|
+
🔗 **Live Demo**: https://fightbook.xyz
|
|
9
|
+
🐦 **Twitter**: [@fightbookxyz](https://x.com/fightbookxyz)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## What is FightBook?
|
|
14
|
+
|
|
15
|
+
FightBook is a real-time AI combat simulation platform. Create fighters using `skills.md` configuration files and watch them battle with authentic MMA techniques.
|
|
16
|
+
|
|
17
|
+
- **3-minute rounds** with real-time play-by-play
|
|
18
|
+
- **25+ configurable attributes** (striking, grappling, cardio, fight IQ)
|
|
19
|
+
- **Point budget system** — every choice matters (like FIFA player creation)
|
|
20
|
+
- **Position-based combat** — standing → clinch → ground
|
|
21
|
+
- **skills.md format** — compatible with the AI agent meta
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install fightbook
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or use globally for CLI:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -g fightbook
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## CLI Usage
|
|
40
|
+
|
|
41
|
+
### Create a new fighter
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
fightbook init my-fighter
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This creates `my-fighter.md` with a template you can edit.
|
|
48
|
+
|
|
49
|
+
### Validate a skills.md file
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
fightbook validate ./my-fighter.md
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Run a fight
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
fightbook fight ./agent1.md ./agent2.md
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Watch the combat unfold in real-time!
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## JavaScript/TypeScript API
|
|
66
|
+
|
|
67
|
+
### Basic Usage
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { FightEngine, parseSkillsMd, createNewAgent } from 'fightbook';
|
|
71
|
+
|
|
72
|
+
// Parse skills from markdown
|
|
73
|
+
const skills = parseSkillsMd(`
|
|
74
|
+
name: "Knockout King"
|
|
75
|
+
nickname: "The Destroyer"
|
|
76
|
+
|
|
77
|
+
striking: 85
|
|
78
|
+
wrestling: 40
|
|
79
|
+
submissions: 30
|
|
80
|
+
cardio: 70
|
|
81
|
+
chin: 75
|
|
82
|
+
aggression: 0.85
|
|
83
|
+
`);
|
|
84
|
+
|
|
85
|
+
// Create agents
|
|
86
|
+
const agent1 = createNewAgent('Agent 1');
|
|
87
|
+
const agent2 = createNewAgent('Agent 2');
|
|
88
|
+
|
|
89
|
+
// Run fight
|
|
90
|
+
const engine = new FightEngine(agent1, agent2, {
|
|
91
|
+
onAction: (action) => {
|
|
92
|
+
console.log(`${action.description} (${action.damage} damage)`);
|
|
93
|
+
},
|
|
94
|
+
onRoundEnd: (round) => {
|
|
95
|
+
console.log(`End of round ${round.round}`);
|
|
96
|
+
},
|
|
97
|
+
onFightEnd: (fight) => {
|
|
98
|
+
console.log(`Winner: ${fight.winner} by ${fight.method}`);
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
engine.start();
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Point Budget System
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import {
|
|
109
|
+
calculatePointsRemaining,
|
|
110
|
+
getBudgetStatus,
|
|
111
|
+
validateSkillsBudget,
|
|
112
|
+
POINT_BUDGET
|
|
113
|
+
} from 'fightbook';
|
|
114
|
+
|
|
115
|
+
// Check remaining points
|
|
116
|
+
const remaining = calculatePointsRemaining(skills);
|
|
117
|
+
console.log(`${remaining} / ${POINT_BUDGET.TOTAL} points remaining`);
|
|
118
|
+
|
|
119
|
+
// Get budget status with color coding
|
|
120
|
+
const status = getBudgetStatus(skills);
|
|
121
|
+
console.log(status.status); // 'Balanced' | 'Medium' | 'High' | 'Maxed'
|
|
122
|
+
|
|
123
|
+
// Validate configuration
|
|
124
|
+
const validation = validateSkillsBudget(skills);
|
|
125
|
+
if (!validation.valid) {
|
|
126
|
+
console.error(validation.errors);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Types
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import type {
|
|
134
|
+
SkillsMdConfig,
|
|
135
|
+
CompleteAgent,
|
|
136
|
+
FightState,
|
|
137
|
+
FightAction
|
|
138
|
+
} from 'fightbook';
|
|
139
|
+
|
|
140
|
+
// All types are fully exported
|
|
141
|
+
const config: SkillsMdConfig = {
|
|
142
|
+
name: 'My Fighter',
|
|
143
|
+
striking: 80,
|
|
144
|
+
wrestling: 60,
|
|
145
|
+
// ... 25+ attributes
|
|
146
|
+
};
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## skills.md Format
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
# Identity
|
|
155
|
+
name: "Iron Fist"
|
|
156
|
+
nickname: "The Punisher"
|
|
157
|
+
|
|
158
|
+
# Striking (0-100)
|
|
159
|
+
striking: 85 # Punch/kick power
|
|
160
|
+
punch_speed: 80 # Hand speed
|
|
161
|
+
kick_power: 75 # Leg kicks
|
|
162
|
+
head_movement: 70 # Defense
|
|
163
|
+
footwork: 72
|
|
164
|
+
combinations: 75 # Chain strikes
|
|
165
|
+
|
|
166
|
+
# Grappling (0-100)
|
|
167
|
+
wrestling: 65 # Takedowns
|
|
168
|
+
takedown_defense: 70 # Sprawl
|
|
169
|
+
clinch_control: 60
|
|
170
|
+
submissions: 55 # Chokes/joints
|
|
171
|
+
submission_defense: 65
|
|
172
|
+
|
|
173
|
+
# Physical (0-100)
|
|
174
|
+
cardio: 75 # Stamina
|
|
175
|
+
chin: 80 # Damage resistance
|
|
176
|
+
recovery: 70 # Between rounds
|
|
177
|
+
|
|
178
|
+
# Mental (0-100, free stats)
|
|
179
|
+
fight_iq: 70 # Smart decisions
|
|
180
|
+
heart: 75 # Comeback factor
|
|
181
|
+
aggression: 0.75 # 0.0 - 1.0
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Features
|
|
187
|
+
|
|
188
|
+
### Combat Engine
|
|
189
|
+
- **40+ MMA techniques**: jabs, hooks, leg kicks, takedowns, submissions, ground & pound
|
|
190
|
+
- **Real-time simulation**: 3-minute rounds with authentic timing
|
|
191
|
+
- **Position system**: Standing → Clinch → Ground (top/bottom)
|
|
192
|
+
- **Victory conditions**: KO, TKO, Submission, Decision
|
|
193
|
+
|
|
194
|
+
### Fighter Progression
|
|
195
|
+
- XP and leveling system
|
|
196
|
+
- ELO-style rankings
|
|
197
|
+
- Win/loss records with streaks
|
|
198
|
+
- KO and submission counters
|
|
199
|
+
|
|
200
|
+
### Technical
|
|
201
|
+
- TypeScript-first
|
|
202
|
+
- Modular architecture
|
|
203
|
+
- Headless fight engine (works in Node/browser)
|
|
204
|
+
- Zero external dependencies for core engine
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Development
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# Clone repo
|
|
212
|
+
git clone https://github.com/resided/fightbook.git
|
|
213
|
+
cd fightbook
|
|
214
|
+
|
|
215
|
+
# Install dependencies
|
|
216
|
+
npm install
|
|
217
|
+
|
|
218
|
+
# Run dev server
|
|
219
|
+
npm run dev
|
|
220
|
+
|
|
221
|
+
# Build library
|
|
222
|
+
npm run build:lib
|
|
223
|
+
|
|
224
|
+
# Run tests
|
|
225
|
+
npm test
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Contributing
|
|
231
|
+
|
|
232
|
+
PRs welcome! See [GitHub Issues](https://github.com/resided/fightbook/issues) for ideas.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## License
|
|
237
|
+
|
|
238
|
+
MIT © FightBook
|