About arcpak
*.arcpak is the Arcomage Package file format, essentially a ZIP archive.
Each arcpak must include a metadata.yaml file that describes the package contents.
At launch, arcpak should support:
- Modifying existing game resources and adding new ones.
- Creating new localizations and translations as mods.
- Introducing entirely new card decks.
- Executing WASM scripts.
- Managing dependencies between packages.
The first planned arcpak will feature the MM7 deck.
Why WASM (WebAssembly)?
Recently, I researched executing custom user scripts in Arcomage and discovered that Microsoft Flight Simulator uses WebAssembly (WASM) for modding. This approach caught my attention, so I explored why WASM is a solid choice.
In short, WASM is safe (as code runs in a sandbox) and highly portable, making it an excellent option for modding.
Environment File (env.ts) for the Modding API
The env.ts file defines external functions provided by the host environment that are accessible to WebAssembly modules. These functions allow mods to interact with the game engine through a predefined set of host-side APIs.
For example, a basic env.ts file might look like this:
@external("env", "host_log")
declare function host_log(ptr: i32, len: i32): void;
export function log(message: string): void {
const encoded = String.UTF8.encode(message);
host_log(changetype<i32>(encoded), encoded.byteLength);
}
Here, host_log is a function exposed by the host, allowing mods to log messages from within WebAssembly.
The env.ts file serves as a bridge between the game engine and WebAssembly-based mods, enabling them to call predefined host functions for seamless integration.
ModManager*.arcpakarchive supportModApiwithinModManagerenv.ts) for the Modding APIAbout
arcpak*.arcpakis the Arcomage Package file format, essentially a ZIP archive.Each
arcpakmust include ametadata.yamlfile that describes the package contents.At launch,
arcpakshould support:The first planned
arcpakwill feature the MM7 deck.Why WASM (WebAssembly)?
Recently, I researched executing custom user scripts in Arcomage and discovered that Microsoft Flight Simulator uses WebAssembly (WASM) for modding. This approach caught my attention, so I explored why WASM is a solid choice.
In short, WASM is safe (as code runs in a sandbox) and highly portable, making it an excellent option for modding.
Environment File (
env.ts) for the Modding APIThe
env.tsfile defines external functions provided by the host environment that are accessible to WebAssembly modules. These functions allow mods to interact with the game engine through a predefined set of host-side APIs.For example, a basic
env.tsfile might look like this:Here,
host_logis a function exposed by the host, allowing mods to log messages from within WebAssembly.The
env.tsfile serves as a bridge between the game engine and WebAssembly-based mods, enabling them to call predefined host functions for seamless integration.