node package manager

mangudai

Mangudai

Greenkeeper badge Travis status Test coverage TypeScript Style Guide Standard Readme

AoE2 Random Map Scripting for humans

JavaScript library for working with Random Map Scripts (RMS) for the Age of Empires II video game.

Currently Mangudai can parse an RMS script into an Abstract Syntax Tree (AST) and serialize AST back into a string.

Motivation for this project comes from the lack of open-source tooling: syntax highlighting, linting, parsing into AST for advanced third-party tools.

The goal of this project is to make writing random maps accessible to the AoE2 community at large by making it as straight-forward and pleasant as possible. There's also potential to bring all the necessary tools online since this is a JavaScript project.

Install

Mangudai is published as an NPM package compatible with Node.js and browsers.

npm install --save mangudai

Use a tool like Webpack or Rollup to include Mangudai in your front-end code.

Usage

import { parseRms, serializeRms } from 'mangudai'
 
const { ast, errors } = parseRms('<PLAYER_SETUP> \n random_placement')
const generatedRms = serializeRms(ast)

Mangudai is written in TypeScript and exports all relevant typings.

API

parse( script: string ) => { ast: RmsAst, errors: Error[] }

serialize( ast: RmsAst ) => string

lint( ast: RmsAst ) => LintError[]

Contribute

This project is still in its early development stage. Any help is greatly appreciated! Feel free to ask questions in issues. PRs accepted.

License

MIT © Mangudai contributors