Title: Choose Your Own Adventure - Epub Gamebook
Slug: choose-your-own-adventure-gamebook-epub
Date: 2021-03-27 12:05:00
Author: Kartones
Lang: en
Tags: Development, Game Dev, Markdown, Tools, Books
og_image: https://images.kartones.net/posts/kartonesblog/cyoa-testing.jpg
Description: Creating an ebook version of 'Choose Your Own Adventure' gamebooks, using chapter links for navigation, and testing the approach with a simple ebook.


I love reading, and one of the things I enjoyed a lot as a child was reading [Choose Your Own Adventure books](https://en.wikipedia.org/wiki/Choose_Your_Own_Adventure). Well, technically they are called [gamebooks](https://en.wikipedia.org/wiki/Gamebook), but as many others I tend to generalize the brand name as the book type. In any case, they were really simple books with branching paths and narratives, often with multiple endings.

I already have [an unfinished but working project](https://github.com/Kartones/choose-your-adventure) for building web `CYOA` readers, but as I really enjoy reading at bed from my Kindle, I wanted to do a little experiment: try to build ebooks that have branching paths and act like a classic gamebook.

The idea is really simple: Each relevant page number (as in "go to page XXX") becomes a chapter, and as ebooks support links as references to chapters (and they are trivial to set even with minimal formats such as Markdown), build the navigation based on chapters.

A quick search, reading a bit about [Pandoc](https://pandoc.org/) and using [its official Docker image](https://hub.docker.com/r/pandoc/core), and I was able to quickly build something: [https://github.com/Kartones/cyoa-epub](https://github.com/Kartones/cyoa-epub).

The sample generated in the repository is a very simple ebook with few chapters, but serves as a, introduction tutorial on how the metadata works, how to add a book cover (of course you can also have images at normal pages), how to add a table of contents, and a minimal "adventure" sample that puts to the test the approach.

And it indeed works! Here's an almost final version being tested:

![Testing the ebook in my Kindle](https://images.kartones.net/posts/kartonesblog/cyoa-testing.jpg)

I now guess if with some OCR and a bit of text cleaning and processing I could build digital versions of those childhood books... 🤔
