Tools to load and inspect I Fetch Rocks save files.
Project description
i-fetch-rocks-sim
A Python package for loading, inspecting, and simulating I Fetch Rocks save files.
The package reconstructs the in-game wire diagram from a save file as a Python object graph and lets you:
- Inspect rooms, devices, and wires without loading the game.
- Visualise the wire network as an interactive HTML graph (powered by pyvis).
- Simulate the circuit tick-by-tick to capture signal values and trace behaviour.
Install
pip install ifetchrocks-sim
Or for local/editable development:
python -m venv .venv
.venv\Scripts\python -m pip install --upgrade pip
.venv\Scripts\pip install -e .[dev]
Reading a save file
Load a save and inspect the structured ship model:
from ifetchrocks_sim import SaveReader
reader = SaveReader()
save = reader.load_save_path("path/to/save.json")
print(save.ship.component_count()) # total component nodes
print(len(save.ship.rooms)) # room count
print(len(save.ship.floating)) # floating device count
summary = reader.load_path("path/to/save.json")
print(summary.room_count, summary.floating_count, summary.device_count)
Simulating ticks
from ifetchrocks_sim import Simulator
sim = Simulator()
with open("path/to/save.json") as f:
sim.load_from_file(f)
# Record wire values across ticks
sim.capture_uuid("abcd1234-...") # full UUID or unique prefix
for tick in range(20):
sim.set_tick(tick)
# {tick: {wire_uuid: [values]}}
capture = sim.get_capture()
for tick, wires in sorted(capture.items()):
for wire_uuid, values in wires.items():
print(f"tick={tick} wire={wire_uuid[:8]} values={values}")
Wire tracing
# What drives this wire?
sim.print_backtrace("abcd1234")
# What does this wire feed?
sim.print_forwardtrace("abcd1234")
# Or use the module-level helpers directly
from ifetchrocks_sim import print_backtrace, print_forwardtrace
print_backtrace(sim, "abcd1234")
# Find a signal path between two wires
path = sim.find_signal_path("source-prefix", "target-prefix")
Wire diff
before = sim.snapshot_wire_values()
sim.set_tick(1)
after = sim.snapshot_wire_values()
for diff in sim.diff_wires(before, after):
print(diff.uuid[:8], diff.before, "->", diff.after)
Labelling wires and devices
sim.set_wire_label("abcd1234", "program_counter")
sim.set_device_label("ffff0000", "alu_register")
sim.save_labels("my_labels.json")
sim.load_labels("my_labels.json")
Generating an HTML wire-graph
network = sim.build_graph_network(room_filters=["LIFE_SUPPORT", "HELM"])
network.write_html("wiring.html")
# All rooms, no power wires
network = sim.build_graph_network(room_filters=[], show_power_wires=False)
Open wiring.html in any browser to explore the interactive node graph.
Room and device inventory
# Find unimplemented/unknown devices in the save
for entry in sim.list_unknown_devices():
print(entry.type_id, entry.uuid[:8], entry.room)
# Compare two saves
diff = sim.diff_saves("before.json", "after.json")
print(diff.device_count_deltas)
Package layout
ifetchrocks_sim/
├── simulator.py # Simulator — main entry point
├── reader.py # SaveReader — lightweight save-file parser
├── models.py # SaveModel, ShipModel, ComponentNode, SaveSummary
├── backtrace.py # backtrace_wire / forwardtrace_wire helpers
├── analysis.py # signal-change analysis utilities
├── labels.py # LabelRegistry — wire/device label store
├── recording.py # WireRecorder — time-series wire capture
├── re_tools.py # reverse-engineering probe utilities
├── validation.py # health_check — wiring sanity checks
├── cli.py # CLI entry point (python -m ifetchrocks_sim)
├── stub_generator.py # generate device stub skeletons
├── _drive_loader.py # internal: load drive .bin files for MemoryBaySignal
├── devices/ # all in-game device implementations
├── network/ # DataNetwork / LargeDataNetwork / DataNetworkManager
└── testing/ # CircuitBuilder and wire assertion helpers
Development
.venv\Scripts\pytest # run tests
.venv\Scripts\ruff check . # lint
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ifetchrocks_sim-0.1.0.tar.gz.
File metadata
- Download URL: ifetchrocks_sim-0.1.0.tar.gz
- Upload date:
- Size: 101.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c621fc56a75619cb9142e931d1e3f4dcd805a4e997a74e7534891c2bb8324cb
|
|
| MD5 |
3bd1417f1d267f22b017d7d5c552b8af
|
|
| BLAKE2b-256 |
e8720ba6fd4b5e4e3bc7bfa4a216ba8b75e54a1b2cdb8e5ec1bf7d9cf8969443
|
Provenance
The following attestation bundles were made for ifetchrocks_sim-0.1.0.tar.gz:
Publisher:
publish.yml on securitycopper/i-fetch-rocks-sim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ifetchrocks_sim-0.1.0.tar.gz -
Subject digest:
3c621fc56a75619cb9142e931d1e3f4dcd805a4e997a74e7534891c2bb8324cb - Sigstore transparency entry: 1661131532
- Sigstore integration time:
-
Permalink:
securitycopper/i-fetch-rocks-sim@c69999d857b4c531eda4d7f782294e7138b7df38 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/securitycopper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c69999d857b4c531eda4d7f782294e7138b7df38 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ifetchrocks_sim-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ifetchrocks_sim-0.1.0-py3-none-any.whl
- Upload date:
- Size: 169.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
534f6cb383926ebda576ff3e2090d9f56a630115f10c13f5a8c6e7e188fd4a98
|
|
| MD5 |
7631277dcad2b5c5e45600e7b329e7ff
|
|
| BLAKE2b-256 |
e3a36bb940a66950e40006a8acd5692eb9a51e770880d2c908b4ad43e49a4991
|
Provenance
The following attestation bundles were made for ifetchrocks_sim-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on securitycopper/i-fetch-rocks-sim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ifetchrocks_sim-0.1.0-py3-none-any.whl -
Subject digest:
534f6cb383926ebda576ff3e2090d9f56a630115f10c13f5a8c6e7e188fd4a98 - Sigstore transparency entry: 1661131679
- Sigstore integration time:
-
Permalink:
securitycopper/i-fetch-rocks-sim@c69999d857b4c531eda4d7f782294e7138b7df38 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/securitycopper
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c69999d857b4c531eda4d7f782294e7138b7df38 -
Trigger Event:
release
-
Statement type: