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()
Record fields
| Record Field |
Description
|
Full Usage:
AssetsBasePath
Field type: string voption
|
Optional base path for asset loading.
|
|
|
|
Optional framework-managed fixed-step configuration. When set, the runner
sub-steps
|
Full Usage:
HasInput
Field type: bool
|
Whether the reactive input polling service is enabled. Set via AdaptiveProgram.withInput.
|
|
Builds the graph (roots and projections) and registers handlers.
Receives the AdaptiveFrameContext, whose
|
|
Observer factories for receiving the forced frame each step.
|
|
Optional frame profiler. Set via AdaptiveProgram.withProfiler. When unset, the host measures nothing.
|
Renderer factories called each frame to draw the forced frame. Multiple renderers draw in registration order.
|
|
|
Service-registration callbacks invoked by the windowed hosts after core
services (assets, input) are registered but before
|
|
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.
|
Mibo