The documentation for TSC-80 1.0 is available here - Projects created for TSC-80 1.0 are incompatible with 2.0
Write your TIC-80 PRO games in TypeScript.
TSC-80 contains all the functions declarations (.d.ts
) for the TIC-80 API, and will compile your TypeScript code in JavaScript to inject it into your TIC-80 cart.
This tool has been tested with TIC-80 version 1.2.x (pro edition) on Windows 10, and should work on all platforms compatible with TIC-80 and TypeScript.
- Install NodeJS LTS
- Install TypeScript:
npm install -g typescript
- Install TSC-80:
npm install -g tic80-typescript
tsc80 init
will create the necessary files (config, declarations, and game files) into the current directory- Set the correct values inside the
tsc80-config.json
You need to complete the tsc80-config.json
for each project.
{
"ticExecutable": "path/to/tic/executable/file", // The file path to your TIC executable.
"entry": "main.ts", // The entry point of your game's code
"outfile": "build/output.js", // Path to bundled file. You should not have to change this.
"minify": false // If you want to minify your build. May provide very slight performances improvements
}
$ tsc80 build
will build your game into the "build" directory$ tsc80 run
will build, watch the changes, and launch your game through TIC-80
Once that TIC-80 is running, all code changes in .ts files will be reflected after a reload (ctrl+r
). You can update and save your assets directly in TIC-80.
$ tsc80 run
continuously watches changes in your .ts files and compiles them on the fly. You then alt-tab to TIC-80, and hit ctrl+r
to reload the game.
This instructs TIC-80 to load game.js
and inject the compiled code inside the cart.
❗ You must not edit the compiled JavaScript code inside the TIC-80 editor. Your changes would be overwritten.
You must only edit assets (sprites, map, sounds, music) inside the TIC-80 editor. Don't forget to save your changes before reloading the code.
When you hit ctrl+s
inside TIC-80, game.js
is saved as a standalone TIC-80 cart.
The build
folder can be ignored, but you must commit game.js
, since it contains all non-code assets.
If you know TypeScript and modern web development, writing your TIC-80 game with TSC-80 should be straightforward. It uses esbuild to compile and bundle the code, targets ES2020
and uses the modern ESM syntax (import
& export
).
tsc80 build|run
only transpiles your TypeScript files to JavaScript, and compiles them together as a single output file. Internally, TIC-80 uses QuickJS as its JavaScript engine.
The following limitations apply:
- JS code up to ES2020. This tool does not provide polyfills.
- ! No
export
from your entry file - Required to have a single file output
- Tree-shaking is disabled by default, as esbuild would strip important "unused" functions like
TIC()
TIC-80 doesn't reload my code
If you're building TIC-80 yourself, make sure to use the correct settings
$ cd <path-to-tic>/build
$ cmake -G "Visual Studio 16 2019" -DBUILD_PRO=On -DCMAKE_BUILD_TYPE=MinSizeRel ..
$ cmake --build . --config MinSizeRel --parallel
- Projects created for TSC-80 1.0 must be refactored to be compatible with 2.0
- Builds are now done with esbuild, instead of
tsc
- Projects now use ESM, with
import
andexport
- Formal tsconfig update to output ES2020 code for TIC-80 1.1.x
- Dependencies update
- Cleaner code
- Fixed race condition by @tmountain
- Official release for TIC-80 1.0
- Added
ttri()
- Refactoring to make this tool compatible with TIC-80 1.0.x-dev
- Simplified workflow
- Added
peek1()
,peek2()
,poke1()
,poke2()
,vbank()
- Added
elli()
,ellib()
, andtrib()
- Fixed
mouse()
signature
- Removing
"use strict"
from output file, since it breaks the global scope in TIC-80 engine. - Updated dependencies
- Stricter TypeScript
- Better documentation
- Cleaned a bit of code
- Added information in README
compress
andmangle
now default to true
- Added new function declarations (up-to-date with TIC version 0.80)
- Added jsdocs for all functions. Thanks a lot @miltoncandelero
- Fixed the return types of multiple functions
- Updated the boilerplate code to meet TS standards
- Added
key()
,keyp()
andreset()
declarations - Updated the boilerplate code for latest TIC-80 version
- Updated README for better, step-by-step instructions
- Fixed missing input support (thanks @matanegui)
- Fixed
tsc80
cmd help message
- Added
textri()
declaration
- Refactored code
- Making a real npm package
- Added a
backup
option to copy your cart to your project's folder
- Updated
print()
andspr()
declarations
- Added
exit()
declaration totic.d.ts
- Updated
README.md
- Updated
tic.d.ts
- Compile from TS to JS (finally...)
- Renamed "main.ts" to "sample.ts"
- Described a small trick to ensure that the init code waits for its dependencies
- Removed the
require
of the compiled file - Cleared README a bit
- Added a
require
of the compiled code to catch exceptions - Added uglify-js to compress the compiled code
- Rewrote the launch script
- Project birth: created a definitions file for TIC-80, and a
tsconfig.json