-
Notifications
You must be signed in to change notification settings - Fork 0
Build Instructions
During development, test the game by running the uncompiled version at /game/template.html. Once you're ready for building and deploying, the Platypus engine has several build scripts for debugging and deploying games, described below.
The build scripts are located in the /tools/ folder. When invoked, they perform various actions and post the resulting game builds to the folders specified in config.js. The default folders are /game/ and /debug/.
There are many scripts in the folder that the build tools use, the scripts that you need to know about are fast-compile, full-compile and refresh-images. There are two versions of each, a .bat file for Windows users and a .sh version for *nix users.
Example *nix terminal use: bash full-compile.sh
Fast compile is used when making iterative changes to game code or Tiled level designs. It skips the image manipulation processes to allow quicker builds.
Full compile uses all build processes and should be used when making changes to assets and source, or when you are ready to test a final version of your game or deploy.
This is used when making changes to image assets only and allows artists to view changes quickly. This does not update Tiled map changes.
That is game compilation in a nutshell, but there are a lot more settings to set if you like...
#Configuring Compilation Options
Just like setting up a game using the config.json
file as described in Create-Config-JSON, individual builds can be set up using unique sets of settings in the same configuration file. The following describes these options in detail. A build with all the possible settings changed from the defaults will look something like this:
"builds": [{
"id": "game",
"namespace": "platformer",
"cssCompression": true,
"jsCompression": true,
"manifest": true,
"index": false,
"pngCompression": 256,
"debug": true,
"paths": {
"default": "http://gopherwoodstudios.com/code/",
"assets": "http://gopherwoodstudios.com/assets/"
}
}]
Noting the example above, the options can be set as follows:
-
id (string) - Required. This is the id of the build and is matched to a folder name in the
project/builds
folder. In the example, the compiled game can be found atproject/builds/game/
. - namespace (string) - Optional namespace for the platformer. Defaults to "PBS.KIDS.platformer".
-
cssCompression (boolean) - Optional. Determines whether to run CSS compression on this build using the YUI Compressor to minify the code. The default is
false
. -
jsCompression (boolean) - Optional. Determines whether to run JavaScript compression on this build using the YUI Compressor to minify the code. The default is
false
. -
manifest (boolean) - Optional. Determines whether this build should use Application Cache. The default is
false
. -
index (boolean) - Optional. Determines whether this build should be the index of the folder within which it is contained. The default is
true
. - pngCompression (number) - Optional. Determines whether to compress PNG images: 0 is No, Any number greater than 0 compresses the image to that number of colors per image. The default is 0.
-
debug (boolean) - Optional. Determines whether game should use components that are considered debug components such as Render-Debug or Logic-FPS-Counter. The default is
false
but should be set to true for debugging. - paths (object) - Optional. This is an object containing settings for default and assets paths. The default path if set causes all files to use the absolute path it specifies. Otherwise, files default to relative path names. The list of assets can have an alternative absolute path (for example, when using a CDN). If not defined, assets use the default path.
#Breaking the Warranty Tape
If you want to customize key functionality that is not exposed by the provided settings, or even add an additional feature to the compilation scripts, the following may prove helpful. All the compilation scripts are written in JavaScript and are located in the project/tools/js
folder. There are three files that perform the compilation magic:
-
compile-json.js - This script takes all the JSON scripts in
project/game
and compiles them into a single configuration JSON file used by the following two scripts. -
compile-assets.js - This script uses the above configuration file to find, compress, and copy images and audio from the
src
folder to thebuilds
folder. - compile-scripts - This script uses the above configuration file to find, combine, and compress the JavaScript source code as well as the configuration file into a single JavaScript file. It also combines and compresses all local CSS files into a single CSS file as well.
In addition to the above scripts, the tools
folder also includes the following folders:
- yui - This is the YUI Compressor used above to compress CSS and JavaScript files.
- pngquant - This is the PNG image compressor used above to compress PNG images.
- rhino - This is the Mozilla JavaScript engine that interprets the 3 JavaScript scripts listed above. Windows systems use the native JScript interpreter.
Platypus was developed by PBS KIDS and Gopherwood Studios. It is free to use (see licenses.txt), all assets in the example games are © Gopherwood Studios and/or © PBS KIDS.