Giter Club home page Giter Club logo

tic80-boilerplate's Introduction

TIC-80 boilerplate

This is my TIC-80 boilerplate code for multi-file projects. During development, the project is separated into multiple .lua files, and they are combined into one for building an executable.

Environment setup

I'm using Windows for development, so all the scripts included are for Windows. You might get the idea how to implement them for Linux/Mac by looking at them, though.

Requirements:

  • Windows PC
  • TIC-80 pro
    • Add installation directory to PATH environmental variable
  • WSL2 on Windows
    • luarocks
    • luacc on luarocks

Good-to-haves:

Instructions

You need TIC-80 pro to get support for .lua cartridges - WSL is used for running luarocks (I've noticed running luarocks on WSL is less error-prone than on Windows)

In WSL, install luarocks:

sudo apt-get install luarocks

and then install luacc that is used to combine the lua files.

sudo luarocks install luacc

Luacc isn't perfect (you need to supply it with a list of files to combine), so I might change to another system later.

TIC-80 setup

Lua path

To get require statement working, I've had to explicitly add the project folder to Lua's package.path variable. This happens on line 10 of main.lua - change the path Q:/github/tic80-boilerplate/ to your project folder.

Note that this is only needed if you get the error module 'libs/math' not found when running the game; if said error never appears, you can just remove the line.

Adding more files

When you add a new file:

  • Add a new require statement for it in main.lua
  • Add the file to luacc.sh so the built executable works as well (see Building an executable below).

Running

Run runtic80.bat in the command line. It runs main.lua on TIC-80 from the command line.

The savefiles are located under the project folder in the .local directory.

Building an executable

To create a Windows build, run buildWin.bat <version> (e.g., buildWin.bat 1.0).

By running the luacc.sh script, it creates a game.lua file - a bundle that contains all the code files in one.

Then, it creates a new TIC-80-boilerplate-<version>.exe file in the /build/ folder.

Note: You can set the name of the game to something else in the buildWin.bat file.

Note 2: Tos create Mac and Linux builds, run the buildAll.bat <version> script instead!

tic80-boilerplate's People

Contributors

borbware avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.