Skip to content

Read the Georama's tables from documents a datapack can change - #253

Open
SirFancyBacon wants to merge 1 commit into
TheMoonPeople:masterfrom
SirFancyBacon:georama-documents
Open

SirFancyBacon wants to merge 1 commit into
TheMoonPeople:masterfrom
SirFancyBacon:georama-documents

Conversation

@SirFancyBacon

Copy link
Copy Markdown
Contributor

The Georama's compiled tables become gameplay documents in ChronicleTwo's style (schema_version 2 plus kind), read like the item documents. Without a pack, the game plays exactly as before.

The documents

Path kind Holds Table
gameplay/georama/parts.json georama_parts each town's parts and elements EditPartsData, EditElementData
gameplay/georama/atla.json georama_atla each dungeon's Atla AtraAppearData
  • Parts: each part's cap, stacking value, picture, name message, kind, and the elements added to it (id, prerequisite slot, model names, villager). Each town's element table comes too.
  • Atla: each Atla is a part or an element on a fixed floor, or on the dungeon's first_half or second_half as BtAtraListMake divides it, with its count.
  • Loading: at start-up, into the tables the game already reads, so nothing that reads them changes. A town or dungeon a document leaves out keeps its compiled table, so a pack can change only what it needs.
  • Exporting: --export-gameplay writes both documents as compiled, as a starting point for a pack.

The code is in port/src/georama/tables.cpp, documented in docs/GEORAMA.md.

What is refused

A refused document is reported (config: <path>: <reason>) and the compiled tables stay. Refused:

  • a town, dungeon, part, element or floor that doesn't exist, or one given twice;
  • more than 100 Atla in a dungeon, the most the save holds;
  • more random Atla on a half than its floors can take: 8 per floor, on the floors that take Atla, less those fixed there. BtAtraListMake would otherwise loop forever looking for room. For this check, dungeonparts.cpp now exposes each dungeon's midpoint floor, its floor count, and whether a floor takes Atla.

Notes

  • Model names: they now point into strings the loader keeps alive. A part's unused names stay "" as in the compiled table, and each town's 25th record (never read as a part) stays as compiled.
  • Atla: a dungeon deals out its Atla on the first visit and the save keeps them, so a changed list reaches dungeons a save hasn't entered.
  • Stacking: stackable is exported as retail has it (5 or 10). The game only checks that it's above zero and adds 5 per Atla, as before.

Testing

  • GeoramaTables (5 tests):
    • exported documents load back to the compiled tables exactly;
    • a pack changes one town's part and one dungeon's Atla, and the rest stay compiled;
    • a document can name only some dungeons;
    • a fresh visit deals out the document's extra Atla;
    • six kinds of bad document are refused.
  • Ran the game with a pack giving Norune's roads (part 14) a higher cap and two more Atla in Divine Beast Cave. No reports, and the cave's Atla were dealt out on entry.
  • Full ctest -j4 passes on Linux, apart from the five Kazarov GPU tests that fail on lavapipe.

gameplay/georama/parts.json (kind georama_parts) holds each town's parts
and elements, EditPartsData and EditElementData, and
gameplay/georama/atla.json (kind georama_atla) the Atla each dungeon
hands out, AtraAppearData, each one a part or an element on a fixed
floor or on either half of the dungeon. They are read at start-up into
the tables the game reads, so nothing that reads them changes; a town
or dungeon a document leaves out keeps its compiled table, and
--export-gameplay writes both as compiled.

A document the game could not use is reported and the compiled tables
stay: one naming a town, dungeon, part, element or floor that does not
exist, giving one twice, or giving a dungeon more Atla than the save
holds or more on a half than its floors can take, which would have the
placement look for room forever. dungeonparts.cpp says which floors
take Atla for that check.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant