I am a personal fan of books in adventure games as a way to offer extra information in a way that is entirely optional to the player. It is a cheap but effective way to populate the world with extra information, back story, whatever you wish. And in this case I also use books to offer extra play tips and Piczle Cross tactics outside of the tutorial, allowing me to keep the latter nice and lean.

Like the dialogs written about previously books are run from datatables, though in a slightly roundabout way it uses two separate ones. One datatable contains all the pages in every book. Like dialogs each page has a unique ID. A second datatable is for books. Each book has a unique ID as well, and assigned to this ID are all the page IDs that need to go into this book.

Grabbing the title, book image and page text from the datatable. The page number is automatically derived from the number of pages assigned to the book.

Why do it this way? Well, in an upcoming post about localisation I’ll delve into a little more detail but it is done because of localisation. I didn’t want any of the languages to be limited to the structure of the English language I write the books in. Some languages may need less space, others (*cough*German*cough*) will need a lot more. I wanted localisers to be able to add as many pages as they require without breaking the system. If they need to add pages to any book they can just create new pages with unique IDs and slot them into the list of IDs for the book they’ll appear in.

To put books in the world I’ve created a simple BluePrint actor I can just drop wherever I want it. This actor contains the animated book as it appears in the world and a small collision box to check when the player is close enough to “activate” the book. Then all I have to do is set the book’s ID, which tells the code which pages it contains, and the colour of the book. This colour then automatically propagates to not only the cover of the book in the world, but also the colour of the cover in the close-up of the book when the player is reading it. This is a cheap and easy way to make books look a little different, all driven by a vector parameter in a dynamic material.

Dropping the book actor in the world.

You may have spotted the “Is library book” variable as well. I added this as an easy check for a trophy in the game. There are several books in the library in the game that contain explanations of the game’s extensive options, Piczle Cross tactics and story background. I thought I’d reward players who read through all of these with a trophy for doing so. With this variable checked, once the player opens the book, a little check is performed to count towards that trophy. Otherwise it is ignored.

The book widget up close.

The button help menu on the bottom right shows the player they can flip through pages with left/right or close the book again by pressing A. These button graphics change automatically depending on which platform I’m building the game for.

Like the dialog editor I created a simple book text editor so I could see, in real time, how the text fits on the page before I commit it to a datatable. Although, again, there is an option in the game’s hidden debug menu from which I can pull up any and all book pages to check them all at once.

The in-editor book text editor.

The book system is nice and robust and allows me to drop books wherever I want in the game. So far I’ve not gone entirely mad yet, but once I do a pass over the world once all the content is in it’ll be very easy to drop in a few more here and there just for fun!

2 thoughts on “Books

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s