Complete 3D documentation for the BYR programming language and Lab environment
Getting Started
The lab is the powerful tool used for developing video games.
Basic Setup
To get started, simply open the Workspace, select/create a project, and begin writing your code.
Running Your Code
Click the button in the top bar to execute your code. The output will appear in the preview panel on the right.
Game Objects
Create game objects using the GameObject function.
All game objects share a common set of properties and methods, such as position, rotation, etc.. Additional properties may apply depending on the object type.
Cube
newGameObject("Cube");
Plane
newGameObject("Plane");
Cylinder
newGameObject("Cylinder");
Sphere
newGameObject("Sphere");
Skybox
newGameObject("Skybox");
Audio
Create audio objects using the GameObject function. For attached audio objects, the analyser is created automatically, so you can use getFrequency() and getWaveform() immediately without any setup.
Syntax
newGameObject("Audio");
Audio Object Methods
Method
Description
Parameters
play()
Play audio
-
pause()
Pause audio
-
stop()
Stop audio
-
setVolume(volume)
Set volume (0-1)
volume: Number
setLoop(loop)
Set looping
loop: Boolean
seek(time)
Seek to time
time: Number
setAudioSource(src)
Change audio source
src: String
onLoad(ƒn)
Callback for when the audio has loaded
callback: ƒn
onEnd(ƒn)
End of playback callback
callback: ƒn
onError(ƒn)
Error callback
callback: ƒn
onPlay(ƒn)
Playback start callback
callback: ƒn
onPause(ƒn)
Pause callback
callback: ƒn
getDuration()
Get audio duration
-
getCurrentTime()
Get current time
-
isPlaying()
Check if playing
-
isPaused()
Check if paused
-
hasEnded()
Check if ended
-
attachTo(gameObject)
Attach audio to a GameObject
gameObject: GameObject
fadeVolume(targetVolume, duration)
Smoothly fade volume over time
targetVolume: Number, duration: Number
crossfadeTo(otherAudio, duration)
Crossfade to another audio
otherAudio: GameObject, duration: Number
getFrequency()
Get frequency spectrum data as bass, mid, and/or treble
-
getWaveform()
Get waveform amplitude (0-100)
-
Lights
▼
Ambient Light
Creates a soft, global illumination that lights all objects evenly.
newGameObject("AmbientLight");
Properties
Property
Type
Default
Description
color
String
"#ffffff"
Light color
intensity
Number
1
Brightness
Directional Light
Creates a light that shines uniformly from a direction.
newGameObject("DirectionalLight");
Properties
Property
Type
Default
Description
color
String
"#ffffff"
Light color
intensity
Number
1
Brightness
position
Object
{x: 0, y: 0, z: 0}
Light position
shadow
Boolean
true
Cast shadows
Point Light
Creates a light that shines in all directions from a point.
newGameObject("PointLight");
Properties
Property
Type
Default
Description
color
String
"#ffffff"
Light color
intensity
Number
1
Brightness
distance
Number
100
How far the light reaches
position
Object
{x: 0, y: 0, z: 0}
Light position
Hemisphere Light
Creates a gradient light from sky color to ground color.
newGameObject("HemisphereLight");
Properties
Property
Type
Default
Description
skyColor
String
"#ffffff"
Sky color
groundColor
String
"#8d8d8d"
Ground color
intensity
Number
1
Brightness
Spot Light
Creates a cone-shaped light.
newGameObject("Spotlight");
Properties
Property
Type
Default
Description
color
String
"#ffffff"
Light color
intensity
Number
1
Brightness
distance
Number
100
How far the light reaches
angle
Number
0.3
Beam angle in radians
penumbra
Number
0.3
Edge softness (0-1)
decay
Number
2
How fast light fades
shadow
Boolean
true
Cast shadows
Volumetric Spot Light
Creates a spot light with a visible light cone.
newGameObject("VolumetricSpotlight");
Properties
Property
Type
Default
Description
color
String
"#ffffff"
Light color
intensity
Number
1
Brightness
distance
Number
15
How far the light reaches
angle
Number
0.3
Beam angle in radians
penumbra
Number
0.3
Edge softness (0-1)
decay
Number
2
How fast light fades
shadow
Boolean
true
Cast shadows
Azimuth Light
Creates a directional light that automatically orbits around the scene.
newGameObject("AzimuthLight");
Properties
Property
Type
Default
Description
color
String
"#ffffff"
Light color
intensity
Number
1
Brightness
speed
Number
1
Orbit speed
radius
Number
10
Orbit radius
height
Number
10
Light height
shadow
Boolean
true
Cast shadows
Mesh
newGameObject("Mesh");
Mesh Properties
Property
Type
Default
Description
source
String
-
Model file name
animations
Object
-
Animation configs.
currentAnimation
String
-
Initial animation
autoplay
Boolean
true
Auto-play current animation
fps
Number
24
Default animation speed
MTL
String
-
Material template file
Mesh Methods
Method
Description
Parameters
playAnimation(name)
Play an animation
String
pauseAnimation()
Pause the current animation
-
stopAnimation()
Stop the current animation
-
resumeAnimation()
Resume the paused animation
-
getAnimations()
Get list of animation names
→ Array
Game Object Properties
▼
These properties are available for all 3D objects.
Property
Type
Default
Description
position
Object
{x: 0, y: 0, z: 0}
Object position in the scene
scale
Object
{x: 1, y: 1, z: 1}
Scale factor
material
String
"basic"
Material type
color
String
"white"
Fill color
texture
String
-
Image file path for texture mapping
name
String
-
Unique identifier
dynamic
Boolean
false
Whether object can move
shadow
Boolean
true
Cast and receive shadows
Note: in order to load a file from a specific asset, use the from property (e.g., texture: '[file_name] from [asset_name]').
Game Object Methods
▼
These methods allow you to control and manipulate 3D objects.
Method
Description
Parameters
applyForce(force, options)
Apply force to the object
{x, y, z}, {relativeTo}
setPosition(position)
Set the object's position
{x, y, z}
setRotation(rotation)
Set the object's rotation
{x, y, z}
setScale(scaleX, scaleY, scaleZ)
Scale the object
Number, Number, Number
setColor(color)
Change the object's color
String
destroy()
Remove the object from the scene
-
distanceTo(target)
Calculate distance to another object
GameObject → Number
directionTo(target)
Get normalized direction to another object
GameObject → {x, y, z}
lookAt(target)
Rotate to face another object
GameObject
setWireframe(enabled)
Toggle wireframe rendering
Boolean
setGravity(x, y, z)
Set custom gravity for this object
Number, Number, Number
clearGravity()
Reset object to scene gravity
-
spin(props)
Make object spin continuously
{ axis: 'x'/'y'/'z', speed, reverse }
stopSpin()
Stop the spinning
-
setRelativeMovement(enabled, bindings/speed)
Enable movement for object
Boolean, Object
Note: To apply force relative to the camera's orientation, pass
relativeTo: "camera" as a parameter
(View Demo). For setRelativeMovement, you can use customize the keybinding by changing the value of forward, backward, left, and right (View Demo). Also, make sure to import the RelativeMovementmodule before using it.
Event System
The event system allows game objects to communicate and react to custom actions.
You can listen for events using on() and trigger them using trigger().
If true, detects collisions without physical response
canCollide
Boolean
true
Whether hitbox participates in collisions
Scene
Access scene properties and methods for responsive positioning and sizing.
Methods
Method
Description
Returns
scene.size
Returns the canvas dimensions
Object {x, y}
scene.halfSize
Returns half of the canvas dimensions
Object {x, y}
scene.center
Returns the center coordinates of the scene
Object {x, y}
scene.add(object)
Add one or multiple objects to the scene
void
scene.remove(object)
Remove an object from the scene
void
scene.clear()
Remove all objects from the scene
void
scene.count()
Returns the total number of objects in the scene
Number
scene.reload()
Reloads the scene
void
Note: to reload the entire project, use the engine.reload(); function.
Object Retrieval
Search and retrieve game objects in the scene using the flexible scene.query system.
Syntax
scene.query(query);
Query Formats
"name -> [name]" - Retrieve by custom name
"type -> [shape]" - Retrieve by object type
"index -> [number]" - Retrieve by creation order (1-based index)
"[query] -> [value][type:[shape]][idx:[number]]" - Filter by type and/or position
Shaders
Apply real-time post-processing effects to enhance the visual quality of your scenes.
Available Shaders
Shader
Options
Default
Description
bloom
{ intensity, radius, threshold }
{ 0.2, 0.2, 0.9 }
Glow around bright areas
glitch
{ intensity }
{ 0.25 }
Digital screen distortion
film
{ noise, scanlines, grayscale }
{ 0.3, 0.4, false }
Cinematic grain and scanlines
vignette
{ darkness }
{ 0.5 }
Darkened screen edges
pixelate
{ size }
{ 4 }
Retro pixel screen effect
rgbShift
{ amount }
{ 0.005 }
Chromatic color separation
grayscale
-
-
Black and white filter
Methods
Method
Description
Parameters
addEffect(name, options)
Apply an effect to the scene
String, Object
removeEffect(name)
Remove a specific effect
String
clearEffects()
Remove all effects
-
Camera
The camera controls how the scene is viewed. You can create multiple cameras,
switch between them, and use different perspective modes.
Syntax
Default Camera
newCamera(name);
To activate or deactivate a camera, use the activate/deactivate method. BYR provides a default 3D camera accessible via camera, so you can use it directly without creating a new one.
Layers allow you to organize game objects into groups for collective control.
Syntax
newLayer([gameObjects], options);
Properties
Option
Type
Default
Description
welded
Boolean
false
When true, objects move as a single rigid unit. Forces and velocities only affect the first object in the layer; the rest follow maintaining their relative positions.
Layer Methods
Method
Description
Parameters
add(objects)
Add GameObject(s) to the layer
GameObject / Array
remove(objects)
Remove GameObject(s) from the layer
GameObject / Array
commandAll(callback)
Execute a function on all objects in the layer
Function
clear()
Remove all objects from the layer
-
setGravity(x, y)
Set custom gravity for the layer (overrides scene gravity)
Number, Number
clearGravity()
Revert to scene gravity
-
getGravity()
Get current gravity for the layer
-
destroy()
Destroy the layer and all it's objects
-
Properties
Property
Type
Description
count
Number
Number of objects in the layer
Advanced Features
Project Management
New - Start a new project
Save - Save your project
Load - Load a saved project
Export - Download the code source as a text file
Publish - Publish the project
Settings - Configure the project settings
Asset System
Extend functionality by importing assets from the marketplace.
Accessing Assets
Click the dropdown in the top bar
Select Import to open the Asset Library
Browse available assets and click to add them to your project
Assets will automatically run when you execute your code
Managing Assets
Use the Manage option to view and remove currently loaded assets.
Number of particles to emit when the particles start playing
maxParticles
Number
100
Maximum active particles
duration
Number
∞
How long the system emits
autoDestroy
Boolean
false
Instantly destroy when duration ends
autoPlay
Boolean
false
Automatically start playing when created
blendMode
String
"normal"
Blend mode: "normal", "additive", "multiply"
lifetime
Object
{min: 1, max: 3}
How long each particle lives (seconds)
startSize
Object
{min: 2, max: 8}
Starting size of particles
endSize
Object
{min: 0, max: 4}
Ending size of particles
startColor
String
"#ffffff"
Starting color
endColor
String
"#ffffff"
Ending color (fades to this)
startAlpha
Number
1
Starting transparency (0-1)
endAlpha
Number
0
Ending transparency (0-1)
velocity
Object
{min: 10, max: 50}
Particle speed range
angularVelocity
Object
{min: 0, max: 0}
Rotation speed range
angle
Object
{min: 0, max: 6.28}
Emission angle range (radians)
gravity
Object
{x: 0, y: 0}
Gravity applied to particles
rotation
Object
{min: 0, max: 0}
Starting rotation range
Methods
Method
Description
Parameters
play()
Start emitting particles
-
pause()
Pause particle emission
-
emitBurst(count, duration)
Emit a burst of particles
Number, Number
destroy()
Remove the particle system
-
Utilities
Random
Method
Description
Parameters
Returns
random.int.range(min, max)
Random integer between min and max (inclusive)
Number, Number
Number
random.float.range(min, max)
Random float between min and max
Number, Number
Number
random.color(type)
Random color in specified format
"RGB", "HEX", "NAME"
String
Math
Function
Description
Parameters
Returns
clamp(value, min, max)
Clamp value between min and max
Number, Number, Number
Number
lerp(start, end, factor)
Linear interpolation between start and end
Number, Number, Number
Number
angleBetween(pointA, pointB)
Angle in radians from pointA to pointB
{x, y}, {x, y}
Number
Context Menu
Create context menus.
Syntax
newContextMenu(config);
Config
Format
Type
Description
label
Function
Callback
label [icon:name]
Function
Icon
label
Object
Submenu
"---"
-
Visual separator
Methods
Method
Description
Parameters
add(label, value)
Add a new item to the menu
String, Function/Object
remove(label)
Remove an item from the menu
String
enable(label)
Enable a disabled item
String
disable(label)
Disable an item
String
attachTo(gameObject)
Attach menu to a GameObject
GameObject
destroy(...labels)
Remove specific items or the entire menu
String(s)
Developer Console
The developer console is a real-time debugging and command interface
for monitoring and interacting with your project at runtime.
It provides logging, command execution, error tracking, debug visualization,
asset management, module importing, runtime inspection, and output control.
Logging Output
Use the console to display runtime information, warnings, and errors.
console.log("This is an informative log");
console.warn("This is a warning log");
console.error("This is an error log");
console.success("This is a success log");
console.log() - General information output
console.warn() - Non-critical warnings
console.error() - Critical errors
console.success() - Success messages
Command System
Commands are entered into the console and executed immediately.
They allow direct interaction with engine systems at runtime.
Comments
The console supports inline comments using the # symbol.
Everything after # is ignored during execution.
Error System
Filters
The SHOW ERRORS command supports filtering using the
FILTER[...] syntax. This allows you to narrow results
by source or message content.
Types
SRC - Filter by error source
CON - Filter by message content
Commands
SHOW ERRORS - Show the 10 most recent errors
SHOW ERRORS [number] - Show a specific number of errors (max: 50)
SHOW ERRORS * - Show all stored errors
SHOW ERRORS FILTER[SRC] {source, ...} - Filter errors by source
SHOW ERRORS FILTER[CON] {text, ...} - Filter errors by content
CLEAR ERRORS - Clear all stored errors
COUNT ERRORS - Show the total number of errors
HELP DEBUG - Show debug system help
Available Sources
asset-system (asset)
user-code (user)
auth-system (auth)
nav-system (nav)
help-system (help)
script-execution (script)
audio-system (audio)
sprite-system (sprite)
constraint-system (constraint)
security-violation (security)
async-command (async)
command-parsing (command)
Common Commands
byr@ByrLab:~$ INFO # Show project information
byr@ByrLab:~$ HELP # Show all available commands
byr@ByrLab:~$ HELP [command] # Show detailed help for a command
byr@ByrLab:~$ CLS # Clear console output
byr@ByrLab:~$ CLEARHISTORY # Clear command history
byr@ByrLab:~$ RUN # Execute current code
byr@ByrLab:~$ ECHO [text] # Print text to console
byr@ByrLab:~$ FPS # Display current FPS
byr@ByrLab:~$ VERSION # Show engine version
byr@ByrLab:~$ OPEN [destination] # Navigate to a section
Supported Destinations
home - Navigate to the homepage
profile - Open your user profile
market - Open the marketplace
community - Open the community section
Debug Commands
byr@ByrLab:~$ DEBUG STATUS # Show active debug systems
byr@ByrLab:~$ ENABLE DEBUG [type(s)] # Enable specific debug types
byr@ByrLab:~$ DISABLE DEBUG [type(s)] # Disable specific debug types
byr@ByrLab:~$ UNIMPORT [module] /g # Remove global module
byr@ByrLab:~$ IMPORTS # List all imported modules
Available Modules
Keyboard - handles keyboard input, including key press, hold, release, and key combinations, providing a flexible event system for user controls
CameraController - controls camera movement using keyboard input, supporting configurable bindings and multiple movement modes
RelativeMovement - extends the camera with continuous movement relative to a target, adding built-in control behavior directly to the camera
ParticleSystem - creates and manages particle effects with configurable shapes, colors, velocities, blend modes, and burst emission
Asset Commands
byr@ByrLab:~$ ASSETS # List all loaded assets
byr@ByrLab:~$ BYR INSTALL [asset ID/name] # Install asset from marketplace
byr@ByrLab:~$ BYR UNINSTALL [asset ID/name] # Uninstall asset from marketplace
Runtime Inspection
byr@ByrLab:~$ LIST GAME OBJECTS # List all scene objects
byr@ByrLab:~$ GET # Log object to console
byr@ByrLab:~$ SELECT # Highlight object in scene
Add a properties bracket to open an interactive panel:
SELECT name -> [name] [*] for all properties, or
SELECT name -> [name] [properties] for specific ones.
Output Mode
byr@ByrLab:~$ INLINE ON # Enable inline output
byr@ByrLab:~$ INLINE OFF # Disable inline output
Spam Protection
byr@ByrLab:~$ SPAM PROTECTION # Show current status
byr@ByrLab:~$ SPAM PROTECTION ON # Enable spam protection
byr@ByrLab:~$ SPAM PROTECTION OFF # Disable spam protection
byr@ByrLab:~$ SPAM PROTECTION LIMIT [count] WITHIN [time] # Set custom rate limit
Note
Commands are case-insensitive
Multiple arguments and flags are supported
Pixel - BYR Assistant
I'm here to help you!
Pixel can help with BYR code, concepts, and troubleshooting