Making an Adventure Game - Part 1
- 3 minutes read - 425 wordsSo, following on from the lacklustre success of my previous game, I thought I’d have another go. This time, I’m going to work on this project in public, showing what tools I use and what I do all the way from start to finish. So literally the first thing I’m doing is creating the first in a series of blog posts.
The aim is to go from an idea through to a finished product. And so I went looking for a freely-available gamebook. I did some searching, and stumbled across a gamebook called “Secret of the Pyramids”. I downloaded that, and was happy to find that I had a decent-looking PDF.
Now, this is a pretty good place to start. For one, this isn’t a scanned PDF, it’s been made from a proper printout. So there’s actual text and pictures in the PDF, rather than just hundreds of scanned pages. The previous game I made from scanned PDFs, that I couldn’t even OCR, so I ended up retyping almost all of the text. Instead, I used some free utilities to pull the text and images out of the source PDF, no typing required.
Please be mindful of the note about
Windows.
The main tools will be cross-platform, but this bit is definitely not.
Sorry. I used a couple of tools called
pdftotext and pdfimages to pull the text and images out of the PDF. If you
don’t have these tools already, you can install
poppler-utils (Linux) or poppler (MacOS via Homebrew).
Once that’s done, I ripped the text out of the file like this:
% pdftotext SecretsOTP.PDF secretsotp.txtI specified the layout flag so that the tool wrapped lines for me. The idea is that the layout of the PDF gets preserved in the text file, so I don’t have to deal with stupidly long lines in the output. This will help later.
Next, the images:
pdfimages -png SecretsOTP.PDFThis pulls all of the images out of the PDF and puts them in files
called images-000.png, images-001.png, and so on.
Finally, and optionally, you could run the text file through a spell-checker. This isn’t going to work 100%, because the text file may have hyphenated words in it. However, it’s a useful test to make sure that the text extraction worked OK. Something like this should work:
% aspell -l en-gb -c secretsotp.txtThis gives us the basic book in a form that we can convert. Next time, we’ll get the tools installed, and work out how to structure the development environment.