About this project
Aventura is a JavaScript library for creating generative text, interactive stories, and electronic literature. It runs in the browser by including the script and instantiating new Aventura(). Grammar-based text generation uses an object of rules referenced as rule tags, with setGrammar(grammar).expandGrammar('base'). Rule options can carry a .prob array for weighted selection; transformations like #CAPITALIZE# and #ALLCAPS# can be applied; dynamic rules such as $hero$[name:animal,attribute:adjective] can bind a generated value for reuse; testGrammar() reports missing rules. Markov chain generation uses markovModel(file, n?, save?) to create an n-gram model from a text file and setMarkov(model).markovChain(length, seed) to generate text; loadJSON can load a saved model and testDistribution() logs distribution information. Igramas are grammar-like image generators: load a JSON model from the igrama app, call setIgrama, expandIgrama('base'), then showIgrama(layers, format, containerId), igramaDataUrl, or igramaText; gif output requires MiniGif. Interactive stories are defined as scenes with text, optional options arrays, scene links, deadEnd, image/igrama, and clickable image areas; start with setScenes(scenes).startAdventure('start'), and testScenes() finds missing scenes. Custom configuration includes language, container, typewriter speed, igrama format, MiniGif options, scrolling, custom code in scenes, and CSS overrides.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.