Source Code
License
Candy Box 2 source code is released under the free software GPLv3 license (free as in "freedom"). This means that you are free to:
- Use the software for any purpose
- Change the software to suit your needs
- Share the software with anyone
- Share the changes you make
You can get more information about this license here.
Where do I get the source code?
Candy Box 2 is written in TypeScript, a language which compiles to javascript using tsc, the TypeScript compiler. This language is published under the Apache License, which is GPL compatible.
Therefore, there are three ways to get the source code :
- The compressed, javascript version used when you play the game. Caution : since it is compressed, it is hardly readable.
- The uncompressed javascript version (this is the file generated by the TypeScript compiler).
- The TypeScript files. This is the best solution if you want to work on the code. See below to know how to download them.
How do I work on the code?
The first thing to do is to download the .zip file containing everything you need : the game itself, the TypeScript files, the ascii art, the compilation scripts, and even this page!
Then, there are three steps :
- Install all the external software you will need to compile the game. Install node.js, the typescript compiler, yuicompressor and Python 3. Note that Candy Box 2 compilation script is using yuicompressor with the command "yuicompressor". Depending on how you installed it, you may need to use "yui-compressor" or another command. Don't hesitate to change the compilation script to comply with that.
- Try to run the compilation script included in the .zip file you downloaded earlier. Use compile.sh on GNU/Linux systems and compile.bat on Windows systems. If you encounter any problem, the fastest way to get an answer is to ask on Candy Box 2 IRC channel.
- If no error show up during the compilation process, it means it worked! You can now begin to work on the code by modyfing the TypeScript files in the code/main directory. You can play with the gaming code, make your own ASCII art game, or maybe create a quest for Candy Box 2.