Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

procgen.spawn

Stands a saved .procGraph in the scene as a live generator, in one call: an entity carrying a Generator component bound to the graph. The generator cooks the graph on its own runner and stands what its io.output calls show, and it cooks again whenever its params change, so the graph stays live while you iterate on it with procgen.adjust. procgen.apply swaps it for the asset it makes once it is done.

  • graph names the .procGraph asset, by its VFS path or its name. A graph held only in memory has no asset for a generator to play, so it is refused.
  • name is the entity's name (default: the graph's identity, such as scratch.Box).
  • position is a { x, y, z } world position.
  • output names a declared output; the generator then plays the part of the graph that output depends on (default: the whole graph).
  • params are the first overrides of the graph's inputs, by name.

The cook runs after the call returns, so children counts what stood under the entity when it answered, which is 0 for a graph still cooking. procgen.generators and procgen.cooks show the cook's progress.

tools.use("procgen", "spawn", { graph = "/source/scratch/Box.procGraph", name = "Box", position = { 0, 0, 0 } })

Part of procgen.toolbox, called as tools.use("procgen", "spawn", ...) (zero procgen spawn in the engine shell). Returns { entity, name, graph, children }: the new entity's id, its name, the graph's identity and its child count.