XSharp

Asset assemblies for player profiles

XSharp.Assets.Common contains the shared player projection, buster and effect sheets, plus the default profile descriptors. The core loads its resources during precache. XSharp.Assets.X1, XSharp.Assets.X2 and XSharp.Assets.X3 are optional data assemblies. Each has profile descriptors and can embed the corresponding audio collection already present under XSharp/Assets/Sounds/Native. The projects define no gameplay types and reference no engine or backend. Build the desired projects individually.

The X1/X2/X3 packages also embed Menus/X1/equipment.xmenu, Menus/X2/equipment.xmenu and Menus/X3/equipment.xmenu and the native pause-menu descriptors selected by their player bundles. The menu graphics are pre-extracted and do not require a ROM at runtime. See native menus for the validated display scope and timing work that remains, and PauseMenuExtractor for regeneration.

Mount the assemblies in the host configuration callback before selecting a profile. This example assumes the host already references the X2 asset project.

Action<BaseEngine> configure = engine =>
{
    engine.RegisterAssetAssembly(System.Reflection.Assembly.Load("XSharp.Assets.X2"));
    engine.ApplyPlayerProfileAsset("Profiles/X2/player.json");
};
BaseEngine.Initialize(hostType, initializers, modules, gameManager, configure);

The desktop demo and level sandbox also accept repeated --asset-package=<local-assembly-path> arguments and a --player-profile-asset=<logical-resource-path> argument. Relative assembly paths resolve from the directory that launched the host.

The player descriptor can include an armor path, a pauseMenu path and a weapons array of special-weapon descriptor paths. Omitted sections retain the host configuration. JSON null resets armor to its defaults or disables the menu. When a bundle lists weapons, call ApplyPlayerProfileAsset from the host configuration callback and supply a SpecialWeaponController resolver. The resolver matches descriptors to the host’s firing and precache callbacks. Missing bindings, repeated weapon IDs and collisions with existing registrations are detected before settings are applied. The asset assemblies contain only data. The stock launcher selects bundles that require no host-specific weapon bindings.

Use LoadPlayerProfileAsset to inspect or select only the movement, buster, audio and visual profile. It does not apply the equipment. At runtime the game manager still owns equipment grants and ammo, and save states restore them.

Custom assemblies can use the same logical resource paths. Use OpenAssetForPrecache for descriptors and palette data and CreateImageTextureFromAsset for textures. A host can mount a custom replacement for the shared images using their existing logical resource names. Each mounted path has one owner. The default package supplies unoverridden shared resources.

Audio uses the same manifest schema, identifiers, hashes, loop coordinates and save-state keys as loose assets. Per-path lookups prefer mounted resources and then check the existing sound directory. The engine verifies and decodes audio while preparing the level. Playback uses the prepared PCM cache. The data assemblies use existing project assets. Original per-game character art, armor, special weapons and pause-menu assets are separate content work.

player.json can reference a physicsAsset path. Existing profile files can still use physics with a preset name or null for the host’s selection. A host can also set engine.PlayerPhysics independently with LoadPlayerPhysicsAsset("Profiles/X2/physics.json").

A movement descriptor selects one of common, legacy, x1, x2 and x3 through base. Omitted settings inherit that preset. For example, a custom package can disable held-dash ground jumps:

{
  "schema": 1,
  "kind": "physics",
  "base": "x2",
  "name": "MyMovement",
  "overrides": {
    "AllowHeldDashGroundJumps": false,
    "Gravity": 16384
  }
}

Use the exact movement property names in overrides. Fixed-point numbers use 16.16 raw units (65536 per pixel). Durations and input delays use whole frames. A collision box is six fixed-point numbers in origin XY, minimum XY, maximum XY order. Optional overrides such as TopLadderDescendOffset accept null to clear an inherited value.

The audio descriptor accepts independent combat and collection maps. The combat keys are enemyExplosion, enemyDamage, bossDamage, shotReflection and rideArmorPunch. Every entry supplies game, a numeric command, and an optional context (defaults to Common). A missing action uses the base profile. The equipment profile documentation describes pickup keys and the loaders for armor, weapon and pause menu assets.

tools/Test-AssetAssemblies.ps1 compares embedded resources with their source files. XSharp.Audio.Tests also tests reads from a resource-only fixture with no loose sound directory, including WAV, FLAC, MP3 and loop metadata.