npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

genie-dat

v0.4.0

Published

read and write age of empires .dat files

Downloads

27

Readme

genie-dat

read and write age of empires .dat files

Install - Usage - Supported Formats - Limitations - API - License: LGPL-3

npm travis standard

Install

npm install genie-dat

Usage

var genieDat = require('genie-dat')
var buffer = require('fs').readFileSync('/path/to/empires2_x1_p1.dat')
genieDat.load(buffer, (err, dat) => {
  console.log(dat.civilizations.map(civ => civ.name))
})

Supported Formats

The data file format differs slightly between game versions. Versions supported by this library are:

  • aoc - All AoC-style formats, such as empires2_x1.dat of AoC 1.0 and empires2_x1_p1.dat of AoC 1.0c (the most common version). UserPatch and UserPatch based mods like WololoKingdoms and Portuguese Civ Mod also use this format. HD Edition versions before 5.0 also use this format.
  • african-kingdoms - The release of African Kingdoms changed the file format slightly; HD Edition versions 5.0 and up use this format. Note that this is used regardless of whether the African Kingdoms DLC is actually installed.

Limitations

Age of Kings, SWGB, and the AoE1 and AoE:DE files are not yet supported. The goal is to expand support for these formats in the future.

Parsing a large binary file like this is quite slow, it takes about 6 seconds on my machine. This is probably not inherent and just has to do with the way this library is implemented on top of awestruct. Hopefully awestruct's performance can be improved in the future. You should cache the result if you need it often.

API

genieDat.load(buffer, opts={}, cb)

Decompress and load buffer, eg. a raw .dat file.

opts can be an object with properties:

cb is a Node-style callback receiving (err, dat). dat is a plain object representing the dat file contents. console.log() it to find out what's in it. There is a lot of junk, some of the more useful properties are:

  • playerColors - Player colours, mostly offsets into the main palette file
  • techs - Technology effects
  • terrains - Lists terrains
  • civilizations - Lists available civilizations
    • civilizations[i].objects - Lists unit statistics for each civ
  • researches - Lists available researches—this refers to the technology effects a lot

genieDat.loadRaw(buffer, opts={}, cb)

Load an already decompressed buffer. Use this if you manually did zlib.inflateRaw or got an uncompressed buffer through some other means. Otherwise it is identical to genieDat.load.

License

This project is based heavily on genieutils by apreiml and Tapsa, and on the openage conversion script.

LGPL-3