Scripting API

Scripting API

WorldSetup

Record in Abyss.Core, from Abyss.Core.

What a world has from the moment it is made: a window, assets, a renderer.

public record WorldSetup

Remarks

A world is set up when it is made, because a game's Rust plugins are installed last and find what is there — as a Bevy game's plugins come after Bevy's DefaultPlugins. A plugin that asks whether Bevy's clock is there before adding its own, or that sets up its drawing only if there is a renderer, is answered by what went in before it. Nothing adds any of these to a world afterwards.

A part left null is one the world does not have. A world with none is headless — every test, every benchmark, a dedicated server — and pays for none of it.

Example

using World world = World.Create(new WorldSetup{    Window = new WindowSetup("Orbit", 1280, 720),    Assets = new AssetSetup(Path.Combine(AppContext.BaseDirectory, "assets")),    Rendering = new RenderSetup(),});

Properties

Window

public WindowSetup? Window { get; init; }

The engine's window, and the input that comes through it.

Assets

public AssetSetup? Assets { get; init; }

The asset server and the asset types. A renderer brings them too, from Bevy's default root, when this is null.

Without a renderer too, because assets are not a rendering concept: mesh data is geometry, and a dedicated server that wants it for collision has no GPU to put it on.

Rendering

public RenderSetup? Rendering { get; init; }

The renderer, and the camera and light it starts with. Needs WorldSetup.Window, since it presents into one.

The GPU device is built asynchronously, so a host driving frames itself will get false from World.RunBevyFrame for the first few. Under RunFrameLoop the runner waits and the host never sees it.

Audio

public bool Audio { get; init; }

Whether sound is heard: played to the platform's output, where there is one, rather than to nothing. A world with assets plays sound either way, so a test runs a game's sound silently.