BDL Examples
Practical examples and use cases for BDL
Overview
These examples demonstrate practical uses of BDL for common game development scenarios. Use them as starting points for your own definitions.
Simple Hello World Example
A minimal BDL definition that demonstrates the basic structure: entity, index, and data bundle.
entity Hello {
id: string,
value: string
}
index {
hello: {
sheet: "hello",
entity: Hello
}
}
databundle client {
hello: hello
}Game Content Example
A comprehensive example showing characters, weapons, and items with relationships and enums.
enum Rarity {
COMMON
RARE
EPIC
LEGENDARY
}
enum WeaponType {
SWORD
BOW
STAFF
DAGGER
}
entity Character {
id: string,
name: string,
level: int,
health: float,
attack: float,
defense: float,
weaponId: {
type: string,
references: Weapon,
optional
}
}
entity Weapon {
id: string,
name: string,
weaponType: WeaponType,
damage: int,
rarity: {
type: Rarity,
optional,
default: COMMON
},
price: float
}
entity Item {
id: string,
name: string,
description: string,
rarity: Rarity,
stackSize: {
type: int,
optional,
default: 1
},
price: float
}
index {
characters: {
sheet: "characters",
entity: Character
}
weapons: {
sheet: "weapons",
entity: Weapon
}
items: {
sheet: "items",
entity: Item
}
}
databundle client {
characters: characters
weapons: weapons
items: items
}Complex Game System Example
An advanced example showing inheritance, subentities, arrays, and complex relationships.
enum ItemType {
CONSUMABLE
EQUIPMENT
QUEST_ITEM
MATERIAL
}
enum StatType {
HEALTH
ATTACK
DEFENSE
SPEED
}
subentity StatModifier {
statType: StatType
value: float
}
subentity Position {
x: float
y: float
z: float
}
entity BaseEntity {
id: string,
name: string,
description: string,
iconId: string
}
entity Character extends BaseEntity {
id: string,
name: string,
description: string,
iconId: string,
level: int,
baseHealth: float,
baseAttack: float,
baseDefense: float,
skillIds: string[],
spawnPosition: Position
}
entity Item extends BaseEntity {
id: string,
name: string,
description: string,
iconId: string,
itemType: ItemType,
rarity: Rarity,
stackSize: {
type: int,
optional,
default: 1
},
statModifiers: StatModifier[],
price: float
}
entity Quest {
id: string,
title: string,
description: string,
objectives: string[],
rewardItemIds: string[],
rewardExperience: int,
requiredLevel: {
type: int,
optional
}
}
index {
characters: {
sheet: "characters",
entity: Character
}
items: {
sheet: "items",
entity: Item
}
quests: {
sheet: "quests",
entity: Quest
}
}
databundle client {
characters: characters
items: items
}
databundle server {
quests: quests
}Economy System Example
An example showing how to model an in-game economy with currencies, shops, and pricing.
enum CurrencyType {
GOLD
GEMS
ENERGY
PREMIUM
}
entity Currency {
id: string,
currencyType: CurrencyType,
name: string,
symbol: string,
maxAmount: {
type: int,
optional
}
}
entity ShopItem {
id: string,
itemId: {
type: string,
references: Item
},
shopId: {
type: string,
references: Shop
},
price: float,
currencyType: CurrencyType,
stockLimit: {
type: int,
optional
},
purchaseLimit: {
type: int,
optional
}
}
entity Shop {
id: string,
name: string,
description: string,
itemIds: string[],
refreshInterval: {
type: int,
optional
}
}
index {
currencies: {
sheet: "currencies",
entity: Currency
}
shops: {
sheet: "shops",
entity: Shop
}
shopItems: {
sheet: "shop_items",
entity: ShopItem
}
}
databundle client {
currencies: currencies
shops: shops
shopItems: shopItems
}Quest System Example
A detailed quest system with objectives, rewards, and prerequisites.
enum ObjectiveType {
KILL
COLLECT
REACH
TALK
CRAFT
}
enum QuestStatus {
LOCKED
AVAILABLE
IN_PROGRESS
COMPLETED
}
subentity Objective {
objectiveType: ObjectiveType,
targetId: string,
targetCount: int,
description: string
}
subentity Reward {
itemId: {
type: string,
optional
},
currencyType: {
type: CurrencyType,
optional
},
amount: int,
experience: {
type: int,
optional
}
}
entity Quest {
id: string,
title: string,
description: string,
objectives: Objective[],
rewards: Reward[],
prerequisites: string[],
requiredLevel: {
type: int,
optional
},
questChainId: {
type: string,
optional
}
}
index {
quests: {
sheet: "quests",
entity: Quest
}
}
databundle server {
quests: quests
}