Skip to content

Portable Projects and Save Games

S.U.P.E edited this page Nov 6, 2026 · 1 revision

Portable Projects and Save Games

Since 2.7, every Heaven3D project is portable: you can zip the project folder and open it on any PC, on Windows, Linux or macOS. And games can save the player's progress with two calls.

Portable projects

Heaven3D does this every time you save:

  • Every model, texture and sound path is stored relative to the project (assets/...) with / separators, which work on every OS.
  • Anything imported from outside the project (Downloads, Desktop, another drive) is copied into assets/imported/ together with its side files:
    • .gltf → its .bin buffers and textures
    • .obj → its .mtl and textures
    • .blend → its external images
  • File names are made safe for Windows and Linux.
  • The previous save is kept as main.heaven3d.bak.

When loading, Heaven3D finds files even when:

  • the path uses either slash style
  • the letter case changed (Linux is case-sensitive, Windows isn't)
  • the path is home-relative or absolute from another machine
  • it points at FILE BURNER media/ output from older projects

💡 Put your assets in the project's assets/ folder before importing them and nothing needs copying at all.

FILE BURNER

FILEBURNER.py is the stand-alone tool that made projects portable before 2.7. It reads .heaven3d files, copies every referenced mesh, image and sound into a media/ folder and writes a new *_portable.heaven3d with retargeted paths (originals are never modified). It has a small Tk GUI:

python FILEBURNER.py

You don't need it for 2.7+ projects; it remains for converting old ones.

Finding project files from scripts

path = self.engine.asset_path("assets/music/theme.ogg")

asset_path resolves a project path wherever the project (or exported game) now lives. engine.audio and model loading already do this for you.

Save games

self.engine.save_game("slot1", {"coins": 7, "level": 2})
progress = self.engine.load_game("slot1", default={})
  • slot is a name ("save" by default); data must be JSON-serialisable.
  • Writes are atomic — a crash can never leave a half-written save.
  • The previous save is kept as <slot>.json.bak and used automatically if the main file is damaged.
  • load_game returns default when there is no save yet.

Where saves are stored

Situation Folder
Exported Windows / Linux game the game's own saves/ folder (moves with the game)
…if that folder isn't writable %APPDATA%\Heaven3D\<Game> (Windows) or ~/.local/share/heaven3d/<Game> (Linux)
Exported macOS game always ~/Library/Application Support/Heaven3D/<Game> (an app never writes inside itself)
Playing from the editor / Hub <project>/saves/

The log prints Game saves folder: … at start-up so you can find it.

Example: best time

@blueprint
class Timer(Blueprint):
    def on_begin_play(self):
        self.best = (self.engine.load_game("best", default={}) or {}).get("seconds")
        self.t = 0.0
    def on_tick(self, dt):
        self.t += dt
    def on_message(self, event, data):
        if event == "level_won" and (self.best is None or self.t < self.best):
            self.best = self.t
            self.engine.save_game("best", {"seconds": round(self.t, 2)})

The Coin Collector template and the Car Race Kit both use this pattern.

Clone this wiki locally