seed

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func ArchetypesFile() ([]byte, error)

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

func BonusesFile() ([]byte, error)

BonusesFile is the raw composition-bonus declaration.

func Books

func Books() (battle.Books, error)

Books assembles every parsed book a battle needs.

func Builds

func Builds() (*cast.BuildBook, error)

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

func BuildsFile() ([]byte, error)

BuildsFile is the raw build-catalogue declaration.

func Cast

func Cast() (*cast.Book, error)

Cast parses the embedded characters, checking every origin, archetype and skill they name against the book that declares it.

func CastDeps

func CastDeps() (cast.Deps, error)

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 CastFile

func CastFile() ([]byte, error)

CastFile is the raw character declaration.

func CombatFile

func CombatFile() ([]byte, error)

CombatFile is the raw damage-formula declaration.

func CombatRules

func CombatRules() (combat.Rules, error)

CombatRules parses the embedded damage-formula constants.

func Data added in v0.3.0

func Data() (fs.FS, error)

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

func ElementChart() (*element.Chart, error)

ElementChart parses the embedded affinity chart.

func ElementsFile

func ElementsFile() ([]byte, error)

ElementsFile is the raw affinity chart declaration.

func ModifierBounds

func ModifierBounds() (modifier.Bounds, error)

ModifierBounds parses the embedded buff and debuff limits.

func ModifiersFile

func ModifiersFile() ([]byte, error)

ModifiersFile is the raw buff and debuff bounds declaration.

func NewBattle

func NewBattle(seed uint64) (*battle.Battle, error)

NewBattle assembles a battle from the embedded data.

func Origins

func Origins() (*cast.OriginBook, error)

Origins parses the embedded origin catalog.

func OriginsFile

func OriginsFile() ([]byte, error)

OriginsFile is the raw catalog of works the cast is borrowed from.

func ParseRoster

func ParseRoster(raw []byte, characters *cast.Book) ([]battle.Roster, error)

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

func PassiveBook() (*passive.Book, error)

PassiveBook parses the embedded passives against the status book, which is what a granted status is checked against.

func PassivesFile

func PassivesFile() ([]byte, error)

PassivesFile is the raw passive declaration.

func PatternBook

func PatternBook() (*pattern.Book, error)

PatternBook parses the embedded area shapes.

func PatternsFile

func PatternsFile() ([]byte, error)

PatternsFile is the raw area-shape declaration.

func ProgressionFile

func ProgressionFile() ([]byte, error)

ProgressionFile is the raw stat-budget declaration.

func ProgressionLimits

func ProgressionLimits() (progression.Limits, error)

ProgressionLimits parses the embedded stat budget.

func Roster

func Roster() ([]battle.Roster, error)

Roster parses the embedded seed roster.

func RosterFile

func RosterFile() ([]byte, error)

RosterFile is the raw seed roster.

func SkillBook

func SkillBook() (*skill.Book, error)

SkillBook parses the embedded skills, checking every shape and status they name against the books that declare them.

func SkillsFile

func SkillsFile() ([]byte, error)

SkillsFile is the raw skill declaration.

func Species

func Species() (*cast.SpeciesBook, error)

Species parses the embedded species catalog.

func SpeciesFile

func SpeciesFile() ([]byte, error)

SpeciesFile is the raw catalog of what a unit can be.

func Squads

func Squads() ([]placement.Squad, error)

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

func SquadsFile() ([]byte, error)

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

func StatusBook() (*status.Book, error)

StatusBook parses the embedded timed effects.

func StatusesFile

func StatusesFile() ([]byte, error)

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

func DataDigest() (Digest, error)

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

func DigestOf(fsys fs.FS) (Digest, error)

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

func (d Digest) Short() string

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.

func (Digest) String

func (d Digest) String() string

String is the whole digest, sixty-four lowercase hex characters. This is the form that travels and the form that gets compared.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL