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

gdparse

v1.0.2

Published

A JavaScript library for parsing, encoding and decoding Geometry Dash levels

Downloads

17

Readme

GDParse

A JavaScript library for parsing, decoding and encoding Geometry Dash levels and game save files.

Installation & Usage

Install using npm

npm install gdparse

Use in code

// Import default
import gdparse from 'gdparse';

// Or import individually
import { parseLevel, serializeLevel, decodeGameSave, parseGameSave, serializeGameSave } from 'gdparse';

Documentation

Methods

parseLevel (levelString: string)

Converts a GD level string to a human-readable JS object format. Here's how it's structured:

{
  info: Object // level settings
  data: Array<Object> // array containing all level objects
}

serializeLevel (obj: Object)

Converts a JS object back into the level string.

decodeGameSave (gameSaveString: string)

Decompresses the Geometry Dash save file into an xml format. By default, the save file is compressed and encrypted. Will throw an error, if the given game save is corrupted.

parseGameSave (xmlString: string)

Converts a decompressed Geometry Dash save file into a JS array with all the levels as objects. Will throw an error, if the given game save is corrupted.

serializeGameSave (obj: any)

Converts a JS array back into the XML string. Note that it does not need to be encrypted back into it's original form, since GD does that automatically when started.

Structure

GDObject

Here are all the properties a Geometry Dash object could have. None of them are required, but id, x and y are necessary for an object to be displayed.

{
  id: number,
  x: number,
  y: number,
  flipx: 0 | 1,
  flipy: 0 | 1,
  r: number,
  red: number,
  green: number,
  blue: number,
  duration: number,
  touchTriggered: 0 | 1,
  coin: number,
  checked: 0 | 1,
  tintGround: number,
  pCol1: number,
  pCol2: number,
  blending: number,
  layer: number,
  baseCol: number,
  decorCol: number,
  color: number,
  z: number,
  order: number,
  moveX: number,
  moveY: number,
  easing: number,
  text: string,
  scale: number,
  parent: number,
  opacity: number,
  isTrigger: 0 | 1,
  hsvEnabled1: 0 | 1,
  hsvEnabled2: 0 | 1,
  hsv1: string,
  hsv2: string,
  fadeIn: number,
  hold: number,
  fadeOut: number,
  pulseType: number,
  copiedHSV: string,
  copiedID: number,
  targetGroupID: number,
  targetPulseType: number,
  seperation: number,
  activateGroup: number,
  groups: Array<number>,
  followX: number,
  followY: number,
  copyOpacity: number,
  layer2: number,
  spawnTriggered: number,
  spawnDelay: number,
  dontFade: number,
  mainOnly: number,
  detailOnly: number,
  dontEnter: number,
  degrees: number,
  times360: number,
  lockRotation: number,
  followID: number,
  xFollow: number,
  yFollow: number,
  shakeStrength: number,
  animationID: number,
  count: number,
  subtractCount: number,
  pickupMode: number,
  itemA: number,
  holdMode: number,
  touchToggle: number,
  shakeInterval: number,
  easingRate: number,
  exclusive: number,
  multiTrigger: number,
  countComparison: number,
  dualMode: number,
  followSpeed: number,
  followDelay: number,
  followOffset: number,
  onExit: number,
  dynamic: number,
  itemB: number,
  noGlow: number,
  rotationSpeed: number,
  noRotate: number,
  multiActivate: number,
  useTarget: number,
  targetCoords: number,
  disabled: number,
  highDetail: number,
  followMaxSpeed: number,
  randomizeStart: number,
  animationSpeed: number,
  linkedGroup: number
}

LevelSettings

Here are all the properties, a Geometry Dash level's settings object could have. Once again, none of them are required:

{
    "gamemode": number,
    "speed": number,

    "bg": ColorID,
    "g": ColorID,
    "font": number,
    "songoffset": number,

    "mini": 0 | 1,
    "dual": 0 | 1,
    "startPos": number,
    "2p": 0 | 1,
    "flipgravity": 0 | 1,
    "guidelines": Array<{ timestamp: number, color: number }>,
    "songfadein": number,
    "songfadeout": number,
    "line": number,
    
    "colors": Array<Object>,

    // old color system (used only for backwards-compatibility)
  
    "bgr": number,
    "bgg": number,
    "bgb": number,

    "gr": number,
    "gg": number,
    "gb": number,

    "liner": number,
    "lineg": number,
    "linen": number,

    "objr": number,
    "objg": number,
    "objb": number,

    "1r": number,
    "1g": number,
    "1b": number,

    "1blend": number,

    "bgp": number,
    "gp": number,
    "linep": number,
    "objp": number,
    "1p": number,

    "bgc": number,
    "gc": number,
    "linec": number,
    "objc": number,
    "1c": number,
    "2c": number,
    "3c": number,
    "4c": number,
    "3dlc": number
}

Contributing

All contribution is welcome! Feel free to leave an issue or submit a pull request on our Github repo