Giter VIP home page Giter VIP logo

tq-bundler's Introduction

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 "sub.folder.file". Paths are resolved absolutely, starting from the root of your project (see example here).

-- 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

All included files paths are resolved relative to the file including them. All includes are recursively resolved, with respect to their declaration order. includes must be on their own line (1 include per line).

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

tq-bundler's People

Contributors

scambier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tq-bundler's Issues

allow for redundant includes outside of main

I believe currently trying to use include in any file outside of main.lua results in the error: thread 'main' panicked at 'called Option::unwrap() on a None value'. It would be useful to be able to use include in any lua file and have the final build.lua copy only the first occurrence of the included file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.