asciimare

A 3D engine powered by ASCII art.

alt text

asciimare uses ASCII characters to display 3D graphics directly in the terminal. It is powered by python curses, and renders by raycasting on voxels.

asciimare utilizes the combination of 95 printable ASCII characters 8 ANSI colors in the terminal to emulate a variety of hues and brightness. It first analyzes a given font and generate a continous and uniform range of shades, e.g.

Menlo.ttc
          ````````````````````````'''''''''''''......-------
-,,,,,______::::::::^^^^^!!~~~"""""";;;;;;rrrrr++++||()\==>>
>>lllll???iiiccv[]ttzzjj7*ff{{}ssYYTJJJ111unnnnyyyyIIFFFFFFF
oooooowe22h3Zaa44XXX%%%555PPPP$$$mmGGAAUUUUbbbppKKK96O##H&&D
DDDRRRRRRQQ88888800000000WWWWMMMBBB@@@@@@@@@@@@@NNNNNNNNNNNN

and then plays with some color theory to create an illusion of depth.

Dependencies

  • PyPy 2 (pypy.org) (Python works but will be slow)

Usage

Try it out by typing

$ pypy demo.py

or

$ pypy explore.py -i maps/demo.txt

in your terminal.

Loading models

You can explore different maps by loading them into the second command. Currently, asciimare supports models exported from Goxel (plain text) or a batch of csv files each describing a slice along the y-axis. Alternatively, you can procedurally generate models using built-in functions.

Importing asciimare as a module

To use asciimare as a module, place the asciimare subfolder under your project folder and simply do import asciimare. Then, you can define your game class with some standard events and asciimare will figure out the rest. See demo.py for details.

import asciimare

class game(asciimare.GameTemplate):
  def start(self): pass         # use this for initialization
  def update(self): pass        # update called once per frame
  def draw(self): pass          # things to render upon redraw
  def keypressed(self,c): pass  # get pressed key
  
# run the game!
asciimare.run(game)
GitHub - LingDong-/asciimare: 3D engine powered by ASCII art
3D engine powered by ASCII art. Contribute to LingDong-/asciimare development by creating an account on GitHub.