Logo Mibo

AdaptiveProgram<'Frame> Type

An adaptive program: the complete description of an adaptive game.

This is the adaptive counterpart of Program, with the message/command machinery removed. Changeable roots hold the state, derived projections compose it, and the runner forces the frame's projections at the end of every step. There is no 'Msg and no Cmd — handlers write roots directly. Deferred work and subscriptions have adaptive counterparts: systems post unit -> unit work through AdaptiveContext.Intents — post (after this step's Update), postNextFrame (top of the next step), or postTask/postAsync (background work whose completion returns via post) — and external events arrive through AdaptiveSub subscriptions whose callbacks post work.

Both contexts expose the intent queue: Init receives AdaptiveFrameContext and posts through its Intents member (work runs at the startup drain, before the first frame is forced), and Update receives AdaptiveContext with the same surface. The subscription projection receives AdaptiveFrameContext as well and must not post: it runs once per step. The frame builder must not post either: it runs after the post drain.

The Init/Update/Observers slots are the dependency graph (the simulation). The Config/ Renderers/ServiceRegistrations/AssetsBasePath slots are host configuration (the presentation) consumed by the windowed hosts. The headless runner consumes only the simulation slots plus FixedStep.

Example

 let program =
   AdaptiveProgram.mkProgram
     (fun ctx ->
       AdaptiveInit.ofFrameBuilder (Frame.buildFrame cell)
       |> AdaptiveInit.withDisposables [ d1; d2 ])
     (fun ctx gameTime -> Router.step world gameTime)
   |> AdaptiveProgram.withConfig cfg
   |> AdaptiveProgram.withRenderer (fun () -> Renderer2D.create view)

 AdaptiveRaylibGame(program).Run()
val program: obj

Record fields

Record Field Description

AssetsBasePath

Full Usage: AssetsBasePath

Field type: string voption

Optional base path for asset loading.

Field type: string voption

Config

Full Usage: Config

Field type: (GameConfig -> GameConfig) list
Field type: (GameConfig -> GameConfig) list

FixedStep

Full Usage: FixedStep

Field type: AdaptiveFixedStepConfig voption

Optional framework-managed fixed-step configuration. When set, the runner sub-steps Update in fixed increments.

Field type: AdaptiveFixedStepConfig voption

HasInput

Full Usage: HasInput

Field type: bool

Whether the reactive input polling service is enabled. Set via AdaptiveProgram.withInput.

Field type: bool

Init

Full Usage: Init

Field type: AdaptiveFrameContext -> AdaptiveInit<'Frame>

Builds the graph (roots and projections) and registers handlers. Receives the AdaptiveFrameContext, whose Intents member defers work to the startup drain: posted work runs right after Init returns, before the first frame is forced, and postNextFrame / postTask / postAsync land at their documented moments. Returns the AdaptiveInit: the frame builder plus the disposables released when the runner is disposed.

Field type: AdaptiveFrameContext -> AdaptiveInit<'Frame>

Observers

Full Usage: Observers

Field type: (unit -> IObserver<GameContext * 'Frame * GameTime>) list

Observer factories for receiving the forced frame each step.

Field type: (unit -> IObserver<GameContext * 'Frame * GameTime>) list

Profiler

Full Usage: Profiler

Field type: FrameProfiler voption

Optional frame profiler. Set via AdaptiveProgram.withProfiler.

When unset, the host measures nothing.

Field type: FrameProfiler voption

Renderers

Full Usage: Renderers

Field type: (unit -> IRenderer<'Frame>) list

Renderer factories called each frame to draw the forced frame. Multiple renderers draw in registration order.

Field type: (unit -> IRenderer<'Frame>) list

ServiceRegistrations

Full Usage: ServiceRegistrations

Field type: (GameContext -> unit) list

Service-registration callbacks invoked by the windowed hosts after core services (assets, input) are registered but before Init. The backend-neutral hook for registering extra services.

Field type: (GameContext -> unit) list

Update

Full Usage: Update

Field type: AdaptiveContext -> GameTime -> unit

Optional per-frame phase. Runs after the time root is written and before the frame is forced. Reads projections, writes roots, posts intents through the full AdaptiveContext. Under fixed-step it runs once per fixed step, each followed by the post drain.

Field type: AdaptiveContext -> GameTime -> unit

Type something to start searching.