Giter Club home page Giter Club logo

war3-lua-seed's Introduction

๐ŸŒ‘ Warcraft 3 Map Project Seed With Lua

A Warcraft 3 map project template using Lua scripting language that allows code splitting and editing code while the World Editor is open. Powered by Node.js.

Features

  • Bundling and code splitting (via Luabundle)
  • File watcher (via nodemon)
  • Bundle contents of the src/ (and lib/ for external libraries like damage-engine.lua) folder and inject them in the map.w3x/war3map.lua file
    • Thus enabling editing the map using the World Editor whilist editing lua with code editors like VSCode without having to neither copy/paste code in the editor nor create a clone project
    • See Caveats
  • Code minification using Luamin
  • Bundle file size check (warning if > 100KB)

Installation

Usage

Development

  • run npm start to bundle and watch for changes
  • run npm run bundle to bundle only

Production

  • run npm run bundle.prod to watch for changes with minification enabled
  • run npm run watch.prod to watch for changes with minification enabled

Caveats

  • Map bundle injection or loading may fail if:
    • Run Map immediatly after save: World Editor saving takes a small amount of time, and change detection / bundling also has a small execution time. So if you test the map before bundling is done it won't work. Wait a few seconds after save or wait for the bundling complete message in the console
    • TestMap used istead of map.w3x/: Unsaved changes in the World Editor cause it to create and run a temporary map TestMap. Since the path to TestMap is not known, it's not injected with lua bundle. Workaround: If you change anything in the World Editor (an asterisk appears on the World Editor window label map.w3x*), then you need to first SAVE in the editor and wait for change detection + compilation (~ 1 second) before clicking Test Map
    • Map save detection fails: watcher not runnig / watcher didn't wait before map save was complete (thus bundle was overwritten)
    • Write was denied: map.w3x/war3map.lua file is in use by another process or has read only permissions
  • Files not required by the src/main.lua (__root) module or it's submodules are not included in the bundle, thus not acessible anywhere (including external libs at lib/)

Enhancements to consider:

  • Map source backup option
  • Use lua Global Initialization instead of hooks
  • .env or equivalent
  • Fix TestMap TempFolder caveat
  • Make it easier to include external Lua libraries
  • Typescript to Lua
  • Make into npm package
  • Make into npm package
  • Create release mode that minifies the map completely (smaller) but is irreversible, and should instead create a new file in a /dist folder or create a backup file

License

MIT

war3-lua-seed's People

Contributors

vitorthedev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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