WC3MapTranslator
Translate war3map
⇄ json
formats for WarCraft III .w3x maps
Overview · Install · Usage · Examples · File Support · Specification · Contributing · Special Thanks
WC3MapTranslator is a module to convert a JSON representation of WarCraft III (.w3x) data to their war3map
files, and vice-versa. This makes the map data readable and easily modifiable.
This API is a core component of Ice Sickle, the next-generation world editor. Ice Sickle stores data in a JSON format, and then generates all the necessary files to assemble a .w3x MPQ archive to build a map.
npm install wc3maptranslator
var Translator = require('wc3maptranslator'),
mapJson = { // Refer to "Specification"
units: [...],
doodads: [...],
...
};
// Using individual translators, we may convert JSON
// representation to generate a WC3 .w3x map file.
// See the Wiki for more information.
var unitResult = new Translator.Units.jsonToWar(mapJson.units);
// We can now write the `unitResult.buffer` content to a file named "war3mapUnits.doo" and put it in a .w3x archive!
There is an /examples
directory that demonstrates how to use each translator. This is a great starting point to learn how to use any translator. The directory has jsonToWar
, and warToJson
, sample projects to convert from JSON to war3map files and back.
To get started with either example, cd
into /examples/[whichever]
and run npm install
to automatically install all the dependencies. Run npm start
under /examples/[whichever]
to display a list of each command to run.
For example, to run the "Cameras" translator, your working directory should be /examples/jsonToWar
, and then you'll run the command node entity/cameras.js
. Take a look at the source code under jsonToWar/entity
, jsonToWar/object
, or jsonToWar/other
to see how to use each translator.
All output files are placed in the output
directory.
Type | Json → War | War → Json | File |
---|---|---|---|
Terrain | war3map.w3e | ||
Units | war3mapUnits.doo | ||
Doodads | war3map.doo | ||
Regions | war3map.w3r | ||
Cameras | war3map.w3c | ||
Sounds (definitions) | war3map.w3s |
Type | Json → War | War → Json | File |
---|---|---|---|
JASS | war3map.j | ||
Strings | war3map.wts |
Type | Json → War | War → Json | File |
---|---|---|---|
Info File | war3map.w3i | ||
Imported Files | war3map.imp | ||
Pathing | war3map.wpm | ||
Shadow map | war3map.shd |
Custom Text Trigger File (war3map.wct)
Trigger Names File (war3map.wtg)
Menu Minimap (war3map.mmp)
Minimap Image (war3mapMap.blp)
Minimap Image (war3mapMap.b00
Minimap Image (war3mapMap.tga)
Map Preview Image (war3mapPreview.tga)
We have a detailed specification on our Wiki explaining how to format a map in JSON. It explains everything from the high-level map object, all the way down to creating individual units, tiles, or custom objects.
The underlying WarCraft map files (e.g. war3map.doo) have been documented on our Wiki as well. If you are curious about how a .w3x file is composed, this is the place to learn!
We encourage contributions! Generally, the process of making a change is:
- Fork this repo
- Develop your changes on a new branch
- Submit a pull request to
master
Your code should:
- run (your code needs to work, of course)
- include tests (write unit tests to demonstrate your code works under different conditions)
- be linted (run
npm run lint
and follow the project's coding standards) - pass CI (we enforce: ESLint, unit tests pass, code coverage)
A code review is required on your PR to be accepted into master
. A project member will get back to you within one week. If you haven't heard from someone regarding your PR, feel free to ping @chiefofgxbxl.
We owe a lot of thanks to Chocobo on TheHelper for the detailed documentation of the files found in a .w3x archive. Two tutorials are here (1) and here (2).