pathfinder-2-sqlite-MIRROR/README.md

163 lines
5.7 KiB
Markdown
Raw Normal View History

2019-08-02 18:30:41 -04:00
# Pathfinder 2 Sqlite
2019-08-02 18:56:21 -04:00
This will be a repository for the code necessary to generate a sqlite database
containing the open gaming content for the Pathfinder 2 table-top
role-playing-game system that is available under the Open Gaming License. Pull
requests welcomed!
2020-02-24 23:38:06 -05:00
## Data initially in YAML and then scripts to convert to SQL
Currently, the main data source is found in the `data/yaml` directory, and
2020-04-27 01:04:31 -04:00
running `python3 gendb.py` will generate a `tmp.db` sqlite3 database.
2020-02-24 23:38:06 -05:00
Why YAML? Two big reasons:
1. It's easier to human edit than sql statements and provides a convenient
"flat" data source for anyone wanting to avoid or has no need for SQL
queries. It's also easily convertible into json for a document-based NoSQL
solution.
2. I really dislike JSON for human editing.
2019-08-02 18:56:21 -04:00
## Why sqlite?
It's an open, permissively licensed, and portable single-file database that does
not require setting up a client/server model. It's also likely that the database
will fit into memory easily so performance issues aren't likely to be a problem.
Also, most use cases of this data will likely be read only, so the sqlite
2020-02-24 23:51:59 -05:00
limitations on concurrent writes won't be an issue either.
2019-08-02 18:56:21 -04:00
2020-04-25 02:37:42 -04:00
## Stop yacking and tell me how to generate the database from the YAMl!
2020-07-16 06:00:37 -04:00
Ok! There are two ways of doing this; using Docker containers, and manually
setting things up. If you just want to generate the database and use it, I'd
recommend Docker, if you want to actively develop this repo the manual setup
may be preferable.
### Using Docker
First you will need docker, you can set that up from [here](https://www.docker.com/get-started).
The included Dockerfile is set up so that it will install the correct
dependencies and run the database generation script. Everyone's workflow will
differ, but this will get you a generated database:
```
docker build -t pathfinder-2-sqlite -f .\Dockerfile .
2020-07-16 06:28:02 -04:00
docker run -t pathfinder-2-sqlite
2020-07-16 06:00:37 -04:00
```
### Manual Setup
2020-04-25 02:37:42 -04:00
2020-04-27 01:05:48 -04:00
You'll need a working python3 installation and the module `pyyaml` installed.
You'll also need a working sqlite3 install to browse the database once
generated. You can visit its website at http://sqlite.org. If you are on an
*nix-style operating sytstem, you can install through your operating system's
package manager.
2020-04-25 02:47:52 -04:00
- **Debian/Ubuntu**: run as root: `apt install sqlite3`
- **Fedora**: run as root: `dnf install sqlite`
- **Windows**: visit the download page at https://www.sqlite.org/download.html
- **MacOs**: visit the download page at https://www.sqlite.org/download.html
2020-04-25 02:37:42 -04:00
### To install pyyaml
Run the correct pip install command: `pip install pyyaml`. Depending on your
operating system, this might be `pip3` or `python3-pip` instead of `pip`.
### Generate the database
From the repository root, navigate to the `bin` directory with a `cd ./bin` and
then run `python3 gendb.py`. The code is not optimized for speed, so depending
on your system and disk I/O, it might take a minute or so. The output file is
currently a `tmp.db` in the repository root. You can then explore the db file
with `sqlite3 tmp.db` called from the repository root directory.
2019-11-15 23:49:14 -05:00
## Where we need the most help right now
2019-11-15 23:46:47 -05:00
2019-11-15 23:49:14 -05:00
### Proofreading Spells.yaml
2019-11-15 23:46:47 -05:00
It's time for everyone to put physical eyes on the `data/yaml/spells.yaml` file
and compare to **the actual print book or PDF** (taking into account any Errata
of course). The scrape could only do so much and there are many small errors
here and there. Please see issue #61.
Once we have the data proofread, I'll write a glue script to get the spell data
into normalized sql form.
2020-02-24 23:38:06 -05:00
### Proofreading Monsters.yaml
It's time for everyone to put physical eyes on the `data/yaml/monsters.yaml` file
and compare to **the actual print book or PDF** (taking into account any Errata
of course). The scrape could only do so much and there are many small errors
here and there.
Once we have the data proofread, I'll write a glue script to get the monster data
into normalized sql form.
2019-11-15 23:46:47 -05:00
2019-08-02 18:56:21 -04:00
## Roadmap
2019-11-15 23:43:12 -05:00
1. Get data in YAML format (~~spells are in JSON for the time being; but will
get converted over to YAML in the future~~ They are in yaml format and need proofreading! Please see issue #61).
2019-11-12 01:10:00 -05:00
2. Design schema;
3. Write script to generate sqlite database from YAML data (see
`data/yaml/gendb.py` for work in progress);
4. Metric boatloads of proofreading
5. Drinks for all when finished!
# Conventions in the Code
2019-08-07 20:16:53 -04:00
## Text Encoding
2019-08-07 20:21:31 -04:00
2019-08-07 20:16:53 -04:00
The goal is for all of our stored text in the database to be unicode,
preferably `UTF-8`.
2019-08-07 20:21:31 -04:00
Also, many of the text fields will be in Github-Flavored Markdown.
Text may use the following escape codes:
1. `\n` for Newline
2. `\n\n` for a new paragraph
3. `\t` for Tab
4. `\\` for Backslash
2019-08-07 20:21:31 -04:00
The action symbols can be represented by the following characters:
2019-08-07 20:21:31 -04:00
2019-11-14 22:58:29 -05:00
| Meaning | Character |
|----------|----|
2019-11-14 23:01:42 -05:00
| 1 action | `\|1\|` |
| 2 actions | `\|2\|` |
| 3 actions | `\|3\|` |
| Reaction | `\|R\|` |
| Free action | `\|F\|` |
| One Minute | `\|1m\|` |
| Ten Minutes | `\|10m\|` |
| One Hour | `\|1h\|` |
2019-08-07 20:21:31 -04:00
## Text Formatting
2019-08-14 22:55:16 -04:00
Text formatting will be according to github-flavored markdown.
2019-08-14 23:55:38 -04:00
## Identical names
2019-08-14 22:55:16 -04:00
2019-08-22 22:05:19 -04:00
In the case of identical names ex. Sudden Charge for Fighter vs Barbarian we will use an identifier in parentheses ex. Sudden Charge (Fighter) vs Sudden Charge (Barbarian) or Lock (Simple) vs Lock (Average).
## Ability Scores in Integer Representation
| Ability Type | Value |
|--------------|-------|
| None | 0 |
| STR | 1 |
| DEX | 2 |
| CON | 4 |
| INT | 8 |
| WIS | 16 |
| CHA | 32 |
2019-08-02 22:32:19 -04:00
| Free 1 | 64 |
| Free 2 | 128 |
If I wanted to say STR and DEX, I would use a `3`. If I wanted STR, WIS, and
2019-08-06 12:20:11 -04:00
CHA, that would be 1 + 16 + 32 = `49`. This is to give a program-focused data
return in addition to the textual representation.