A minimalist visual novel engine written in Python using Pygame. This project lets you create simple visual novels with typewriter effects, dialog and thought boxes, location markers, and more—all defined in easy-to-edit YAML files.
Note: Some variable names are in Portuguese, as this project was originally developed for a personal project. Feel free to rename them to your preferred language. Also, this was created with AI assistance, so it may not follow all best practices. However, it is functional and serves as a good starting point for simple visual novels, plus, it was just for fun. Don't take it as a professional project!
- Typewriter Text Rendering: Narrative, dialog, location, and thought blocks appear with a typewriter effect.
- Dialog & Thought Boxes: Dialogs show in bordered boxes with character names; thoughts are displayed in italicized boxes.
- Location Highlighting: Location/time lines render in a distinct subtitle color for emphasis.
- Section Navigation: Use arrow keys (←/→) to move between sections; press ENTER to repeat a section or ESC to return to the menu.
- Progress Saving: Your progress is saved automatically per section, so you can resume where you left off when reopening a chapter.
- YAML-Driven Content: Chapters and sections are defined in simple YAML files for easy editing and expansion.
- Advanced Styling (v1.1.1):
- Global settings in
settings:
(text speed, font size, colors). - Inline color overrides with
[color=#RRGGBB]…[/]
. - Fixed-height dialog/thought boxes to prevent layout breakage.
- Hex-only color support in
settings:
and overrides.
- Global settings in
-
Clone the repository:
git clone https://github.com/ZTC0xFE/minimalPyVn.git cd minimalPyVn
-
Install dependencies:
- Requires Python 3.8+
- Install Pygame and PyYAML:
pip install pygame pyyaml
-
Verify your Python version:
python --version
- Window Title:
Change thepygame.display.set_caption
line inmain.py
to set your VN’s window title. - Screen Size:
AdjustSCREEN_WIDTH
andSCREEN_HEIGHT
insettings.py
to change the window dimensions. - Text Speed:
ModifyTEXT_SPEED
insettings.py
(or via chapter-specificsettings:
) to control the typewriter pace. - Colors & Fonts:
Customize colors and fonts withinrenderer.py
’sTextRenderer
class or via the new YAMLsettings:
block.
Chapters live in .yml
files under the chapters/
folder. Each file must include a title:
and sections:
. Under sections:
, each section is a list of lines, which can be:
- Narrative:
Plain text for narration (no special markers). - Location (or subtitle):
Wrap with€…€
, e.g.€Location – Time€
. - Dialog:
Wrap with#…#
, including a speaker in brackets, e.g.# [Name] Dialogue text.#
. - Thought:
Wrap with¥…¥
, including a speaker in brackets, e.g.¥ [Name] Thought text.¥
.
title: "Chapter 1: The Beginning"
sections:
intro:
- "This is the beginning of our story."
- "€Location – Morning€"
- "# [Alice] Hello, world!#"
- "¥ [Alice] I wonder what adventures await me.¥"
- "Another narrative line."
For a comprehensive guide to the new settings:
block and inline color overrides (v1.1.1), please see:
This tutorial covers:
- Overall Structure
settings:
Block (Globals)- Section & Block Syntax
- Inline Color Overrides
- Detailed Example YAML
-
Run directly (IDE):
Openmain.py
in your favorite IDE (e.g., VS Code, PyCharm) and run it. The main menu will appear. -
Run from the command line:
python main.py
-
Build a standalone executable:
Install PyInstaller, then package all chapters and code:pip install pyinstaller pyinstaller --onefile --add-data "chapters;chapters" main.py
- On Windows, the executable appears in the
dist/
folder. - On macOS/Linux, adjust the
--add-data
syntax if needed.
- On Windows, the executable appears in the
Suggestions, improvements, and pull requests are always welcome! If you find this project helpful, please consider starring ⭐ it on GitHub or opening an issue with your feedback.
Tip: Inside the
chapters/
folder, you'll find a sample.yml
chapter. Feel free to modify or replace it as a starting point.