Skip to content

Redesign ship pickling #9

@JensAyton

Description

@JensAyton

When saving a game with scanned wormholes, we save ships by making a mutable copy of their shipdata dictionaries, modifying it to reflect some aspects of the ship’s current state, then saving the difference between the modified dictionary and the original. (This is implemented in ShipEntityLoadRestore.m.) On load, the dictionary is merged into the version from the ship registry and used to set up a new ship.

With the change to explicit “ship class” objects (ongoing work in feature-ship-class-model), this approach will no longer be feasible. Instead, we need to store the mutated state and apply it after setting up the ship from the ship class object.

As part of the change to ship class objects, immutable ship properties will lose their instance variables and instead fetch their values from the ship class. This will make it more explicit what properties are in fact mutable and useful to store in the pickled ships.

It may be difficult to update existing saved games after this transition. I feel it’s reasonable to drop pickled wormhole ships when upgrading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions