Search by

vipertecpro / game3d-save

vipertecpro

Save slots for game3d games: versioned, checksummed, migrated and recovered, written safely on the phone.

Package info

github.com/vipertecpro/game3d-save

pkg:composer/vipertecpro/game3d-save

Statistics

Installs: 0

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-11-28 16:05 UTC

This package is auto-updated.

Last update: 2026-11-28 20:03:25 UTC


README

Latest version Tests PHP game3d Platforms Licence Downloads

An add-on for game3d, a paid plugin for NativePHP Mobile sold at https://vipertecpro.com/products/game3d-engine (Android only). This add-on is free and MIT, and needs game3d to run. It is an independent project, not made or endorsed by NativePHP.

Save slots for games made with game3d: versioned, checksummed, migrated as the game changes, and recovered when a slot is damaged. PHP only, MIT.

use Vipertecpro\Game3dSave\Save;

Save::schema(2, 'main')->migrate(1, fn (array $d) => ['coins' => $d['gold']], 'main');

Save::slot('main')->write(['level' => 3, 'coins' => 120]);
$loaded = Save::slot('main')->load();     // ->status, ->data, ->savedAt

Save::autosave('main', fn () => $this->state(), minSeconds: 2);
Save::touch('main');                      // at most once every 2 s
Save::flush();                            // what waits, now

In a scene, ->checkpoint('main') saves from the engine: in a command list (a finish line's contact rule) it needs no round trip of its own.

Install

This add-on needs a game3d licence. From your dashboard at vipertecpro.com, add the game3d Composer repository and key (the two composer config commands shown there), then:

composer require vipertecpro/game3d-save
  • Where: storage/app/game3d-save, the app's own files on the phone.
  • Safe writes: a temporary file renamed into place; the slot before it is kept as <slot>.bak.
  • Damage: a slot cut short or edited (its checksum fails) loads its backup: Recovered. With both damaged it is Corrupt, kept as <slot>.corrupt.
  • Versions: each slot has its own schema() and migrate() steps (main by default), run on load, so a game's migrations never touch another slot (the economy's). A slot from a newer game is read (Newer) and never written over, nor its backup.
  • Names: slot names are letters, digits, - and _.
  • Not a lock: the checksum finds damage; it does not stop players editing their own saves.

Testing

The tests need game3d ^2.1, which is not public, so they run where a licensed copy is installed: add the game3d repository as in Install, then run composer install and vendor/bin/pest.