This article describes the layout structure of the ChoiceScript game directory and highlights the folders and files of most importance to you as a game developer.
ChoiceScript Game Directory
The main ChoiceScript directory (for our purposes) is as follows:
Note that this part -- 515e4ef -- is the actual version number of the files contained herein. It is not sequential.
When you download a newer version (clicking that link will show you the current latest version number) you will need to copy everything from mygame and scenes to the new directory, after deleting the example files in those two new folders. Just to be on the safe side, however, don't delete the old directory itself yet. Instead, rename the main folder of the old version so the directory looks something like this:
This will at least retain a then-working copy of your game, while you continue developing your game using the files copied to the new version folders. You can always delete it at a later date, once completely happy with how your game runs under the new version of ChoiceScript.
ChoiceScript Game Folders
The folders structure of a ChoiceScript game is as follows:
web mygame scenes choicescript_stats.txt startup.txt [your other scenes .txt files] credits.html index.html mygame.js .htaccess alertify.css alertify.min.js index.html navigator.js persist.js scene.js style.css ui.js util.js
Individual ChoiceScript Folders
"web" is the main game folder. You can rename this folder to whatever you like.
"scenes" is the folder that contains all the scenes in which you script your game, as well as the startup.txt and choicescript_stats.txt files.
Individual ChoiceScript Files
The file "choicescript_stats.txt" is used to display important information about the game and it's protagonist. This is the file that controls what is displayed when the player clicks on the "Show Stats" button in game.
startup.txt is a vital file. The game will not start without it. This is where the title and name of the author of the game is set, where permanent variables that store the game's data are defined, and where the game's scenes are listed sequentially for reference by ChoiceScript.
index.html (in the mygame folder)
index.html is the file that you use to actually run your game (you can open it with any browser). The only thing you must not do is open it in Google Chrome; Google Chrome won't load external scripts locally (i.e. it won't run your game scenes) unless published on another website like ChoiceOfGames, Dashingdon or Webs.
This "index.html" is also the file to edit to change the displayed title of your game. You can also change the description of the game that search engines will see, and you can change the default text that is shown at the bottom of each page displayed in the game.
These are not directly related to ChoiceScript, and are not necessary for it to work. Htaccess is a configuration file for web servers which has no important information.
index.html (in the web folder)
Nothing that you change here makes a difference (i.e. changing the font, pixel size and background color won't make a difference, since they are changed in the style.css file), but they are all needed so don't remove anything. The only thing you could change in this file and that would make a difference is the "Loading..." text, so that when the game loads, the text that's displayed while loading changes accordingly (N.B. this index.html file is not covered in the index.html article, because it only has one feature; everything of use concerning this file has been covered here).
This file is the file that makes the sceneNavigator in mygame.js and the *scene list command in startup.txt work properly.
Has an unknown use.
style.css controls the aesthetic display of the game, such as the background color of the game, its font and the color, width and position of the stats bars on the stats screen.
Contains the loading procedure (you may notice it between scenes at most choicescript games), the stats button that displays, some of the more advanced commands (like *image and *share_this_game), that checks if a game is purchased or not (only if the game is published on ChoiceOfGames) and that displays advertisements (again, ChoiceOfGames only).
This is the file that handles the load/save system.
Next Tutorial Article: Startup.txt