How mrlegowatch/roleplayingcore works
RolePlayingCore is a reusable Swift library for tabletop RPG rules and character data. Its principal workflow loads JSON game content into GameData, then uses that content to construct or randomly generate a Player with species, class, background, abilities, equipment, and spell state. Separate domain modules provide currency, item, and spell models, while common utilities support measurements, display ordering, names, and random choices. The README also describes a SwiftUI example app, but its source is not present in the supplied tree; relationships are limited to documented capabilities and indexed references.
Main entry points: GameData.swift Game data loader · Player.swift Player character · CharacterGenerator.swift Character generator · Item.swift Item models
Components 22
Game data
- Game data loader
Sources/RolePlayingCore/Configuration/GameData.swift - Load errors
Sources/RolePlayingCore/Configuration/GameDataError.swift
Character domain
- Species traits
Sources/RolePlayingCore/Player/SpeciesTraits.swift - Class traits
Sources/RolePlayingCore/Player/ClassTraits.swift - Background traits
Sources/RolePlayingCore/Player/BackgroundTraits.swift - Ability scores
Sources/RolePlayingCore/Player/Ability.swift - Player character
Sources/RolePlayingCore/Player/Player.swift - Character appearance
Sources/RolePlayingCore/Player/PlayerAppearance.swift
Equipment and currency
- Inventory
Sources/RolePlayingCore/Items/Inventory.swift - Item catalogue
Sources/RolePlayingCore/Items/Items.swift - Item models
Sources/RolePlayingCore/Items/Item.swift - Currency catalogue
Sources/RolePlayingCore/Currency/Currencies.swift - Money values
Sources/RolePlayingCore/Currency/Money.swift
Spellcasting
- Spell catalogue
Sources/RolePlayingCore/Spellcasting/Spells.swift - Spell model
Sources/RolePlayingCore/Spellcasting/Spell.swift - Spellbook state
Sources/RolePlayingCore/Spellcasting/Spellbook.swift
Generation utilities
- Character generator
Sources/RolePlayingCore/CharacterGenerator/CharacterGenerator.swift - Name generator
Sources/RolePlayingCore/CharacterGenerator/NameGenerator.swift - Character name lists
Sources/RolePlayingCore/Common/CharacterNames.swift - Random selection
Sources/RolePlayingCore/Common/RandomIndexGenerator.swift - Common measurements
Sources/RolePlayingCore/Common/Weight.swift
Other components
- Library client
Connections 27
- Library client → Game data loader: loads content
- Game data loader → Load errors: reports failures
- Game data loader → Currency catalogue: loads
Sources/RolePlayingCore/Configuration/GameData.swift - Game data loader → Item catalogue: loads
Sources/RolePlayingCore/Configuration/GameData.swift - Game data loader → Background traits: loads
Sources/RolePlayingCore/Configuration/GameData.swift - Game data loader → Species traits: loads
Sources/RolePlayingCore/Configuration/GameData.swift - Game data loader → Class traits: loads
Sources/RolePlayingCore/Configuration/GameData.swift - Game data loader → Spell catalogue: loads
Sources/RolePlayingCore/Configuration/GameData.swift - Library client → Character generator: requests generation
- Character generator → Game data loader: uses content
Sources/RolePlayingCore/CharacterGenerator/CharacterGenerator.swift - Character generator → Player character: constructs
Sources/RolePlayingCore/CharacterGenerator/CharacterGenerator.swift - Character generator → Name generator: generates names
- Name generator → Character name lists: uses lists
Sources/RolePlayingCore/CharacterGenerator/NameGenerator.swift - Name generator → Random selection: selects randomly
Sources/RolePlayingCore/CharacterGenerator/NameGenerator.swift - Player character → Species traits: resolves
Sources/RolePlayingCore/Player/Player.swift - Player character → Class traits: resolves
Sources/RolePlayingCore/Player/Player.swift - Player character → Ability scores: calculates from
Sources/RolePlayingCore/Player/Player.swift - Player character → Character appearance: stores
Sources/RolePlayingCore/Player/Player.swift - Player character → Inventory: stores
Sources/RolePlayingCore/Player/Player.swift - Player character → Spellbook state: stores
Sources/RolePlayingCore/Player/Player.swift - Item catalogue → Item models: collects
Sources/RolePlayingCore/Items/Items.swift - Inventory → Item models: holds
Sources/RolePlayingCore/Items/Inventory.swift - Money values → Currency catalogue: uses denominations
Sources/RolePlayingCore/Currency/Money.swift - Spellbook state → Spell model: tracks spells
Sources/RolePlayingCore/Spellcasting/Spellbook.swift - Spell catalogue → Spell model: collects
Sources/RolePlayingCore/Spellcasting/Spells.swift - Item models → Money values: has cost
Sources/RolePlayingCore/Items/Item.swift - Item models → Common measurements: has weight
Sources/RolePlayingCore/Items/Item.swift