Documentation
¶
Overview ¶
Package seed owns the embedded data files the game boots from. Keeping the embed here means the core packages stay pure: they parse bytes handed to them and never touch the filesystem.
Index ¶
- func Archetypes() (*cast.ArchetypeBook, error)
- func ArchetypesFile() ([]byte, error)
- func BonusBook() (*composition.Book, error)
- func BonusesFile() ([]byte, error)
- func Books() (battle.Books, error)
- func Builds() (*cast.BuildBook, error)
- func BuildsFile() ([]byte, error)
- func Cast() (*cast.Book, error)
- func CastDeps() (cast.Deps, error)
- func CastFile() ([]byte, error)
- func CombatFile() ([]byte, error)
- func CombatRules() (combat.Rules, error)
- func Data() (fs.FS, error)
- func ElementChart() (*element.Chart, error)
- func ElementsFile() ([]byte, error)
- func ModifierBounds() (modifier.Bounds, error)
- func ModifiersFile() ([]byte, error)
- func NewBattle(seed uint64) (*battle.Battle, error)
- func Origins() (*cast.OriginBook, error)
- func OriginsFile() ([]byte, error)
- func ParseRoster(raw []byte, characters *cast.Book) ([]battle.Roster, error)
- func PassiveBook() (*passive.Book, error)
- func PassivesFile() ([]byte, error)
- func PatternBook() (*pattern.Book, error)
- func PatternsFile() ([]byte, error)
- func ProgressionFile() ([]byte, error)
- func ProgressionLimits() (progression.Limits, error)
- func Roster() ([]battle.Roster, error)
- func RosterFile() ([]byte, error)
- func SkillBook() (*skill.Book, error)
- func SkillsFile() ([]byte, error)
- func Species() (*cast.SpeciesBook, error)
- func SpeciesFile() ([]byte, error)
- func Squads() ([]placement.Squad, error)
- func SquadsFile() ([]byte, error)
- func StatusBook() (*status.Book, error)
- func StatusesFile() ([]byte, error)
- type Digest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Archetypes ¶
func Archetypes() (*cast.ArchetypeBook, error)
Archetypes parses the embedded role presets, checking every skill they suggest and every curve they propose against the stat budget.
func ArchetypesFile ¶
ArchetypesFile is the raw role-preset declaration.
func BonusBook ¶ added in v0.2.0
func BonusBook() (*composition.Book, error)
BonusBook parses the embedded composition bonuses against the two books a bonus is checked with: the statuses it grants and the chart it counts.
func BonusesFile ¶ added in v0.2.0
BonusesFile is the raw composition-bonus declaration.
func Builds ¶
Builds parses the embedded build catalogue against the cast, which is what says whether a build's kit is one its character could field.
func BuildsFile ¶
BuildsFile is the raw build-catalogue declaration.
func Cast ¶
Cast parses the embedded characters, checking every origin, archetype and skill they name against the book that declares it.
func CastDeps ¶
CastDeps assembles everything a character is validated against. It is exported because an authoring tool builds its own cast book from a working directory and has to validate it against the same books.
func CombatFile ¶
CombatFile is the raw damage-formula declaration.
func CombatRules ¶
CombatRules parses the embedded damage-formula constants.
func Data ¶ added in v0.3.0
Data is the embedded data files as a filesystem, rooted at the data directory itself: a name in it is `cast.json`, exactly the name that reads the same file out of a directory on disk.
It exists so that a reader of the whole set — internal/forge builds a library out of all fifteen books it knows about — can be written **once** over a name and run against either the embedded copy or a directory an author is editing. The alternative was a switch in the caller from a file name to one of the sixteen XxxFile accessors, which is a fourth independent copy of the name list in a package whose digest test already exists because three was too many.
⚠️ **It hands out a filesystem and never a path**, which is the same line DigestOf draws and for the same reason: this package reads the embedded copy and nothing else, and a real directory belongs to internal/forge.
The rooting is what a caller has to get right and therefore what this takes off them. The embed names every file under `data/`, so the raw embed.FS answers to `data/cast.json` and a caller reading `cast.json` out of it gets a not-exist error — which for the two optional books internal/forge tolerates would be read as an author's empty catalogue rather than as a bug. The directory comes off dataPrefix rather than being spelled again here.
func ElementChart ¶
ElementChart parses the embedded affinity chart.
func ElementsFile ¶
ElementsFile is the raw affinity chart declaration.
func ModifierBounds ¶
ModifierBounds parses the embedded buff and debuff limits.
func ModifiersFile ¶
ModifiersFile is the raw buff and debuff bounds declaration.
func OriginsFile ¶
OriginsFile is the raw catalog of works the cast is borrowed from.
func ParseRoster ¶
ParseRoster resolves a roster declaration against the cast book.
The flat form — a name, an element, a stat line and a kit written out in place — is what the seed roster uses, because that roster exists to exercise the engine rather than to be the real cast. The reference form names a character and a level instead, and is what an authored cast is placed with.
It takes bytes rather than a path for the same reason the core parsers do: the caller owns the file access, and a test can hand it a fixture.
func PassiveBook ¶
PassiveBook parses the embedded passives against the status book, which is what a granted status is checked against.
func PassivesFile ¶
PassivesFile is the raw passive declaration.
func PatternBook ¶
PatternBook parses the embedded area shapes.
func PatternsFile ¶
PatternsFile is the raw area-shape declaration.
func ProgressionFile ¶
ProgressionFile is the raw stat-budget declaration.
func ProgressionLimits ¶
func ProgressionLimits() (progression.Limits, error)
ProgressionLimits parses the embedded stat budget.
func SkillBook ¶
SkillBook parses the embedded skills, checking every shape and status they name against the books that declare them.
func Species ¶
func Species() (*cast.SpeciesBook, error)
Species parses the embedded species catalog.
func SpeciesFile ¶
SpeciesFile is the raw catalog of what a unit can be.
func Squads ¶
Squads parses the embedded squad catalogue.
It holds whatever a person has built, and an empty file is the honest state only until somebody builds one. The game boots from the copy go:embed baked in, so a squad built in the authoring tool reaches a battle at the next build — the same rule every other data file lives under, and the reason nothing here treats a squad in the file as a mistake.
func SquadsFile ¶
SquadsFile is the raw squad catalogue: the sides an author has built to fight each other, as against the seed roster, which is the instrument.
func StatusBook ¶
StatusBook parses the embedded timed effects.
func StatusesFile ¶
StatusesFile is the raw timed-effect declaration.
Types ¶
type Digest ¶
type Digest [32]byte
Digest is the fingerprint of the embedded data. It answers exactly one question, at a room's gate: **will these two binaries simulate the same battle?**
It is not a version number. Nothing about it is meant to be stable across commits — this repository ships data changes constantly, and every one of them is *supposed* to move the digest, because every one of them changes the battles. The only property that matters is equality between two peers built from the same data.
func DataDigest ¶
DataDigest is the digest of the sixteen embedded data files.
Art is not in it. assets/ cannot reach the simulation, so a peer with a newer picture is not a peer that fights a different battle, and refusing it at the gate would refuse a match that would have been identical.
func DigestOf ¶
DigestOf is the digest of the same sixteen files read out of a filesystem the caller hands in, so a directory somebody has been editing can be compared against the embedded copy.
⚠️ **The caller's FS is rooted AT a data directory and the framed names keep their `data/` prefix anyway, and getting that wrong is the one way this function can be silently useless.** dataFiles mirrors the go:embed directive, whose paths are relative to this package; a --data directory is the data directory itself and is called whatever the person running the tool called it. So the two have to be told apart: `data/skills.json` is what the **hash** is fed, because that is what DataDigest feeds it, and `skills.json` is what is **read**.
⚠️ It was written the other way round first — the prefix stripped from the name that goes into the hash as well as from the name that is read — and every unedited directory then came back as different from the embedded copy, because the *names* differed by six characters. It looked exactly like working code: the digests were both well formed and both stable. What caught it was running the client, which drew "your edits will not reach the battle" over a directory nobody had touched. TestAnUneditedDirectoryDigestsAsTheEmbeddedCopyDoes is what would have.
⚠️ **It takes an fs.FS and never a path, which keeps this package's own rule intact.** internal/seed reads the embedded copy and nothing else; the real filesystem belongs to internal/forge, which is the one part of the module allowed to touch one. So the os.DirFS is forge's line, not this one. → the package comment, and internal/forge's.
func (Digest) Short ¶
Short is the first twelve hex characters, for a human reading two screens side by side.
⚠️ Never compare on this. Twelve hex characters is forty-eight bits, which is plenty for a person telling two builds apart at a glance and nowhere near enough to be the check that decides whether a battle is joinable. The gate compares String; Short exists so that a mismatch can be *reported* in something a person can read out loud.