====== Technical preparations ====== ====== Boilerplate ====== The easiest way would be to take the source code for an existing game and alter it. The [[https://gitlab.com/Oreolek/salet/|Salet demo ]] is a good option because it's kept up-to-date. - [[https://nodejs.org/en/download/|Install node.js]] if you don't have it. - Do a project copy using ''git clone'' somewhere or [[https://gitlab.com/Oreolek/salet/repository/archive.zip?ref=master|download the archive.]] - Call ''npm install'' and wait until every dependency is installed. Shouldn't take much time. Now you have a repository copy ready to start. You'll be working on your game in it. Some things you should look at when you begin working: - Open ''game/begin.coffee'' and change the ''salet.game_id'' to something else. UUID would be a good choice. It should be a unique string, so your game's saves wouldn't clash with saves from other games, see the [[en:saving|Saving]] chapter. - Salet itself and Salet games are written on [[https://coffeescript.org/|CoffeeScript]]. To comment out a line, put a ''#'' symbol in start of it. - The ''gulp serve'' command should show you a live preview of your game. You can edit the files and then your browser would update the game with the latest changes. Now you're ready. To compile the game out of your sources, call: gulp dist and you'll get a ''dist'' folder with your game. A ''gulp zip'' command will automatically pack it into a ''.zip'' archive. And start writing! You can use services like [[http://codepen.io/|codepen.io]] or [[https://jsfiddle.net/|jsfiddle.net]] to create, edit and share IF. Just make a new document and include Marked, jQuery and Salet core in it. The latest Salet version is accessible on [[en:guide:using-cdn|a NPM CDN.]] ==== About CoffeeScript ==== This wiki uses CoffeeScript interpreter to make Javascript code easier. You can learn the language from the [[http://coffeescript.org/|CoffeeScript website]]. A short text is denoted by quotes: ''"like this"'' and a long text is marked by three quotes ''""" like this """''. It is **not required** to use CoffeeScript, you can choose any language that works in the browser but CoffeeScript is easier than Javascript and all our examples use it. ==== Markdown ==== Salet formats all the game text using Markdown syntax. * [[https://daringfireball.net/projects/markdown/|Official syntax document]] * [[http://commonmark.org/help/|Markdown reference and 10 minute tutorial]] === Markdown and indentation === In Markdown, spaces are a big deal. If a line starts with many spaces, Markdown thinks it's a programming code. But in CoffeeScript, spaces are a big deal **too.** The language uses indentation to figure out where the blocks and branches end. CoffeeScript lets you write the text without any indentation but many people have a hard time figuring out the code like that because the indentation is "shaky". So Salet automatically cuts the text indentation to the smallest indentation in this text, so you can write something like this: room "prelude", dsc: """ # A limerick [Read](./_writer_read) """, writers: read: """ There was an Old Man who said, "Hush! I perceive a young bird in this bush!" When they said—"Is it small?" He replied—"Not at all! It is four times as big as the bush!" **(E. Lear)** """ The example above has the first text block indented to be visually "inside" the code and the second text block to be on the same level. Salet doesn't do anything about trailing spaces. ====== Start the game from scratch ====== If you are starting from scratch, you should already know about webdev and NPM packages. In that case, just run this console command: npm install --save salet You can also use CoffeeScript, SASS, Gulp, or write it all however you like. Salet also requires jQuery library - CDN-provided or local.