EngageFabric provides a complete game economy system that you can customize for your application.
Experience Points (XP)
XP is the primary measure of player progress. Players earn XP by completing actions, and XP accumulates toward level progression.
Awarding XP
XP can be awarded through:
- Rules Engine: Automatically via event triggers
- API: Direct XP grants for custom logic
// Via Rules Engine (automatic)
await client.events.track({
playerId: 'player-123',
name: 'lesson_completed',
properties: { courseId: 'math-101' }
});
// Rule: "lesson_completed" → Grant 100 XP
// Via API (manual)
await client.players.grantXP('player-123', {
amount: 100,
reason: 'bonus_reward'
});
Levels
Levels represent milestones in player progression. Configure how players level up with level curves.
Level Curve Types
Linear
Exponential
Custom Table
XP required increases by a fixed amount per level.Level 1: 100 XP
Level 2: 200 XP
Level 3: 300 XP
...
Formula: xpRequired = baseXP * level
Level-Up Events
When a player levels up, EngageFabric:
- Emits a
level_up WebSocket event
- Can trigger rules for level-up rewards
- Updates the player’s level in the database
// Subscribe to level-up events
socket.on('level_up', (data) => {
console.log(`Player reached level ${data.newLevel}!`);
showLevelUpAnimation();
});
Currencies
Support multiple virtual currencies for different purposes.
Currency Types
| Type | Example | Use Case |
|---|
| Soft Currency | Coins, Gold | Earned through gameplay |
| Hard Currency | Gems, Diamonds | Premium/purchased |
| Event Currency | Event Tokens | Limited-time events |
Managing Currencies
// Grant currency
await client.players.grantCurrency('player-123', {
currencyId: 'coins',
amount: 500
});
// Spend currency
await client.players.spendCurrency('player-123', {
currencyId: 'coins',
amount: 100
});
// Get balances
const player = await client.players.get('player-123');
console.log(player.currencies);
// { coins: 400, gems: 50 }
Lives / Energy
Implement session-limiting mechanics with the lives system.
Configuration
| Setting | Description |
|---|
maxLives | Maximum lives a player can have |
regenRate | Minutes between life regeneration |
regenAmount | Lives restored per regeneration |
Example Flow
Player starts with 5 lives
↓
Player uses 1 life to attempt a level
↓
Player has 4 lives remaining
↓
After 30 minutes, 1 life regenerates
↓
Player has 5 lives (capped at max)
API Usage
// Check lives
const player = await client.players.get('player-123');
console.log(`Lives: ${player.lives}/${player.maxLives}`);
// Use a life
await client.players.useLive('player-123');
// Grant bonus lives
await client.players.grantLives('player-123', { amount: 3 });
Economy Configuration
Configure your game economy in the Admin Console or via API:
{
"xp": {
"enabled": true
},
"levels": {
"enabled": true,
"curveType": "exponential",
"baseXP": 100,
"multiplier": 1.5,
"maxLevel": 100
},
"currencies": [
{
"id": "coins",
"name": "Coins",
"icon": "coin",
"initialBalance": 100
},
{
"id": "gems",
"name": "Gems",
"icon": "gem",
"initialBalance": 0
}
],
"lives": {
"enabled": true,
"maxLives": 5,
"regenRateMinutes": 30,
"regenAmount": 1
}
}
Start with a simple economy and expand based on player feedback.
Overly complex economies can overwhelm new users.