New RPG Parser Structure

In the past I’ve written a tiny bit about my RPG Parser software that I use to store game data and insert it into templates and pages. I’ve recently rewritten it while I was working on playtesting character sheets for the compendium classes in Binding World.

The new RPG Parser code works in two parts: Data and Pages.

Whiteboarding the flow.

The Data Parser

Data takes all of the individual JS and Markdown files – each representing something in the game like a move, class, or tag – and puts them into a single gameData object that is saved as JSON.

Here’s the early stages of the file structure of the game data:

Folder structure of game data. Not complete.
Folder structure of game data. Not complete.

The file and folder structure is what determines where the data goes in the gameData object that the parser creates. All the information in game_data/classes/bloodbinder/index.js will be put into gameData.classes.bloodbinder. The .moves folder will ignore the folder they are in and go directly into gameData.moves 

Here’s the contents of the bloodbinder/index.js file:

The starting_moves and advanced_moves lists are all references to moves. The move data isn’t stored directly in the classes, but they are replaced with the full move data during the parsing stage so I can reference classes.bloodbinder.starting_moves[0].name to get the name of the first starting move.

The move files are done as markdown files for easy readability. When the parser encounters a markdown file instead of a JavaScript file it takes the first line as the name attribute and takes everything else as the description attribute. Later I’ll be added support for bold and italic text in the markdown.

The Pages Parser

The Pages parser takes XML documents that reference the game data with tags, inserts the real values, and exports them into multiple formats for InDesign, websites, GitHub, etc. The Parser uses the Mustache templating engine. I have a script for each output and am starting with the InDesign one. Here’s a sample page I’m working with:

A Pages XML file ready to be parsed into a usable InDesign file.

This file is put through the Pages InDesign parser and gives me this:

The output of the Pages parser with all the game data inserted.

What’s Next

Next I’ll be working on some basic InDesign printable sheets for the compendium classes of Binding World using these two parsers. Hopefully I’ll be able to do some playtesting with them soon. More upgrades will come to the software along the way.

Leave a Reply

Your email address will not be published. Required fields are marked *