Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Using Improv ====== **Improv** ([[https://github.com/sequitur/improv|source code]], [[http://improv.readthedocs.io/|documentation]]) is a powerful procedural generation engine by Bruno Dias. While the questions of why you might need Improv and how to use it are sorta out of the scope for this document, there is an important details on how to use it with Salet. You see, since November 2016 Improv allows to use a custom RNG (random number generator). If you hook it up with Salet's RNG (conveniently exposed as ''salet.rnd'') it will return the same text every time the player loads the game. If you don't, however, it will return different text every time. Long story short, here's minimal code: <code> Improv = new ImprovEngine(data, { rng: () -> return salet.rnd.randf() }) </code> and a real example: <code> require('babel-polyfill') ImprovEngine = require('improv') Improv = {} $.holdReady( true ) $.getJSON('game/procgen/'+i18n.lang+'.json', (data) -> Improv = new ImprovEngine(data, { rng: () -> return salet.rnd.randf() filters: [ ImprovEngine.filters.mismatchFilter() ] reincorporate: false }) $.holdReady( false ) ) </code> where: * ''babel-polyfill'' is needed for browser compatibility; Improv is written in ES6, it doesn't work in older browsers as it is * ''holdReady'' bit loads procgen data with an AJAX request and forbids the game to start until the request is finished. and the rest is explained in Improv documentation. en/guide/improv.txt Last modified: 2021/01/24 10:42by 127.0.0.1