RenderQualityManager

Owns the game's current render quality level. Reach it through game.renderQuality; most games only need Game.setQualityLevel() or Game.enableAdaptiveQuality().


Constructor

new RenderQualityManager( renderer: BGE.Renderer, initialLevel: integer, ): RenderQualityManager

Parameters

  • renderer (BGE.Renderer) — the renderer to apply settings to (the game canvas)
  • initialLevel (integer) — a BGE.RenderQualityLevel value

Instance Methods

getLevel(): BGE.RenderQualityLevel

Returns

setLevel(level: integer): boolean

Switches to a level (clamped). Does not change whether adaptive tuning is on - use Game.setQualityLevel() to pin a level.

Parameters

  • level (integer) — a BGE.RenderQualityLevel value

Returns

  • boolean — true if the level changed

overridePreset(level: integer, fields: roAssociativeArray): void

Replaces individual settings for one level, keeping the engine defaults for everything else. Repeated calls accumulate.

Parameters

  • level (integer) — a BGE.RenderQualityLevel value
  • fields (roAssociativeArray) — e.g. {planeSliceCount: 80, drawDistanceScale: 1.2}

Returns

  • void

getSettings(level: integer): BGE.RenderQualitySettings

The settings a level uses: the engine preset plus any overrides.

Parameters

  • level (integer) — a BGE.RenderQualityLevel value

Returns

enableAdaptive(options?: BGE.AdaptiveQualityOptions): boolean

Starts adjusting the level automatically to hold a frame rate. If the current level is outside the options' minLevel/maxLevel, it moves to the nearest one.

Parameters

Returns

  • boolean — true if the level changed to fit minLevel/maxLevel

setSceneOptions(options: BGE.SceneQualityOptions): boolean

Applies a scene's own settings, replacing the last scene's. Game calls this when a scene has loaded, with its qualityOptions.

Parameters

Returns

  • boolean — true if the level changed to fit the scene's range

disableAdaptive(): void

Returns

  • void

isAdaptive(): boolean

Returns

  • boolean — whether the level is being adjusted automatically

update(dt: float): boolean

Game calls this once per frame with the full frame time.

Parameters

  • dt (float)

Returns

  • boolean — true if the level changed this frame

beforeDraw(): boolean

Game calls this each frame after the entities update and before anything draws. When the camera starts moving from still, it drops straight to the level that last held while moving, rather than drawing the first moving frames at the still level.

Returns

  • boolean — true if the level changed

notifyLoading(): void

Game calls this each frame instead of update() while a scene is loading, so slow loading frames aren't judged against the level.

Returns

  • void

notifySceneChanged(): void

Game calls this after a scene change.

Returns

  • void