#save #rome #ironman #ergonomically #debugging #models #imperator

bin+lib imperator-save

Ergonomically work with Imperator Rome saves (debug and ironman)

19 releases

0.4.2 Oct 24, 2022
0.3.1 Jul 8, 2022
0.2.9 Mar 20, 2022
0.2.7 Jul 4, 2021
0.1.2 Oct 29, 2020

#1181 in Game dev

Download history 11/week @ 2024-02-26 263/week @ 2024-04-01

263 downloads per month

MIT license

41KB
946 lines

ci Version

Imperator Save

Imperator Save is a library to ergonomically work with Imperator Rome saves (debug + standard).

use imperator_save::{ImperatorFile, Encoding, EnvTokens, models::Save};

let data = std::fs::read("assets/saves/observer1.5.rome")?;
let file = ImperatorFile::from_slice(&data[..])?;
assert_eq!(file.encoding(), Encoding::BinaryZip);

let mut zip_sink = Vec::new();
let parsed_file = file.parse(&mut zip_sink)?;
let save = Save::from_deserializer(&parsed_file.deserializer(), &EnvTokens)?;
assert_eq!(save.meta.version, String::from("1.5.3"));
assert_eq!(save.meta.version, String::from("1.5.3"));

Ironman

By default, standard saves will not be decoded properly.

To enable support, one must supply an environment variable (IMPERATOR_TOKENS) that points to a newline delimited text file of token descriptions. For instance:

0xffff my_test_token
0xeeee my_test_token2

In order to comply with legal restrictions, I cannot share the list of tokens. I am also restricted from divulging how the list of tokens can be derived.

Dependencies

~1.6–2.5MB
~56K SLoC