Project index/04 — Luau
Case study / 04Experimental prototype

ODS Experiment.

A modular Roblox observation-device prototype with switchable optics, battery drain, audio, and night-vision effects.

CategoryLuau
FocusObservation-device prototype
TechnologyLuau / Roblox Lighting / ContextActionService / Overture
StatusExperimental prototype
01 / Overview

Why it exists

Explore a small capability-based device system instead of tying every optic and effect to one controller script.

Input, deployment, battery lifetime, visual effects, view state, and audio each need a clear place in a reusable device prototype.

Based on the local ODS Experiment code.

02 / System

How it works

  1. 01

    Choose definitions

    The registry selects BasicNightVision and one of three optic configurations.

  2. 02

    Bind controls

    ObservationDeviceController binds optic cycling, deployment, and power actions through ContextActionService.

  3. 03

    Start capabilities

    Powering on starts Battery drain, enables ImageIntensifier, starts device audio, and shows the view.

  4. 04

    Switch or stop

    Changing devices destroys prior capability instances; disabling stops the battery, visual effect, hum, and view.

03 / Code

Selected code

These excerpts are from the paths shown on each patch. Select an annotation for a focused note; copy code directly from each patch.

luau / source excerpt

Battery.luau

src/shared/ObservationDevices/Capabilities/Battery.luau

Starts bounded battery drain, publishes percent changes, calls depletion once, and cancels the running task on stop.

Notes on the patch
luau / source excerpt

ImageIntensifier.luau

src/shared/ObservationDevices/Capabilities/ImageIntensifier.luau

Cancels earlier transitions, tweens Lighting and post-processing back to neutral, then disables effects after the power-down interval.

Notes on the patch
04 / Decisions

Engineering decisions

01

Capability modules

Reason
Battery, DeviceAudio, ImageIntensifier, and view logic have separate lifetimes and configuration.
Alternative
Put every effect and timer in the controller.
Tradeoff
The controller coordinates construction and teardown between modules.
02

Restore Lighting state

Reason
ImageIntensifier captures the prior exposure and restores it during shutdown or reset.
Alternative
Leave global Lighting changes after power-off.
Tradeoff
Transitions need cancellation and baseline tracking.
05 / Reflection

Outcome & next steps

Outcome

The source implements one night-vision device definition, three optics, battery and audio capabilities, a view, and Lighting transitions.

What improved

Separate capability objects let the controller replace a device while cleaning up the previous battery, audio, view, and image effects.

Current limitations

  • Only one device definition is present in the inspected registry.
  • No Studio playtest or automated runtime test was available for this audit.

Future improvements

  • Playtest power cycling, optic switching, battery depletion, and controller action cleanup in Studio.

What this demonstrates

Modular Luau configuration, capability lifetimes, delayed-task cancellation, and reversible visual effects.

Continue readingAudio System