FrameBudget beta
Class of @v12-engine/client
export declare class FrameBudgetOne budget a frame for the work done in pieces (BUDGET_WORKS: the units' skeletons asked for, debris, the switches of level, the scenery's merging, the grass laid), in the place of one each that could add up to 14 ms in one frame: a total they draw from (total, 6 ms), what each may take at most (most), and which has the room first when there is not enough for all (order): room is kept for a work before another in the order while it has something waiting, as much as it took the last frame it worked, though it runs later in the frame. Each work takes the nearest first of what it waits with. A work that was given no room a whole frame does one piece in the next, whatever the budget says: nothing waits for ever. Begun once a frame by whoever runs the frame (frame); client.frameBudget in a game, GameView.world.frameBudget declared, the editor's settings in the editor
Members
constructor
constructor(look?: FrameBudgetLook | number, now?: () => number);Constructs a new instance of the FrameBudget class
frame
frame(): void;A frame begins: the one before it is kept for the sample, and every work's time is its own again
free
free: boolean;Spends without limit while set: the frames behind the loading screen (GameClient.prepare), where no one waits on a frame
may
may(work: BudgetWork): boolean;Whether a work may do one piece more now: there is room, or it has done nothing yet this frame after a whole frame given none. Asked and refused, it waited this frame (the sample counts it)
most
readonly most: Record<BudgetWork, number>;Milliseconds a frame each work, at most, inside the total
order
order: BudgetWork[];Which work has the room first, the first first
room
room(work: BudgetWork): number;Milliseconds a work may take now: what is left of its most and of the total, less the room kept for the works before it in the order that have something waiting (what each took the last frame it worked, less what it took of it already this frame). Infinity while free
run
run(work: BudgetWork): BudgetRun;Times a run of pieces of a work from now, for work that looks at the clock as it goes (a merge a step at a time): over() once the run has had the room there was as it began (a run of a work given none a whole frame has one look first), end() counts what it took. One run of a work at a time
sample
sample(): BudgetSample;What the works took of the frames of the last second, for the 📊 window
set
set(look: FrameBudgetLook | number | undefined): void;Takes a game's say (a number is the total), over the client's (FRAME_BUDGET)
spend
spend(work: BudgetWork, ms: number): void;What a piece of a work took, in milliseconds: counted against its room and the total
total
total: number;Milliseconds a frame all the works together, at most. Infinity for no limit
waiting
waiting(work: BudgetWork, test: () => boolean): () => void;Tells the budget how to know a work has something waiting, for room to be kept for it; gives back what stops it