Standard Library
RedScript ships with 48 stdlib modules. Import any module with import <name>;.
Categories
Mathematics
- math — basic math (
abs,clamp,lerp,sin_fixed,sqrt_fx,ln,exp_fx,smoothstep, ...) - math_hp — high-precision (
sin_hp,cos_hp,ln_hp,double_sqrt,pow_real, ...) - bits — bitwise operations (
bit_and,bit_or,bit_xor,bit_shl,popcount, ...) - bigint — multi-word integers (base-10000 bigint add/sub/mul/div, arbitrary length)
- calculus — numerical integration/differentiation (trapezoid, Simpson, Welford statistics)
- ode — RK4 ODE solver (exponential decay/growth, harmonic oscillator; fixed-point ×10000)
- linalg — double-precision linear algebra (2D/3D vectors, 2×2 matrix multiply, Cramer's rule solver)
Data Structures
- list — array aggregates (
sum,avg,min,max,sort3–sort5,shuffle, ...) - sets — set operations (
set_new,set_add,set_contains,set_remove) - graph — weighted directed/undirected graphs (BFS, DFS, reachability, Dijkstra; up to 64 nodes, 256 edges)
- matrix — matrix math for Display Entities (2D/3D rotation, scale, quaternion helpers)
- vec — 2D/3D vectors (
dot2d,cross3d,length2d_fixed,atan2_fixed,normalize2d_x, ...) - quaternion — 3D rotations (
quat_mul,quat_slerp,quat_euler, axis-angle constructors) - heap — min/max binary heap priority queues (up to 64 elements)
Randomness & Statistics
- random — LCG/PCG RNG, binomial and hypergeometric sampling
- noise — procedural noise (value noise 1D/2D, fractal Brownian motion, terrain height)
Signal Processing
- signal — DFT (up to 8 samples), Gaussian/exponential/Poisson/geometric distributions
- fft — Discrete Fourier Transform (O(n²) DFT for n ≤ 16; magnitude, power, coroutine variant)
- expr — RPN expression evaluator (dynamic formula evaluation at runtime)
Geometry & Graphics
- geometry — selection zones (AABB, sphere, cylinder, cone, sector)
- advanced — Bézier curves (quadratic–N-order), Mandelbrot/Julia, modular exponentiation
- parabola — projectile trajectories (ballistic aiming, drag physics)
- easing — easing functions (quad, cubic, quartic, sine, expo, back, bounce, smoothstep)
- particles — particle helpers (hearts, flame, smoke; draw line, circle, helix)
- color — RGB/HSL/hex color utilities (pack/unpack, lerp, RGB↔HSL conversion)
Physics
- physics — velocity, gravity, collision (projectile motion, drag, spring, friction)
- strings — string utilities (
str_len)
Entity & Game Systems
- ecs — Entity Component System (health, velocity, damage components; registry; tag convention)
- state — scoreboard-backed state machine (
get_state,set_state,transition) - scheduler — per-entity/global delayed tasks (
task_schedule,gtask_ready) - result — tagged success/error return values (
Result::Ok,Result::Err)
Minecraft Game Mechanics
- player — player utilities (
heal,damage,is_op) - mobs — mob type string constants (all vanilla entity IDs)
- combat — damage and health (
weapon_damage,apply_damage) - effects — potion effects (
speed,jump,regen,buff_all, ...) - spawn — entity spawning and teleportation (
teleport_to,goto_lobby,goto_arena) - interactions — interaction entities (right-click, sneak, look-direction detection)
- inventory — inventory management (
clear_inventory,give_kit_warrior, ...) - bossbar — boss bar UI (
create_timer_bar,create_health_bar,update_bar_color) - cooldown — ability cooldowns (
cooldown_start,cooldown_ready,cooldown_tick) - timer — countdown timers (
Timerstruct withstart,done,remaining) - sort — insertion sort, merge helper, coroutine merge sort
- tags — Minecraft block/entity/item/damage type tag string constants
- teams — team management (
setup_two_teams,setup_four_teams,add_to_team) - world — world queries (
set_day,weather_clear,sun_altitude,glass_box, ...) - events — event dispatcher for join/death/kill/item-use function tags