Game4: Choice-Based Game

In Game4 you face your largest challenge so far: using libraries with no starter code.

Your goal is to start with a fork of the game4 base code and develop a choice-based new game which shapes text using harfbuzz, renders glyphs with freetype, and draws the result with OpenGL.

This is a tall order, so let me clarify a few things:

A choice-based game is a plot-heavy game that depends on discrete player choices (rather than continuous motions or actions) to drive the narrative. This genre includes visual novels [like Analogue: A Hate Story], choose-your-own-adventure games [like Howling Dogs], or interactive fiction [like Counterfeit Monkey]. This sort of game often includes a whole lot of text and lasts hours, but you only need to make something with a few choices that lasts 2-5 minutes.

The main technical challenge of this game is going to be getting harfbuzz and freetype working in your asset pipeline. You may choose to integrate them into your game runtime in order to support dynamic text, or use them in your asset pipeline to re-render text into some other format. This goes against a lot of what I say in this class, but: even though I am only asking you to make a short game, you should build your text rendering in such a way that it would scale to a game with hundreds or thousands of lines of text. E.g., you could build a runtime that creates lines of text on-the-fly in-game, or a runtime that pre-renders small files describing glyph positions and textures. Pre-rendering every line to its own texture is not a suitable solution.

Past experience suggests that this is surprisingly difficult. Therefore we will devote some time in class to this particular challenge.

Last time I did this myself, I found this harfbuzz example and the freetype tutorial were both valuable resources (as were the example programs that ship with each library, and their header files and documentation). And, hey, I was able to find these links really quickly because I cited them in my source code.

What You Need To Do

(More on game scoring.)

How To Do It

The challenge of this assignment is understanding two new and complex libraries and integrating them with the game code.

  1. Fork the base4 code as a starting point.
  2. Figure out how to make text into glyph bitmaps and positions (if you want to play around outside of the main game code, freetype-test.cpp might be a starting point).
  3. Figure out how to get textures uploaded to the GPU and positioned on the screen (looking back at PPU466.cpp might be helpful).
  4. Figure out how to store, load, and run choices. (If you find yourself parsing text in your engine, that's usually a sign you need an asset pipeline.)
  5. Fill in the missing sections in README.md to document your project; replace screenshot.png with a screenshot of your game. (The base code is already set up to capture a screenshot whenever you press the PrintScreen key.)
  6. Turn in the game using the form linked above.

The official inspirational song of game4 is the first 2:22 of "Green Typewriters" by The Olivia Tremor Control.