Bevy AssetIO Plugin For Reading Optionally Obfuscated Zips #1398
zicklag
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everybody! I just released a Bevy plugin that allows you to bundle your assets for your game in an optionally obfuscated zip file:
bevy_assetio_zip.The obfuscated zip option will scramble the bits of the asset zip by XOR-ing the bytes to make it unrecognizable without XOR-ing it again. It is no real protection, but it does prevent the casual user from being able to recognize the asset format. The plugin by default will read assets from either an
assets.zipor anassets.binfile and will fall back to the default bevy asset loader if it can't find an asset in the bundle.Usage
Simply enable the plugin when setting up your Bevy app to enable loading from asset bundle
files.
Once enabling the plugin, the game will now search for
assets.zipandassets.binfilesadjacent to the executable when attempting to load assets. If an asset is not found in the zip
file, it will attempt to load the asset using the default Bevy asset loader for the target
platform.
Types of Asset Bundles
There are two kinds of asset bundle files supported by this plugin, plain
.zipfiles andobfuscated zip files ( which have a
.binextension ). Plain.zipfiles are typical zip filesthat can be created with normal zip software. Obfuscated zip files can be created with
[
bevy_assetio_zip_bundler] and are simply a normal zip file that has had the bytes XOR-ed by0b01010101.Bundling Assets
To bundle your bevy assets you can use the [
bevy_assetio_zip_bundler] crate. The easiest wayto use it is to add this to your
build.rsfile:This will automatically zip up your crate's
assetsfolder and put it in yourtarget/dirwhen compiling release builds. When distributing your application simply take your asset bundle
and place it adjacent to the executable and Bevy will attempt to load assets from the bundle
before falling back to the
assetsdir.You can configure the name, obfuscation, and compression of the bundle by creating and
asset_config.tomlfile next to yourCargo.tomlfile:Alternatively, if you want to create your own tooling or customize the asset bundling process,
you can manually bundle the assets using the
bevy_assetio_zip_bundler::bundle_assetsfunction.
Beta Was this translation helpful? Give feedback.
All reactions