All Projects → RoboPhred → oni-save-parser

RoboPhred / oni-save-parser

Licence: MIT license
Parses save files for the game "Oxygen Not Included".

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to oni-save-parser

blackchocobo
Save Editor For Final Fantasy VII
Stars: ✭ 43 (+30.3%)
Mutual labels:  save-editor
NomNom
NomNom is the most complete savegame editor for NMS but also shows additional information around the data you're about to change. You can also easily look up each item individually to examine its attributes, independently of a savegame, or get other useful information that are not related to a specific savegame (but enhanced if one is loaded).
Stars: ✭ 167 (+406.06%)
Mutual labels:  save-editor
R3ditor
An open-source project created to reverse-engineering some Resident Evil 3 files
Stars: ✭ 19 (-42.42%)
Mutual labels:  save-editor
Ultimate-Smasher
A Super Smash Bros. Ultimate save editor written in Python
Stars: ✭ 77 (+133.33%)
Mutual labels:  save-editor
NieRAutomata Inventory Editor
Work in progress inventory editor for NieR:Automata.
Stars: ✭ 23 (-30.3%)
Mutual labels:  save-editor
HWL-SaveEditor
An Save-Editor for the game Hyrule Warriors Legends (Nintendo 3DS)
Stars: ✭ 18 (-45.45%)
Mutual labels:  save-editor
AutoSave.nvim
🧶 Automatically save your changes in NeoVim
Stars: ✭ 349 (+957.58%)
Mutual labels:  save-editor
D3Edit
A script to encrypt/decrypt and modify Diablo III saves
Stars: ✭ 35 (+6.06%)
Mutual labels:  save-editor
borderlands3-save-editor
got tired trying to beat the katagawa ball^W^Wempowered scholar, and no accessible in-game console, so here we are
Stars: ✭ 36 (+9.09%)
Mutual labels:  save-editor
Pkhex
Pokémon Save File Editor
Stars: ✭ 1,781 (+5296.97%)
Mutual labels:  save-editor
save-workspace-atom-plugin
If you work with few projects same time this plugin give you the opportunity to change your workspace faster. Save your workspace, all your opened tabs, cursor position, etc. for each task you are working with.
Stars: ✭ 24 (-27.27%)
Mutual labels:  save-editor
NieRAutomata-SteamID64-Editor
Allows users to edit the SteamID64 stored in the save files of NieR:Automata.
Stars: ✭ 16 (-51.52%)
Mutual labels:  save-editor
apollo-ps4
Apollo Save Tool (PS4)
Stars: ✭ 116 (+251.52%)
Mutual labels:  save-editor
OctopathTraveler
Switch OctopathTraveler SaveDate Editor
Stars: ✭ 32 (-3.03%)
Mutual labels:  save-editor
Gibbed.Borderlands
Tools & code for use with Borderlands.
Stars: ✭ 44 (+33.33%)
Mutual labels:  save-editor
Battle-Cats-Save-File-Editor
Battle Cats Save File Editor made in C# that requires root/rooted emulator and a PC
Stars: ✭ 26 (-21.21%)
Mutual labels:  save-editor
hollow
Online Hollow Knight save file editor .
Stars: ✭ 89 (+169.7%)
Mutual labels:  save-editor
PD2SE
Save editor for PAYDAY 2. All data types, encryption, hashing, and encoding aspects of save format have been reversed and re-implemented.
Stars: ✭ 13 (-60.61%)
Mutual labels:  save-editor
Oni
Oni: Modern Modal Editing - powered by Neovim
Stars: ✭ 11,466 (+34645.45%)
Mutual labels:  oni
Oni2
Native, lightweight modal code editor
Stars: ✭ 6,704 (+20215.15%)
Mutual labels:  oni

oni-save-parser

This library parses and writes save data from Oxygen Not Included. It is intended for both nodejs and web environments (through webpack or rollup).

This is a utility library for editing saves. If you are looking for a way to edit your save files, you can do so using Duplicity.

Game Compatibility

This library currently supports the Automation Innovation Update (save version 7.17).

This library intends to parse the most recent version of the save file as tracked by the stable (non-test) version of the game. Old versions will not be supported, and changes in test branches will not be integrated until the feature makes its way to the public stable version.

API

  • parseOniSave(ArrayBuffer): SaveGame Parses an ArrayBuffer of data into a save game object.

  • writeOniSave(SaveGame): ArrayBuffer Writes a save game object into an array buffer.

Typedefs

Typescript typedefs are included in this package, ready for use by typescript or any IDE that supports them.

Design Philosophy

Idempotent load-save cycle

This library intends to provide an idempotent load/save cycle: A save file that is loaded then written should generate a new file with identical content to the original. While the resulting file may differ due to implementation differences in the zlib compression library, the uncompressed content should be identical.

Due to this, the api uses arrays of key-value tuples rather than objects or Maps. This is required to guarantee the ordering of the elements remains the same.

The intent is to ensure as little data changes in the save as possible, to guard against potential cases where the ONI code makes assumptions or contains bugs regarding the ordering of data in data structures that might otherwise seem unordered.

A practical upshot of this is that the guaranteed order allows us to efficiently test the parser by round-trip loading and saving a file. By recording each parse instruction used when loading a file, we can ensure we receive the same write-equivalent instructions on saving. Any differences detected indicates that either the load or save operation is treating data differently than its counterpart, indicating a logic error. This check is made possible by the trampoline parser. See below for more information.

Instruction-based 'trampoline' parser

Parsing and unparsing is done through functions that generate and yield instructions to a top level parser. This buys us several advantages:

  • Ability to pause / delay / cancel / 'coroutine' the parse operation for environments that do not have threads.
  • Ability to replace the parser with a test implementation to ensure the expected operations are being performed.
  • Ability to inspect the parse progress, for use with progress reporting.
  • Ability to include extranious information such as the current parse target, for use with progress reporting and error handling.

Example usage

const { readFileSync } = require("fs");
const {
    parseSaveGame,
    writeSaveGame,
    AIAttributeLevelsBehavior
} = require("oni-save-parser");

function loadFile(fileName) {
  const fileData = readFileSync(`./test-data/${fileName}.sav`);
  return parseSaveGame(fileData.buffer);
}

function saveFile(fileName, save) {
  const fileData = writeSaveGame(save);
  writeFileSync(`./test-data/${fileName}.sav`, new Uint8Array(fileData));
}

const saveData = loadFile(fileName);

// Make all duplicants half-sized
const minions = saveData.gameObjects.find(x => x.name === "Minion")!;
for (const minion of minions.gameObjects) {
  minion.scale.x = 0.5;
  minion.scale.y = 0.5;
}

// Modify attributes of all duplicants
for (const minion of minions.gameObjects) {
  const skillBehavior = getBehavior(minion, AIAttributeLevelsBehavior);
  // Set each attribute to 10
  for (const attribute of skillBehavior.templateData.saveLoadLevels) {
    attribute.level = 10
  }
}

saveFile(`${fileName}-tweaked`, saveData);

Current Progress

Data can be loaded by parseOniSave(source: ArrayBuffer), and the data written out using writeOniSave(save: OniSave): ArrayBuffer. Brand new saves cannot be created, as the world data format is not understood. This data is preserved as-is when a save is parsed then re-written.

The save file and all templated data objects are loaded. This includes most of the interesting stuff, like duplicant stats, building attributes, and so on. Some information is still not parsed, such as the general world map and some specific data for a few of the more esoteric game objects.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].