Forest Logo
search
package_2

planck

By @uxnknwn

Roblox

Mirrored

Planck, an ECS Scheduler

GitHub License Documentation Wally Package

An Agnostic Scheduler, inspired by Bevy Schedules and Flecs Pipelines and Phases.

[!IMPORTANT]
The Planck Scheduler and it's plugins are currently in development! You can find a release candidate under yetanotherclown/planck@0.1.0-rc.1

Installation

You can install Planck with Wally

[dependencies]
Planck = "yetanotherclown/planck@0.1.0-rc.1"

Basics

Phases

A Phase is just a tag you can assign to your systems, it's a way to order systems as a group.

local myPhase = Phase.new("debugName")

scheduler
    :insert(myPhase, RunService, "Heartbeat")
    :addSystems(systemA, myPhase)

Pipelines

A Pipeline is a group of ordered phases. Each phase will run in the fixed order to which each Phase was passed to it.

local myPipeline = Pipeline.new()
    :insert(phaseA)
    :insert(phaseB)
    :insert(phaseC)

scheduler
    :insert(myPipeline, RunService, "Heartbeat")

Built-in Pipelines & Phases

Startup

Systems on these phases will run exactly once, before any other phase runs.

  • PreStartup
  • Startup
  • PostStartup
local Planck = require("@packages/Planck")
local Phase = Planck.Phase

local PreStartup = Phase.PreStartup
local Startup = Phase.Startup
local PostStartup = Phase.PostStartup

Engine Events

These Phases are ran on Engine RunService Events, events are ran in the order listed.

EventPhase
PreRenderPreRender
PreAnimationPreAnimation
PreSimulationPreSimulation
PostSimulationPostSimulation
HeartbeatUpdate
local Planck = require("@packages/Planck")
local Phase = Planck.Phase

local PreRender = Phase.PreRender
local PreAnimation = Phase.PreAnimation
local PreSimulation = Phase.PreSimulation
local PostSimulation = Phase.PostSimulation
local Update = Phase.Update

Main

The Main Pipeline will run phases on the RunService.Heartbeat event.

  • First
  • PreUpdate
  • Update
  • PostUpdate
  • Last
local Planck = require("@packages/Planck")
local Phase = Planck.Phase

local First = Phase.First
local PreUpdate = Phase.PreUpdate
local Update = Phase.Update
local PostUpdate = Phase.PostUpdate
local Last = Phase.Last

Systems

A system is just a function, or it could be a system table.

local systemA = {
    phase = myPhase,
    system = function()
        -- ...
    end,
}

local function systemB()
    -- ...
end

scheduler
    :addSystems(systemA)
    :addSystems(systemB, myPhase)

The Scheduler

The Scheduler is where you initialize all your Pipelines, Phases, and Systems.

local Planck = require("@packages/Planck")

local Phase = Planck.Phase
local Pipeline = Planck.Pipeline
local Scheduler = Planck.Scheduler

local PreUpdate = Phase.new()
local Update = Phase.new()
local PostUpdate = Phase.new()

local UpdatePipeline = Pipeline.new()
	:insert(PreUpdate)
	:insert(Update)
	:insert(PostUpdate)

local Render = Phase.new()

local scheduler = scheduler.new(world)
    :insert(UpdatePipeline, RunService, "Heartbeat")
    :insertAfter(Render, UpdatePipeline)
    :addSystems(systems, Update)

scheduler:removeSystem(systemA)
scheduler:replaceSystem(systemA, systemB)

scheduler:editSystem(systemA, newPhase)
scheduler:editSystem(systemA)

scheduler:setRunCondition(systemA, function(world)
    return someCondition and true or false
end)

Plugins

The Planck Scheduler is pluggable, providing plugins to add support for Jabby and the Matter Hooks runtime.

You can learn more in the Plugin Docs.

Package Details

Install command (Click to copy)


Version

0.1.0-rc.1

License

MIT

check_circle

Safe for commercial use

Automated license review — not legal advice.