BGE/Controller
Alias: BGE.Controller
Enums
BGE.Controller.ConnectionMode
Properties
http(default: "http")websocket(default: "websocket")
BGE.Controller.ControllerServerEventType
Properties
onOpen(default: "onOpen")onMessage(default: "onMessage")onClose(default: "onClose")
Other
ActionBinding
One bindAction() binding - internal bookkeeping, not part of the public API. remoteButtons/controllerButtons are always normalized to arrays by bindAction() - empty means this action has no binding for that source.
Properties
remoteButtons(Array.<string>)controllerButtons(Array.<string>)playerIndex(integer)label(dynamic)
AxisBinding
One bindAxis() binding - internal bookkeeping, not part of the public API.
Properties
stick(string)playerIndex(integer)label(dynamic)
ActionState
One action's live press/held/release/duration state - internal bookkeeping, not part of the public API (isActionPressed()/isActionHeld()/isActionReleased()/getActionHeldTimeMs() are how a game reads this).
Properties
press(boolean)held(boolean)release(boolean)heldTimeMs(integer)
ControlMap
Unified mapping from remote-button and controller input to named actions/axes - the one class a game needs to learn to support both input sources. Exposed as Game.controls; see Game.enableControllerInput().
Parameters
registry(BGE.Controller.ControllerRegistry)
Returns
BGE.Controller.ControlMap
ANALOG_AXIS_LEFT_X
Axis indexes for roUniversalControlEvent.GetValue(axis) - brs-engine's AnalogAxis enum (simulator-only extension, PR lvcabral/brs-engine#1226).
Default: 0
ANALOG_AXIS_LEFT_Y
Default: 1
ANALOG_AXIS_RIGHT_X
Default: 2
ANALOG_AXIS_RIGHT_Y
Default: 3
BLUETOOTH_GAMEPAD_REMOTE_ID_PREFIX
GetRemoteID() prefix for a brs-engine RemoteType.BT (Bluetooth gamepad) remote - the only remote type GetValue() returns real per-axis analog data for. GetRemoteID() returns the enum NAME, not its numeric value (see brs-engine's BrsDevice.updateKeysBuffer(), RemoteType[remoteType])
- "BT:1", not "30:1". Any other remote (e.g. "WD:0" keyboard-sim) gets a non-directional 1.0/0.0 "is anything pressed" fallback from GetValue() instead (RoUniversalControlEvent.getFloatValue in brs-engine), which would otherwise be misread as real stick input and permanently override the d-pad fallback the instant any button is held.
Default: BT:
ANALOG_DEADZONE
Below this magnitude, a real gamepad's resting-stick drift is treated as neutral rather than a real deflection - otherwise it would permanently preempt the remote d-pad fallback in ControlMap.getAxis(). Scoped to controller input only; unrelated to BGE.UI.CURSOR_ANALOG_DEADZONE.
Default: 0.15
ControllerConnectionState
Internal per-connection controller state (buttons/sticks/held-timers/custom payload) plus the remote's own d-pad fallback state. Not part of the public API - a game uses BGE.Controller.ControlMap (game.controls) instead.
Properties
buttons(object)heldTimers(object) — name -> booleansticks(object) — name -> roTimespan, present only while heldcustom(object) — name -> BGE.Math.Vector
ControllerRegistry
Properties
shareFirstControllerWithRemote(boolean) — Default true - the first browser shares playerIndex 0 with the firstcombineRemoteInputs(boolean) — Default false - each distinct remote/gamepad gets its own stable
CONTROLLER_HTTP_BUFFER_SIZE
Default: 10240
CONTROLLER_WS_READ_SIZE
Default: 10240
CONTROLLER_WS_BUFFER_MAX_SIZE
Cap on connection.wsBuffer's accumulated size, mirroring CONTROLLER_HTTP_BUFFER_SIZE's guard on httpBuffer - without this, a client declaring a huge 64-bit extended WebSocket frame payload length and then trickling/withholding bytes could grow wsBuffer unbounded while decodeFrames() keeps waiting for the rest of the frame to arrive.
Default: 65536
ControllerConnection
Properties
socket(roStreamSocket)mode(string)wsBuffer(roByteArray)httpBuffer(roByteArray) — Accumulates raw bytes across possibly-multiple recv()/poll() callsstaleReadPolls(integer) — Consecutive poll() cycles where isReadable() reported true butpendingSend(roByteArray) — Bytes still waiting to be flushed to the socket - seependingSendOffset(integer) — How far into pendingSend the previous partial send(s) already got.pendingSendAction(string) — What to do once pendingSend fully flushes - "" (nothing further),
CONTROLLER_MAX_STALE_READ_POLLS
Consecutive negative-receive polls before a connection is assumed dead and closed - see ControllerConnection.staleReadPolls. At ~60 polls/sec this is a multi-second grace period. The browser client now resends its state once a second (see controller-web/index.html), so this threshold only needs to comfortably clear that 1s heartbeat cadence (it does, by ~5x) - it no longer needs to double as "long enough for the flakiest possible isReadable() behavior on idle, untouched input," since that case no longer exists once the client is always sending.
Default: 300
ControllerServerEvent
Properties
type(string)connectionId(string) — BGE.Controller.ControllerServerEventTypemessage(string)
HttpRequest
A parseHttpRequest() result - the request line plus headers, both used verbatim by onHttpReadable()'s routing. headers stays a plain dictionary (its keys are whatever header names the client happened to send, not a fixed set).
Properties
command(string)path(string)protocol(string)headers(object)
ControllerServer
Minimal HTTP + WebSocket (RFC 6455) server for streaming controller input from a browser page, without SceneGraph. Adapted and trimmed from https://github.com/markwpearce/roku-gamepad - serves GET only (static files under pkg:/source/controller-web), no upload/directory listing.
Parameters
port(integer)
Properties
port(integer)
Returns
BGE.Controller.ControllerServer