Scripting API

Scripting API

Pack

Class in Abyss.Core, from Abyss.Core.

A game's assets as a built game reads them: game.abypack, every asset in the engine's own forms, each entry compressed with LZ4 where that makes it smaller, found by its path.

public sealed class Pack : IDisposable

Remarks

Read from any thread. Each read is made at the entry's place in the file, so a scene read off the frame does not wait on a texture read on another thread. A world reads the rest of the same file through its own copy of it, mounted with World.MountPack.

Written by PackWriter; the layout is the engine's, abyss_core::pack.

Properties

Path

public string Path { get; }

Where it was opened from.

Methods

Open

public static Pack Open(string path)

Opens a pack and reads its table; no entry is read until it is asked for.

Parameters

  • path

Exceptions

  • AbyssException: The file cannot be read, or is not a pack this build reads.

Find

public (PackEntryKind Kind, long Length) Find(string name)

What the pack holds under a path, and how many bytes; PackEntryKind.None for nothing.

Parameters

  • name: The path, as a game asks for it: scenes/level.scene.

Read

public byte[]? Read(string name)

What the pack holds under a path, made whole and checked against its hash; null for nothing.

Parameters

  • name

Exceptions

  • AbyssException: The entry cannot be read, or is not what the pack says it is.

Dispose

public void Dispose()

Closes it.

Constants

Main

public const string Main = "game.abypack"

The name a built game's main pack has, beside its executable.

Extension

public const string Extension = ".abypack"

What a pack's file ends with.

InArchive

public const string InArchive = "!/"

What separates an archive's path from the path of a pack in it: game.apk!/assets/game.abypack, as Android names a library its loader reads out of an APK. A pack an archive keeps as it is, not compressed, is opened by such a path and read where it lies.

ModelPrefabLabel

public const string ModelPrefabLabel = "#Prefab"

What a model's prefab is called in a pack, after the model's path: models/pyramid.gltf#Prefab, beside the model's mesh, which has the path itself.

ModelAnimationLabel

public const string ModelAnimationLabel = "#Animation"

What a pack calls a model's skins and clips: the model's path and this, models/fox.gltf#Animation.

ModelDescriptionLabel

public const string ModelDescriptionLabel = "#Description"

What a pack calls a model's description: the model's path and this, models/door.gltf#Description.

ModelBakedLabel

public const string ModelBakedLabel = "#Baked/"

What a pack calls what a package baked of a model: the model's path, this and the baker, models/door.gltf#Baked/abyss.physics3d.