Skip to content

[Feature] Improve stack experience templates for adding extra Wasm mods #67

@yunnwi

Description

@yunnwi

Problem / Motivation

While adding a second runtime-loaded Wasm mod to a devkit-generated stack experience, I ran into some confusion around the template layout and stack config.

The generated stack experience already had a layer with worldgen configured through layers.defaults and the worldgen mod listed under layers.mods.

I wanted to add another Wasm mod that provides a character controller and client control provider:

character_controller = "yunnwi.flight:controller"
client_control_provider = "yunnwi.flight:controls"

At first I added the mod as a root-level mods entry, but the experience still selected the Vanilla humanoid controller. The relevant startup log made the issue visible:

selected inproc worldgen + character controller worldgen_key="yunnwi.terrain:terrain" character_controller_key="freven.vanilla:humanoid"

The working setup was to add the mod under layers.mods and select the controller/provider through layers.defaults.

This was not obvious from the template, especially for someone trying to combine multiple Wasm mods in one stack experience.

Proposed solution

Add a commented example to the stack experience template showing how to add an extra runtime-loaded Wasm mod and select provider keys from it.

Example shape:

[layers.defaults]
worldgen = "example.worldgen:terrain"
character_controller = "example.flight:controller"
client_control_provider = "example.flight:controls"

[[layers.mods]]
id = "example.worldgen"
version = "^0.1"

[[layers.mods]]
id = "example.flight"
version = "^0.1"

It would also help to document:

  • when stack experiences should use layers.mods
  • whether root-level mods is valid or ignored in stack experiences
  • how layers.defaults resolves worldgen, character_controller, and client_control_provider
  • how to combine multiple runtime-loaded Wasm mods in one experience
  • how to recognize from logs which controller/provider was actually selected

A small “two-mod stack” example would be especially useful:

  • one Wasm mod for worldgen
  • one Wasm mod for character controller / client control provider

Alternatives considered

Current workaround:

  • manually inspect the generated experience.stack.toml
  • add the second mod under layers.mods
  • manually set character_controller and client_control_provider in layers.defaults
  • relaunch and check logs to confirm the selected keys changed

Example use case:
https://github.com/yunnwi/yunnwi-flight-mod

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions