Skip to content

scambier/TQ-Bundler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TQ-Bundler

A fast bundler/watcher/launcher for your TIC-80 projects.


TQ-Bundler streamlines the use of external editors for TIC-80. Split your project into several files, then bundle them and start your game in a single command.

🎈 It's a lightweight single-file executable! 🎈

Downloads for Windows and Linux.

Tl;dr:

$ mkdir my-game
$ cd my-game
$ tq-bundler.exe init lua
$ tq-bundler.exe run game.lua main.lua --tic tic80.exe

Features

  • Initializes your multi-files project
  • Builds all your files into a single bundle
  • Watches changes to rebuild automatically
  • Launches your game inside TIC-80
  • Supports Lua, Moonscript, Fennel, Janet, Wren, Squirrel, JavaScript and Ruby

Installation

Since TQ-Bundler is a single-file executable, you can simply download it and place it wherever you'd like. For easy access, I recommend to place it somewhere in your PATH, next to TIC-80, or at the root of your games projects folder.

Usage

TQ-Bundler has 2 sub-commands:

  • init to quickly initialize a multi-file project in the language of your choice
  • run to bundle the files and start TIC-80 with your game

Create a project

$ mkdir my-game
$ cd my-game
$ tq-bundler.exe init lua # or moon, wren, fennel, janet, squirrel, js, ruby

This will create the files game.lua (containing the sprites and sounds) and main.lua (the code entry point)

Include your files

In all languages, paths are in the format of "folder.subfolder.file". Paths are resolved relatively from the root of your project (see example here).

All includes are recursively resolved, with respect to their declaration order. includes must be on their own line (1 per line).

-- Lua syntax
include "macros" -- will look for ./macros.lua
include "tools.utils" -- ./tools/utils.lua
-- Moonscript syntax
include "macros" -- ./macros.moon
include "tools.utils" -- ./tools/utils.moon
;; Fennel syntax
(include "macros") ;; ./macros.fnl
(include "tools.utils") ;; ./tools/utils.fnl
# Janet syntax
(include "macros") # ./macros.janet
(include "tools.utils") # ./tools/utils.janet
// Wren syntax
include "macros" // ./macros.wren
include "tools.utils" // ./tools/utils.wren
// Squirrel syntax
include("macros") // ./macros.nut
include("tools.utils") // ./tools/utils.nut
// JavaScript syntax
include("macros") // ./macros.js
include("tools.utils") // ./tools/utils.js
# Ruby syntax
include "macros" # ./macros.rb
include "tools.utils" # ./tools/utils.rb

Bundle and launch your game

⚠️ Be careful to respect the arguments order, or your game won't launch. It's always tq-bundler.exe run GAME MAIN.

# Bundle the game into `build.lua`:
$ tq-bundler.exe run game.lua main.lua
# Bundle and launch through TIC-80, then rebuild when files change:
$ tq-bundler.exe run game.lua main.lua --tic path/to/tic80.exe

This way, you can edit code inside your IDE and edit assets inside TIC-80 at the same time. Changes are applied after a ctrl+r.

# View all options:
$ tq-bundler.exe help run

/!\ The default bundle file is named build.lua (or .wren etc.). TQ-Builder won't check if a file with this name already exists, and will happily overwrite it with each new compilation /!\

The bundle file is annotated with comments delimiting the start and end of all included files.

Addendum

Why not use require or import statements that already exist in several of these languages?

TQ-Bundler literally replaces include statements with the raw contents of said included files. Since statements like require or import work differently, I wanted to avoid any confusion.

The bundle file only contains the code, how can I bundle this with the assets file?

Simply ctrl+s inside TIC-80, and your whole game (code + assets) will be saved to game.lua

For convenience, TQ-Bundler leaves the game file (the one containing your sprites & sounds) alone. This allows you to edit those assets inside TIC-80 and your code inside your external editor, without risking to overwrite one or the other.

TIC-80 doesn't correctly 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

TypeScript support

Take a look at TSC-80, a TypeScript compiler for TIC-80