Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the file format of pxo to be a ZIP #952

Merged
merged 3 commits into from
Dec 4, 2023

Conversation

OverloadedOrama
Copy link
Member

@OverloadedOrama OverloadedOrama commented Dec 1, 2023

Implements #939, solution 1. This PR makes .pxo files be .zip files in disguise, i.e., changing the extension from pxo to zip actually lets you open the file in a archive manager and view its content. Breaks forward compatibility with 0.x, meaning that pxo files exported with 1.x will not be able to be imported in 0.x. The opposite is true, however, pxos made with 0.x can be imported in 1.x.

Also provides an option to include the final blended images of each layer for easier importing by other software, and exporting with CLI, when it gets implemented. The option is disabled by default so save disk space and to reduce saving time.

The main reasons I think this solution is better than going with SQLite is that Godot already supports zip packing and reading, while SQLite would require a GDExtension which could be troublesome for cross-platform support, such as Web, and the second reason is that zips should be easier to import by other software. Any Godot 4-made software/addons can read zip files, for example.

Most project files seem to be smaller as zips compared to the previous pxo format. A 200x128 project with 15 layers and 159 frames when exported to the previous pxo format, with ZSTD compression, takes 3.1MB of space. The same project takes just 1.6MB as a zip, and 2.2MB as a zip when the final blended images are included. However, both loading and saving seems to be taking longer than the previous format. Saving could perhaps get optimized by just overwriting only the files that have new changes, and not remaking the entire file from scratch, but that's something for the future. This optimization is something that couldn't have been done so easily with the previous format, if at all.

The structure of the zip is the following (files are in italic, the rest are directories):

root
├── image_data
│ ├── frames
│ │ └── 1
│ │ | └── layer_1
│ │ | └── layer_2
│ │ | └── layer_3... etc for each layer
│ │ └── 2
│ │ └── 3... etc for each frame
│ └── brushes
│ │ └── brush_1 (etc for each project brush)
│ └── final_images (only included if "Include blended images" is enabled when saving)
│ │ └── 1
│ │ └── 2
│ │ └── 3... etc for each frame
│ └── tile_mask
├── data.json

Note that saving doesn't currently work on the Web version due to godotengine/godot#85564.

@OverloadedOrama OverloadedOrama merged commit 29f4f52 into Orama-Interactive:master Dec 4, 2023
4 checks passed
@OverloadedOrama OverloadedOrama deleted the pxo-zip branch December 5, 2023 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant