DEV Community

I Want to Make A Text Adventure With ASCII Art - Any Hints Towards Libraries/Frameworks?

Peter on November 12, 2019

Hi there! For quite some time I'm thinking about making a small text adventure, but I didn't want it to be text-only. A graphic novel is also somet...
Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

The be all end all for stuff like this is ncurses. It's the current iteration of what is one of the oldest TUI libraries in existence, and has bindings in almost every language imaginable. Python has native bindings for it in the curses module (technically, this will use whatever curses implementation is present on the system, which will usually be ncurses these days), and there appears to be at least one set of bindings for Rust. Most of the TUI related documentation you'll find online applies specifically to ncurses, or it's predecessor curses, as there really hasn't been much other than that made in this area.

ncurses, however, is really a generic TUI library. It does the art for typical UI stuff like dialogs and buttons, but doesn't support images. For that, you'd need to look at a different tool, though I don't have any suggestions for either Python or Rust for this (try searching 'python ASCII art' or 'rust ASCII art' in your search engine of choice).

Something else to consider though is that if you can get a sprite or tile-based library working, you can pre-generate sprites for all the characters you use and then use a simple grid system for displaying them. This would let you avoid the need for a terminal emulator and possibly do cool animations for things like scene transitions. You might want to look at SDL2 for this if you can't find other options, it's somewhat lower level than stuff like pygame, but there are still decent tutorials for it out there and it's trivially portable to most modern platforms.

Collapse
 
gadse profile image
Peter

Thanks for your input! I'll go with the curses module for the beginning, get the interface going and attack the ASCII art part when it gets relevant. The thing about not having to ship an integrated terminal emulator is quite compelling. :D