Crate intfic

Source
Expand description

Rust

intfic is a framework that allows you to write a branching story with minimal code.

It uses story files with a custom markup syntax that allows for the following:

  • Write text or specific quotes of text with different colors
  • Display options that trigger different Story Blocks or Story Files
  • Set flags or add to counters in the GameState
  • Check flags or counters in the GameState and conditionally display text or options

Additionally, I’ve included some basic functions for asking yes-no questions and traveling in the cardinal directions, should you prefer to take a more “text adventure” approach with code.

splash

§Getting Started

  1. Run the example with “cargo run”
  2. Examine the example story files and read up on the intfic Story File Markup Specification
  3. Write you own story, and update main.rs to start it!

§License

This project is licensed under the MIT License - see the LICENSE.md file for details

Modules§

game_state
Stores, saves, and loads an environment that can be changed and referenced by your story.
parse_file
Parses story files and constructs a list of StoryBlock’s.
parse_input
Sanitizes and parses input, checking for system keywords.
story_block
Represents an atomic chunk of story with text, effects, and options.
write_out
Writes text with a typewriter effect and a variety of possible colors.

Constants§

DEBUG
If enabled, various debug info will be printed during gameplay
FASTMODE
If enabled, the typewriter effect of write_out is made instantaneous.
LINETIME
The base amount of time before the next line of a block is started, if FASTMODE is disabled.
TYPETIME
The base amount of time before the next charater of a line is typed, if FASTMODE is disabled.

Functions§

print_debug
Prints a string if DEBUG is enabled.