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
| Method | Also recognized as | When 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.
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.
valuefloatUnits per second. Default 7.7
Game.SetJumpPower(float value)
Set vertical jump impulse.
valuefloatUpward velocity added on jump. Default 12.12
Game.SetViewMode(string mode)
Switch between first-person and third-person.
modestring
"first" or "third"Game.SetViewMode("first");
Game.SetSpawn(float x, float z)
Set the default spawn position on the XZ plane.
x, zfloatWorld position. Y is determined by terrain height.
Game.SetMouseSensitivity(float value)
valuefloatCamera look sensitivity multiplier. Default 1.
Game.PausePhysics() / Game.ResumePhysics()
Freeze or resume the physics simulation.
Game.PausePhysics(); // ... show cutscene ... Game.ResumePhysics();
Game.CombatHit / CombatCombo / CombatBlock / CombatDodge
Trigger combat system actions on a character entity.
Game.CombatHit("enemy-001", new { damage = 25, knockback = 3f }); Game.CombatDodge("player");
Time
Frame delta time — read-only
| Property | Type | Description |
|---|---|---|
Time.deltaTime | float | Seconds since the previous frame (auto-updated every frame) |
Time.unscaledDeltaTime | float | Same 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.
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.
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.
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.
hourfloat0–24 hour value.
Environment.SetTimeOfDay(18.5f); // 6:30 PM golden hour
Environment.SetTimeScale(float scale)
Control how fast in-game time advances.
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.
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.
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.
Environment.SetWind(5f, 0f, 2f); // gentle westward breeze
Environment.SetSkyColor(string hexColor)
Tint the background sky color.
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.
Lighting.SetAmbientColor("#334455"); // cool night ambient Lighting.SetAmbientIntensity(0.4f);
Lighting.SetSunColor / SetSunIntensity / SetSunPosition
Control the directional sun light.
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.
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.
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.
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.
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.
World.Rotate(string id, float x, float y, float z)
Set object rotation in euler degrees.
World.Rotate("door-1", 0f, 90f, 0f); // open the door
World.Scale / SetColor / SetVisible / Clone / Destroy / SetParent
Additional object operations.
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.
Physics.ApplyImpulse(string objectId, float x, float y, float z)
Apply an instant velocity change to a physics body.
Physics.ApplyImpulse("ball", 0f, 15f, 0f); // launch upward
Physics.SetBounciness / SetFriction
Set material properties on a physics collider.
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.
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.
Player.Teleport(0f, 20f, 0f); // spawn above center
Player.SetSpeed / SetJumpPower / SetGravity / SetMouseSensitivity
Runtime movement tuning — same effect as Game equivalents.
Player.SetSpeed(12f); Player.SetJumpPower(18f);
Player.SetSkinColor / SetShirtColor / SetPantsColor / SetHairColor / SetShoeColor
Recolor the humanoid character's materials at runtime.
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.
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.
intensityfloatShake magnitude. 1 = normal, 5 = earthquake.1
durationfloatSeconds the shake lasts.0.5
Camera.Shake(3f, 0.8f); // explosion impact
Camera.SetViewMode / SetDistance / LookAt
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.
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.
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).
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).
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)
Particles.Explosion(5f, 0f, 3f, 2f); // large explosion
Particles.Fire / Smoke / Magic / Burst
Preset particle emitters.
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
| Class | Method | Description |
|---|---|---|
Game | SetGravity(float) | World gravity |
Game | SetMoveSpeed(float) | Walk speed |
Game | SetJumpPower(float) | Jump impulse |
Game | SetMouseSensitivity(float) | Camera look speed |
Game | SetViewDistance(float) | Far clip plane |
Game | SetViewMode(string) | "first" | "third" |
Game | SetSpawn(float, float) | Default spawn XZ |
Game | PausePhysics() / ResumePhysics() | Freeze physics |
Game | EnablePhysicsDebug(bool) | Collider wireframes |
Game | CombatHit / CombatCombo / CombatBlock / CombatDodge | Combat actions |
Time | deltaTime (property) | Seconds since last frame |
Debug | Log / LogWarning / LogError / Assert | Console output |
Runtime | Emit(string, object) | Fire event bus event |
UI | RegisterNode(object) | Add runtime UI node |
Environment | SetTimeOfDay(float) | Hour 0–24 |
Environment | SetTimeScale(float) | Time speed multiplier |
Environment | SetWeather(string, float) | Weather preset + intensity |
Environment | SetFog(float, string) | Density + color |
Environment | SetWind(float, float, float) | Wind vector |
Environment | SetSkyColor(string) | Sky background tint |
Lighting | SetAmbientColor / SetAmbientIntensity | Fill light |
Lighting | SetSunColor / SetSunIntensity / SetSunPosition | Directional light |
Lighting | SetBloom(bool, float) | Post-process bloom |
Lighting | AddPointLight / RemovePointLight | Dynamic point lights |
Lighting | SetShadows(bool) | Shadow rendering |
Physics | SetGravity / Pause / Resume / EnableDebug | Simulation control |
Physics | ApplyImpulse / ApplyForce | Force application |
Physics | SetBounciness / SetFriction | Material properties |
World | Create(id, shape, x, y, z) | Spawn primitive |
World | Destroy / Move / Rotate / Scale | Transform objects |
World | SetColor / SetVisible / Clone / SetParent | Appearance & hierarchy |
Camera | SetFOV(float) | Degrees (default 75) |
Camera | Shake(float, float) | Screen shake |
Camera | SetViewMode / SetDistance / LookAt | Camera control |
Player | Teleport(x, y, z) | Instant position move |
Player | SetSpeed / SetJumpPower / SetGravity | Movement tuning |
Player | SetSkinColor / SetShirtColor / SetPantsColor / SetHairColor / SetShoeColor | Character appearance |
Audio | PlaySound(string, float, float) | One-shot SFX |
Audio | PlayMusic / StopMusic | Background music |
Audio | PlayTone(float, float, float) | Procedural oscillator |
Audio | SetMasterVolume / SetMusicVolume / SetSfxVolume | Volume controls |
Particles | Explosion / Fire / Smoke / Magic / Burst | Particle presets |