Prometheon Studio
Prometheon Studio Documentation

Prometheon Script API

A C#-native scripting language that gives creators direct access to every engine system — physics, lighting, audio, daylight cycles, world manipulation, and more.

C# / .NET 8 11 Service Classes Live Hot Reload
📖

Overview

What is Prometheon Script and how does it work?

Prometheon Script is the native scripting layer of Prometheon Studio. You write standard C# classes — the engine compiles them via .NET 8 and runs them in a sandboxed host process that communicates with the Three.js engine over a JSON bridge. Every script class that implements lifecycle methods (Start, Update, FixedUpdate, Stop) is automatically discovered and invoked.

Quick Start

Your first Prometheon Script in 60 seconds

Create a .cs file anywhere in your project's Scripts folder. No namespace, no using statements — all Prometheon API classes are automatically available.

// MyFirstScript.cs — drop this in your Scripts folder
public class DayNightCycle
{
    private float _hour = 8f;

    public void Start()
    {
        Debug.Log("Day/Night cycle started at hour: " + _hour);
        Environment.SetTimeOfDay(_hour);
        Environment.SetTimeScale(60f); // one minute = one in-game hour
    }

    public void Update(float deltaTime)
    {
        _hour += deltaTime * 0.1f;
        if (_hour >= 24f) _hour -= 24f;
        Environment.SetTimeOfDay(_hour);
    }
}

public class PlayerSkinDemo
{
    public void Start()
    {
        Player.SetShirtColor("#cc2200");
        Player.SetPantsColor("#222244");
        Audio.PlayMusic("https://example.com/theme.mp3", volume: 0.6f);
    }
}
🔄

Script Lifecycle

Methods the engine calls automatically
MethodAlso recognized asWhen called
Awake()OnStart(), OnRuntimeStart()Before the first frame, before Start
Start()First frame, after all Awake calls
Update(float dt)OnUpdate(float dt)Every render frame. dt = seconds since last frame
FixedUpdate(float dt)OnFixedUpdate(float dt)Fixed 60 Hz physics tick
Stop()OnStop(), OnDestroy(), OnRuntimeStop()When runtime is stopped / script is removed
💡
deltaTime parameter is optional. All lifecycle methods may be declared with or without a float / double parameter — the engine passes the correct value automatically.
🎮

Game

Core gameplay settings — gravity, speed, view mode, combat
Game.SetGravity(float value)
Set world gravity. Default −30. Negative = pull down.
void
Parameters
valuefloatGravity strength. Typical range: −10 (light) to −60 (heavy).−30
Game.SetGravity(-15f); // moon gravity
Game.SetMoveSpeed(float value)
Set the player's base walk speed.
void
valuefloatUnits per second. Default 7.7
Game.SetJumpPower(float value)
Set vertical jump impulse.
void
valuefloatUpward velocity added on jump. Default 12.12
Game.SetViewMode(string mode)
Switch between first-person and third-person.
void
modestring"first" or "third"
Game.SetViewMode("first");
Game.SetSpawn(float x, float z)
Set the default spawn position on the XZ plane.
void
x, zfloatWorld position. Y is determined by terrain height.
Game.SetMouseSensitivity(float value)
void
valuefloatCamera look sensitivity multiplier. Default 1.
Game.PausePhysics() / Game.ResumePhysics()
Freeze or resume the physics simulation.
void
Game.PausePhysics();
// ... show cutscene ...
Game.ResumePhysics();
Game.CombatHit / CombatCombo / CombatBlock / CombatDodge
Trigger combat system actions on a character entity.
void
Game.CombatHit("enemy-001", new { damage = 25, knockback = 3f });
Game.CombatDodge("player");

Time

Frame delta time — read-only
PropertyTypeDescription
Time.deltaTimefloatSeconds since the previous frame (auto-updated every frame)
Time.unscaledDeltaTimefloatSame as deltaTime (unaffected by time scale)
💡
You can also receive delta time as a parameter in Update(float deltaTime) — both approaches are equivalent.
🐛

Debug

Log messages to the Studio console
Debug.Log(object? value)
Print an info message.
void
Debug.Log("Score: " + score);
Debug.LogWarning("Low health!");
Debug.LogError("Critical failure.");
Debug.Assert(health > 0, "Player should be alive");
📡

Runtime

Fire events on the engine event bus
Runtime.Emit(string eventName, object? payload)
Broadcast a named event to all subscribers.
void
Runtime.Emit("player:scored", new { points = 100 });
🖥

UI

Build dynamic UI nodes at runtime
UI.RegisterNode(object node)
Add a UI node to the runtime UI graph.
void
UI.RegisterNode(new {
    type = "label",
    id = "score-hud",
    text = "Score: 0",
    x = 20, y = 20
});
🌅

Environment

Daylight cycle, weather, fog, wind
Environment.SetTimeOfDay(float hour)
Jump the sun/moon to a specific time. 0=midnight, 6=dawn, 12=noon, 20=dusk.
void
hourfloat0–24 hour value.
Environment.SetTimeOfDay(18.5f); // 6:30 PM golden hour
Environment.SetTimeScale(float scale)
Control how fast in-game time advances.
void
scalefloat1 = real-time. 60 = one in-game minute per real second. 0 = paused.1
Environment.SetWeather(string type, float intensity)
Apply a weather preset with optional intensity.
void
typestring"clear" | "rain" | "snow" | "storm" | "fog"
intensityfloat0–1. How heavy the effect is.1
Environment.SetWeather("rain", 0.7f);
Environment.SetFog(float density, string color)
Add volumetric fog to the scene.
void
densityfloat0 = no fog. 1 = thick fog.
colorstringFog tint as hex string."#aaaaaa"
Environment.SetWind(float x, float y, float z)
Set global wind direction and speed. Affects particles and foliage.
void
Environment.SetWind(5f, 0f, 2f); // gentle westward breeze
Environment.SetSkyColor(string hexColor)
Tint the background sky color.
void
Environment.SetSkyColor("#1a0a2e"); // deep purple night sky
💡

Lighting

Ambient light, sun direction, bloom, point lights
Lighting.SetAmbientColor(string hexColor)
Set fill light color for the whole scene.
void
Lighting.SetAmbientColor("#334455"); // cool night ambient
Lighting.SetAmbientIntensity(0.4f);
Lighting.SetSunColor / SetSunIntensity / SetSunPosition
Control the directional sun light.
void
intensityfloat0–10. Default 3.
Lighting.SetSunColor("#ffddaa");
Lighting.SetSunIntensity(5f);
Lighting.SetSunPosition(50f, 100f, 50f);
Lighting.SetBloom(bool enabled, float intensity)
Toggle the post-processing bloom glow effect.
void
Lighting.SetBloom(true, 1.5f);
Lighting.AddPointLight(string id, float x, float y, float z, string color, float intensity, float range)
Place a named point light at a world position.
void
idstringUnique name — use it later with RemovePointLight.
rangefloatLight falloff radius in world units.10
Lighting.AddPointLight("torch1", 3f, 2f, 5f, "#ff8820", 2f, 8f);
Lighting.RemovePointLight("torch1");
Lighting.SetShadows(bool enabled)
Enable or disable shadow rendering globally.
void
🌐

World

Create, move, rotate, scale, and destroy scene objects at runtime
⚠️
Object IDs — use the same string id you'd see in the Scene Explorer. You can also provide an id when creating objects with World.Create and reuse it throughout the script.
World.Create(string id, string shape, float x, float y, float z)
Spawn a primitive object in the scene.
void
shapestring"box" | "sphere" | "cylinder" | "capsule" | "plane""box"
World.Create("crate-1", "box", 5f, 1f, 3f);
World.SetColor("crate-1", "#8B4513");
World.Move(string id, float x, float y, float z)
Teleport an object to a world position.
void
World.Rotate(string id, float x, float y, float z)
Set object rotation in euler degrees.
void
World.Rotate("door-1", 0f, 90f, 0f); // open the door
World.Scale / SetColor / SetVisible / Clone / Destroy / SetParent
Additional object operations.
void
World.Scale("boulder", 3f, 3f, 3f);
World.SetColor("boulder", "#555555");
World.SetVisible("secret-door", false);
World.Clone("tree-template", "tree-forest-01");
World.Destroy("crate-1");
World.SetParent("wheel", "car-body");
⚙️

Physics

Gravity, simulation control, forces, material properties
Physics.SetGravity(float value)
Shorthand for Game.SetGravity — sets world gravity.
void
Physics.ApplyImpulse(string objectId, float x, float y, float z)
Apply an instant velocity change to a physics body.
void
Physics.ApplyImpulse("ball", 0f, 15f, 0f); // launch upward
Physics.SetBounciness / SetFriction
Set material properties on a physics collider.
void
valuefloat0–1. 0 = no bounce / max friction, 1 = perfect bounce / frictionless.
Physics.SetBounciness("ball", 0.9f);
Physics.SetFriction("ice-floor", 0.02f);
Physics.EnableDebug(bool enabled)
Toggle wireframe physics collider overlay.
void
🧍

Player

Control speed, jump, appearance, and position of the player character
Player.Teleport(float x, float y, float z)
Instantly move the player to a world position.
void
Player.Teleport(0f, 20f, 0f); // spawn above center
Player.SetSpeed / SetJumpPower / SetGravity / SetMouseSensitivity
Runtime movement tuning — same effect as Game equivalents.
void
Player.SetSpeed(12f);
Player.SetJumpPower(18f);
Player.SetSkinColor / SetShirtColor / SetPantsColor / SetHairColor / SetShoeColor
Recolor the humanoid character's materials at runtime.
void
hexColorstringCSS hex color string, e.g. "#cc2200"
Player.SetSkinColor("#e8c49a");
Player.SetShirtColor("#1a3a8f");
Player.SetPantsColor("#1e2c42");
Player.SetHairColor("#1a0a06");
Player.SetShoeColor("#111111");
🎥

Camera

FOV, view mode, screen shake, distance, look target
Camera.SetFOV(float fov)
Set camera field of view in degrees.
void
fovfloatTypical range: 40 (telephoto) – 120 (wide). Default 75.75
Camera.SetFOV(90f); // wider FPS feel
Camera.Shake(float intensity, float duration)
Trigger a screen-shake effect.
void
intensityfloatShake magnitude. 1 = normal, 5 = earthquake.1
durationfloatSeconds the shake lasts.0.5
Camera.Shake(3f, 0.8f); // explosion impact
Camera.SetViewMode / SetDistance / LookAt
void
Camera.SetViewMode("third");
Camera.SetDistance(8f);    // pull camera back
Camera.LookAt(0f, 5f, 0f); // cinematic lock-on
🔊

Audio

Sound effects, music streaming, procedural tones, volume control
Audio.PlaySound(string nameOrUrl, float volume, float pitch)
Play a one-shot sound effect by asset name or URL.
void
Audio.PlaySound("jump", volume: 0.8f, pitch: 1.1f);
Audio.PlaySound("https://cdn.example.com/explosion.mp3");
Audio.PlayMusic(string url, float volume, bool loop)
Stream looping background music.
void
Audio.PlayMusic("https://example.com/theme.mp3", 0.5f);
Audio.StopMusic(2f); // fade out over 2 seconds
Audio.PlayTone(float frequency, float duration, float volume)
Synthesize a procedural tone (oscillator).
void
frequencyfloatHz. A4 = 440, C4 = 261.6, C5 = 523.3.
Audio.PlayTone(440f, 0.2f); // short A4 beep
Audio.SetMasterVolume / SetMusicVolume / SetSfxVolume
Global volume controls (0–1).
void
Audio.SetMasterVolume(0.7f);
Audio.SetMusicVolume(0.4f);
Audio.SetSfxVolume(1.0f);

Particles

Spawn particle effects at any world position
Particles.Explosion(float x, float y, float z, float scale)
void
Particles.Explosion(5f, 0f, 3f, 2f); // large explosion
Particles.Fire / Smoke / Magic / Burst
Preset particle emitters.
void
Particles.Fire(0f, 0f, 0f);
Particles.Smoke(0f, 2f, 0f, density: 0.6f);
Particles.Magic(1f, 1f, 1f, color: "#ff44ff");
Particles.Burst(0f, 0f, 0f, count: 50);
📋

Full Command Reference

Every method at a glance
ClassMethodDescription
GameSetGravity(float)World gravity
GameSetMoveSpeed(float)Walk speed
GameSetJumpPower(float)Jump impulse
GameSetMouseSensitivity(float)Camera look speed
GameSetViewDistance(float)Far clip plane
GameSetViewMode(string)"first" | "third"
GameSetSpawn(float, float)Default spawn XZ
GamePausePhysics() / ResumePhysics()Freeze physics
GameEnablePhysicsDebug(bool)Collider wireframes
GameCombatHit / CombatCombo / CombatBlock / CombatDodgeCombat actions
TimedeltaTime (property)Seconds since last frame
DebugLog / LogWarning / LogError / AssertConsole output
RuntimeEmit(string, object)Fire event bus event
UIRegisterNode(object)Add runtime UI node
EnvironmentSetTimeOfDay(float)Hour 0–24
EnvironmentSetTimeScale(float)Time speed multiplier
EnvironmentSetWeather(string, float)Weather preset + intensity
EnvironmentSetFog(float, string)Density + color
EnvironmentSetWind(float, float, float)Wind vector
EnvironmentSetSkyColor(string)Sky background tint
LightingSetAmbientColor / SetAmbientIntensityFill light
LightingSetSunColor / SetSunIntensity / SetSunPositionDirectional light
LightingSetBloom(bool, float)Post-process bloom
LightingAddPointLight / RemovePointLightDynamic point lights
LightingSetShadows(bool)Shadow rendering
PhysicsSetGravity / Pause / Resume / EnableDebugSimulation control
PhysicsApplyImpulse / ApplyForceForce application
PhysicsSetBounciness / SetFrictionMaterial properties
WorldCreate(id, shape, x, y, z)Spawn primitive
WorldDestroy / Move / Rotate / ScaleTransform objects
WorldSetColor / SetVisible / Clone / SetParentAppearance & hierarchy
CameraSetFOV(float)Degrees (default 75)
CameraShake(float, float)Screen shake
CameraSetViewMode / SetDistance / LookAtCamera control
PlayerTeleport(x, y, z)Instant position move
PlayerSetSpeed / SetJumpPower / SetGravityMovement tuning
PlayerSetSkinColor / SetShirtColor / SetPantsColor / SetHairColor / SetShoeColorCharacter appearance
AudioPlaySound(string, float, float)One-shot SFX
AudioPlayMusic / StopMusicBackground music
AudioPlayTone(float, float, float)Procedural oscillator
AudioSetMasterVolume / SetMusicVolume / SetSfxVolumeVolume controls
ParticlesExplosion / Fire / Smoke / Magic / BurstParticle presets