Editor-first
Create and organize Worlds, Seeds, assets, and play-mode workflows in the editor.
Start Here
GENESIS is an AI-powered editor-first game engine with a native C++ core and C# gameplay scripting. This documentation is written for someone who needs to build content today using the editor and the current managed API surface.
Experimental Build Warning
Everything is subject to change, including systems, workflows, and API style. Expect active iteration and plan for breaking changes while evaluating or building with the current release.
Download Installer
BehaviourPart and are attached through
ScriptBehaviourPart.
Create and organize Worlds, Seeds, assets, and play-mode workflows in the editor.
Author scripts in project assets, attach them to Seeds, then use lifecycle callbacks.
Import animated models, extract clips, wire Animator states, and preview playback in Timeline.
BehaviourPart and attach it to a Seed.Start Here
GenesisEditor.C:\Users\USER\Documents\GENESIS Projects\GENESIS Demo.ScriptBehaviourPart and set its managed type name to your script type, for example Game.MyMoverPart.Animation Data, and extract clips to .animclip assets.using Genesis;
namespace Game;
public sealed class HelloPart : BehaviourPart
{
public HelloPart(ObjectHandle handle) : base(handle) {}
public override void Start()
{
Console.Log("Hello from GENESIS.");
}
public override void Update()
{
var p = Transform.Position;
p.Y += Time.DeltaTime;
Transform.Position = p;
}
}
Public properties on a script can be serialized by the editor when assigned through a
ScriptBehaviourPart. Keep properties simple and explicit.
Start Here
ExampleProject/Assets/ExampleProject/Assets/Scripts/ExampleProject/Library/Source/Managed/Genesis.ScriptCore/Editor Workflow
The editor is the primary authoring surface. The central workflow is to manage Worlds and Seeds, assign Parts, then use Play Mode to run scripts against the active runtime workspace.
Editor Workflow
A World is an authoring/runtime space. A Blueprint is a reusable serialized Seed hierarchy template. A WorldGroup groups Worlds that should load together.
Editor Workflow
Play Mode runs script lifecycle callbacks against the play workspace. Scene View remains an editor navigation surface. Game View owns gameplay input only when focused, clicked, or actively cursor-captured.
Pressing Play now reveals and focuses Game View. If the panel is hidden, the editor docks it near Scene View before handing focus to runtime output.
Cursor.Locked = true. Escape releases capture
in editor Play Mode. Click inside Game View to reacquire when the script still requests lock.
Editor Workflow
Supported authored assets live under Assets/. Metadata is stored in .atom
sidecar files. The .atom file is metadata, not a runtime object type.
Animation Data and extract clips..animclip files can be dropped into Animator Graph states and previewed in Timeline.Inline Material edits in the Inspector preview immediately in Scene View and Game View while avoiding save/reimport-on-draw. Save the asset when the authored change should persist.
Editor Workflow
The current animation path follows the engine's skinned animation workflow: imported model, visible skeleton hierarchy, skinned mesh renderer, extracted animation clips, Animator Graph state logic, and Timeline preview.
Animation Data in the Inspector..animclip assets..animclip assets onto the graph to create clip-backed states.C# Scripting API
Gameplay scripts generally use the public Genesis namespace and derive from
BehaviourPart.
using Genesis;
namespace Game;
public sealed class SpinPart : BehaviourPart
{
public SpinPart(ObjectHandle handle) : base(handle) {}
public float DegreesPerSecond { get; set; } = 45.0f;
public override void Update()
{
var rotation = Transform.RotationEuler;
rotation.Y += DegreesPerSecond * Time.DeltaTime;
Transform.RotationEuler = rotation;
}
}
ObjectHandle.Transform, Seed, and World inside lifecycle callbacks.Genesis.Console for logs visible to the engine.C# Scripting API
Script assets can be opened directly from the editor. Double-click a .cs Script asset in the
Content Browser, or use Open in Code Editor from its context menu. GENESIS refreshes the
generated C# workspace before launching the external editor.
Use Project Settings > Project > Code Editor to choose the script-opening workflow for the
project. Auto tries Visual Studio Code first, then Visual Studio, then the platform default
application. You can also force Visual Studio Code, Visual Studio, or the default application. When Visual
Studio is selected, choose Any / Latest Installed or a specific installed generation such as
Visual Studio 2022 or Visual Studio 2019.
.code-workspace whose visible folder is the real project root.Assets folder; generated files stay under Library/ManagedScripts/Project.Library/ManagedScripts/Project/Genesis.UserScripts.Project.slnLibrary/ManagedScripts/Project/Genesis.UserScripts.Project.csprojAssets.Library/ManagedScripts/Project/Genesis.UserScripts.Project.code-workspaceNormal projects reference the GENESIS C# API through staged runtime DLLs plus companion XML documentation files. This gives Visual Studio and VS Code completion, signature help, metadata-as-source, and API tooltips without requiring engine source code.
Calls into lifecycle methods such as Start() and Update() are dispatched by the
engine runtime, so Visual Studio call hierarchy may not show a normal direct C# caller. References within
your own project scripts work normally.
Engine source navigation is opt-in. Set GENESIS_SCRIPT_WORKSPACE_SOURCE_REFERENCES=1 before
launching the editor to generate source ProjectReference entries for
Genesis.ManagedBindings and Genesis.ScriptCore. Leave this unset for normal user
projects.
Reference
Latest release notes are shown first. Use the version selector to review older releases.
C# Scripting API
BehaviourPart exposes the standard scripting lifecycle hooks:
| Callback | Use |
|---|---|
OnCreate() | Native/managed object creation setup. |
OnDestroy() | Cleanup before destruction. |
OnEnable() | Seed or Part became active. |
OnDisable() | Seed or Part became inactive. |
Start() | One-time play setup. |
Update() | Frame update. |
LateUpdate() | Post-update follow-up. |
FixedUpdate() | Fixed-step simulation. |
OnValidate() | Editor validation hook. |
C# Scripting API
Every Seed owns a mandatory TransformPart. Scripts access it through
Transform on the current behavior or someSeed.Transform for another Seed handle.
Transform.Position += Transform.Forward * 2.0f * DeltaTime;
Transform.RotationEuler += Vector3.up * 90.0f * DeltaTime;
Transform.LocalScale = Vector3.one;
Vector3 Position and Vector3 WorldPosition read/write world-space position.Vector3 RotationEuler and Vector3 WorldRotationEuler read/write world-space Euler rotation in degrees.Vector3 Scale and Vector3 LocalScale read/write parent-relative scale.Vector3 LocalPosition and Vector3 LocalRotationEuler read/write parent-relative position and Euler rotation.Forward, Right, and Up return normalized world-space axes derived from the transform rotation.Snapshot, LocalSnapshot, and WorldSnapshot support grouped reads/writes.Authoring remains Euler-facing for now. Parent/child transforms compose through the engine hierarchy, and world-space writes are converted back to local data behind the scenes.
C# Scripting API
GENESIS follows the familiar game-engine split between world space and local space. World-space values locate a Seed in the loaded World. Local-space values are relative to the Seed's parent. Root Seeds have matching local and world transforms.
| Member | Space | Use |
|---|---|---|
Position, WorldPosition | World | Move or read a Seed in World coordinates. |
RotationEuler, WorldRotationEuler | World | Read/write Euler rotation in degrees after parent rotation is applied. |
WorldScale | World | Read/write final scale after parent scale is applied. |
LocalPosition | Local | Position relative to the parent Seed. |
LocalRotationEuler | Local | Euler rotation relative to the parent Seed. |
Scale, LocalScale | Local | Parent-relative scale stored in local space. |
Vector3.forward, Vector3.right, and Vector3.up are constant world
directions. Transform.forward, Transform.right, and Transform.up
are this Seed's local axes expressed in world space, so rotating the Seed changes them.
public override void Update()
{
Transform.Position += Transform.forward * 5.0f * DeltaTime;
Transform.WorldRotationEuler += Vector3.up * 90.0f * DeltaTime;
}
Vector2 and Vector3 support component-wise vector math and scalar math with
int or float values. Direction constants are available in both Pascal-case and
lowercase aliases for the same direction constants.
var planar = Vector2.right * 3;
var offset = (Vector3.up * 2.0f) + (Vector3.forward * 4.0f);
Transform.LocalPosition += offset;
C# Scripting API
Input provides frame snapshots for keyboard, mouse buttons, pointer position, mouse delta,
and wheel delta.
if (Input.GetKey(KeyCode.W))
{
Console.Log("Move forward");
}
if (Input.GetMouseButtonDown(MouseButton.Left))
{
Console.Log("Fire");
}
var yawDelta = Input.MouseDeltaX;
var pitchDelta = Input.MouseDeltaY;
Cursor.Visible = false;
Cursor.Locked = true;
Cursor.Visible requests OS cursor visibility.Cursor.Locked requests FPS-style capture.
Current keys include letters A through Z, arrows, Space,
Escape, modifiers, delete/backspace, tab/enter, and F1 through F8.
Mouse buttons include Left, Right, Middle, X1, and X2.
C# Scripting API
Scripts can resolve an attached Animator through Seed.Animator or from the current behavior's
Seed. The API drives runtime Animator state; scripts should not parse controller assets or write
skinned poses directly.
public sealed class DragonDriverPart : BehaviourPart
{
public DragonDriverPart(ObjectHandle handle) : base(handle) {}
public override void Start()
{
Seed.Animator?.PlayState("Idle");
}
public override void Update()
{
var animator = Seed.Animator;
if (animator is null)
{
return;
}
animator.PlaybackSpeed = Input.GetKey(KeyCode.LeftShift) ? 1.5f : 1.0f;
if (Input.GetKeyDown(KeyCode.Space))
{
animator.SetTrigger("TakeOff");
}
}
}
Play(), Stop(), Restart(), and PlayState(name, startTime).CurrentTime, PlaybackSpeed, and IsPlaying.CurrentState and NextState for runtime graph feedback.SetTrigger(), ResetTrigger(), SetBool(), SetFloat(), SetInt(), and SetString().C# Scripting API
Player startup resolution comes from project graphics settings, and scripts can adjust presentation and quality at runtime.
Console.Log($"Current resolution: {Screen.Width}x{Screen.Height}");
if (Input.GetKeyDown(KeyCode.F5))
{
Screen.SetResolution(1280, 720);
}
if (Input.GetKeyDown(KeyCode.F6))
{
QualitySettings.ShadowQuality = QualityLevel.High;
QualitySettings.ReflectionQuality = QualityLevel.Medium;
}
Screen.Width and Screen.Height report the current presentation size.Screen.SetResolution(width, height) requests a runtime size change.QualitySettings.ShadowQuality and QualitySettings.ReflectionQuality accept Low, Medium, or High.C# Scripting API
| Type | Current use |
|---|---|
Seed | Runtime/editor object wrapper. Has Name, Transform, ActiveSelf, AudioSource, Animator, SetActive(), and Destroy(). |
Part | Base wrapper for modular functionality attached to a Seed. |
BehaviourPart | Base class for C# scripts. |
AnimatorPart | Runtime Animator wrapper for state playback, graph parameters, triggers, and current/next state queries. |
World | Creates Seeds and instantiates Blueprints. |
ObjectHandle | Stable handle used by wrappers. Do not replace this with raw pointers. |
var spawned = World.CreateSeed("Runtime Seed");
spawned.Transform.Position = new Vector3(0.0f, 1.0f, 0.0f);
var enemy = World.InstantiateBlueprint("Assets/Blueprints/Enemy.blueprint");
enemy.SetActive(true);
C# Scripting API
Audio.PlayOneShot("Assets/Audio/shot.wav", 0.85f);
var source = Seed.AudioSource;
source?.Play();
AudioSourcePart currently exposes Play() and Stop().
Span<ObjectHandle> hits = stackalloc ObjectHandle[16];
var count = Physics.OverlapSphereNonAlloc(
new Vector3(0.0f, 1.0f, 0.0f),
2.0f,
hits);
Physics API is intentionally small today. Prefer non-alloc queries for gameplay loops.
Examples
These copy-paste recipes use the current public Genesis gameplay API.
Start with lifecycle basics, then layer in runtime spawning,
animation, physics, audio, and presentation control as your script needs more behavior.
Smallest useful script. Confirms the script type is resolving and the lifecycle is running.
using Genesis;
namespace Game;
public sealed class HelloPart : BehaviourPart
{
public HelloPart(ObjectHandle handle) : base(handle) {}
public override void Start()
{
Console.Log($"Hello from {Seed.Name}.");
}
}
Good first example for editing transform data from Update().
using Genesis;
namespace Game;
public sealed class SpinPart : BehaviourPart
{
public SpinPart(ObjectHandle handle) : base(handle) {}
public float DegreesPerSecond { get; set; } = 60.0f;
public override void Update()
{
var rotation = Transform.RotationEuler;
rotation.Y += DegreesPerSecond * DeltaTime;
Transform.RotationEuler = rotation;
}
}
Uses OnCreate() plus a cached ScriptTransform snapshot to layer runtime motion over authored content.
using System;
using Genesis;
namespace Game;
public sealed class HoverPart : BehaviourPart
{
private ScriptTransform _initialTransform;
private float _elapsedSeconds;
public HoverPart(ObjectHandle handle) : base(handle) {}
public float HoverHeight { get; set; } = 0.35f;
public float HoverSpeed { get; set; } = 1.75f;
public float PulseAmount { get; set; } = 0.08f;
public override void OnCreate()
{
_initialTransform = Transform.Snapshot;
_elapsedSeconds = 0.0f;
}
public override void Update()
{
_elapsedSeconds += DeltaTime;
var pulse = 1.0f + (MathF.Sin(_elapsedSeconds * HoverSpeed) * PulseAmount);
Transform.Snapshot = new ScriptTransform
{
Position = new Vector3(
_initialTransform.Position.X,
_initialTransform.Position.Y + (MathF.Sin(_elapsedSeconds * HoverSpeed) * HoverHeight),
_initialTransform.Position.Z),
RotationEuler = _initialTransform.RotationEuler,
Scale = new Vector3(
_initialTransform.Scale.X * pulse,
_initialTransform.Scale.Y * pulse,
_initialTransform.Scale.Z * pulse)
};
}
}
Useful for first-person or free-look prototypes. In editor Play Mode, click Game View to capture input again after Escape.
using Genesis;
namespace Game;
public sealed class MouseLookPart : BehaviourPart
{
private float _yawDegrees;
private float _pitchDegrees;
public MouseLookPart(ObjectHandle handle) : base(handle) {}
public float MouseSensitivity { get; set; } = 0.12f;
public override void OnEnable()
{
Cursor.Visible = false;
Cursor.Locked = true;
}
public override void OnDisable()
{
Cursor.Visible = true;
Cursor.Locked = false;
}
public override void Update()
{
_yawDegrees += Input.MouseDeltaX * MouseSensitivity;
_pitchDegrees -= Input.MouseDeltaY * MouseSensitivity;
if (_pitchDegrees > 85.0f) _pitchDegrees = 85.0f;
if (_pitchDegrees < -85.0f) _pitchDegrees = -85.0f;
Transform.RotationEuler = new Vector3(_pitchDegrees, _yawDegrees, 0.0f);
}
}
Instantiates authored Blueprint content and places it relative to the current Seed.
using Genesis;
namespace Game;
public sealed class ProjectileSpawnerPart : BehaviourPart
{
public ProjectileSpawnerPart(ObjectHandle handle) : base(handle) {}
public string ProjectileBlueprint { get; set; } = "Assets/Blueprints/Projectile.blueprint";
public float ForwardOffset { get; set; } = 2.0f;
public override void Update()
{
if (!Input.GetMouseButtonDown(MouseButton.Left))
{
return;
}
var projectile = World.InstantiateBlueprint(ProjectileBlueprint);
if (!projectile.Handle.IsValid)
{
Console.Error($"Could not instantiate '{ProjectileBlueprint}'.");
return;
}
var position = Transform.Position;
position.Z += ForwardOffset;
projectile.Transform.Position = position;
projectile.Transform.RotationEuler = Transform.RotationEuler;
}
}
Useful for temporary markers, invisible control objects, or simple runtime-only placeholders.
using Genesis;
namespace Game;
public sealed class RuntimeSeedPart : BehaviourPart
{
private Seed? _marker;
public RuntimeSeedPart(ObjectHandle handle) : base(handle) {}
public override void Start()
{
_marker = World.CreateSeed("Runtime Marker");
_marker.Transform.Position = new Vector3(0.0f, 2.0f, 0.0f);
}
public override void Update()
{
if (_marker is null || !_marker.Handle.IsValid)
{
return;
}
if (Input.GetKeyDown(KeyCode.F1))
{
_marker.SetActive(!_marker.ActiveSelf);
}
}
public override void OnDestroy()
{
if (_marker is not null && _marker.Handle.IsValid)
{
_marker.Destroy();
}
}
}
Shows both current audio entry points: an attached AudioSourcePart and global Audio.PlayOneShot(...).
using Genesis;
namespace Game;
public sealed class AudioHotkeyPart : BehaviourPart
{
public AudioHotkeyPart(ObjectHandle handle) : base(handle) {}
public string OneShotPath { get; set; } = "Assets/Audio/Click.wav";
public override void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
Seed.AudioSource?.Play();
}
if (Input.GetKeyDown(KeyCode.Enter))
{
Audio.PlayOneShot(OneShotPath, 0.75f);
}
if (Input.GetKeyDown(KeyCode.Backspace))
{
Seed.AudioSource?.Stop();
}
}
}
Uses an attached AnimatorPart to switch states, control parameters, and adjust playback speed.
using Genesis;
namespace Game;
public sealed class AnimatorDriverPart : BehaviourPart
{
public AnimatorDriverPart(ObjectHandle handle) : base(handle) {}
public override void Start()
{
Seed.Animator?.PlayState("Idle");
}
public override void Update()
{
var animator = Seed.Animator;
if (animator is null)
{
return;
}
var moving = Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow);
animator.SetBool("Moving", moving);
animator.PlaybackSpeed = Input.GetKey(KeyCode.LeftShift) ? 1.5f : 1.0f;
if (Input.GetKeyDown(KeyCode.Space))
{
animator.SetTrigger("Jump");
}
}
}
Current physics scripting is intentionally small, but OverlapSphereNonAlloc is enough for proximity logic and lightweight gameplay sensors.
using Genesis;
namespace Game;
public sealed class ProximitySensorPart : BehaviourPart
{
private readonly ObjectHandle[] _hits = new ObjectHandle[16];
public ProximitySensorPart(ObjectHandle handle) : base(handle) {}
public float Radius { get; set; } = 3.0f;
public override void Update()
{
var count = Physics.OverlapSphereNonAlloc(Transform.Position, Radius, _hits);
if (count > 1)
{
Console.Log($"Detected {count - 1} nearby handle(s).");
}
}
}
Helpful for quick player-side testing of resolution, window mode, and quality settings.
using Genesis;
namespace Game;
public sealed class PresentationHotkeysPart : BehaviourPart
{
public PresentationHotkeysPart(ObjectHandle handle) : base(handle) {}
public override void Update()
{
if (Input.GetKeyDown(KeyCode.F5))
{
Screen.SetResolution(1280, 720, WindowMode.Windowed);
}
if (Input.GetKeyDown(KeyCode.F6))
{
Screen.Mode = WindowMode.Borderless;
}
if (Input.GetKeyDown(KeyCode.F7))
{
QualitySettings.ShadowQuality = QualityLevel.High;
QualitySettings.ReflectionQuality = QualityLevel.Medium;
}
}
}
C# Scripting API
This page is a practical snapshot of the public managed API currently exposed to scripts.
Gameplay scripts primarily use using Genesis;. Editor-only extension points use
using Genesis.EditorScriptCore;.
Use Genesis for runtime behavior scripts attached through ScriptBehaviourPart.
| Type | Current members |
|---|---|
Vector2 | X, Y, constructor Vector2(float x, float y), scalar/vector arithmetic, Magnitude, Normalized, zero, one, up, down, right, left, forward, back. |
Vector3 | X, Y, Z, constructor Vector3(float x, float y, float z), scalar/vector arithmetic, Magnitude, Normalized, zero, one, up, down, right, left, forward, back. |
ScriptTransform | Position, RotationEuler in degrees, Scale. |
ObjectHandle | Slot, Generation, Kind, IsValid. |
AssetGuid | High, Low, IsValid, ToString(). |
SeedId | Stable Seed identifier wrapper. |
PartId | Stable Part identifier wrapper. |
WorldId | Stable World identifier wrapper. |
AssetReference<TAsset> | Record struct carrying Guid and AssetPath. |
| Type | Current members |
|---|---|
EngineObject | Name, Handle. |
Seed | Transform, ActiveSelf, AudioSource, Animator, SetActive(bool), Destroy(), inherited Name and Handle. |
Part | Base wrapper for modular Seed functionality. |
BehaviourPart | Base class for authored C# gameplay scripts. |
TransformPart | Transform, Position, RotationEuler, Scale, local/world transform members, and Forward/Right/Up axes. |
CameraPart | Public wrapper type with no extra script-facing members today. |
AudioSourcePart | Play(), Stop(). |
AnimatorPart | Runtime Animator control surface. See the dedicated list below. |
World | CreateSeed(string name = "Seed"), InstantiateBlueprint(string assetPath), inherited Name and Handle. |
Override any of these methods on a gameplay script:
OnCreate()OnDestroy()OnEnable()OnDisable()Start()Update()LateUpdate()FixedUpdate()OnValidate()Inside those callbacks, scripts can use protected context members:
SeedWorldTransformDeltaTimeScriptTransformAccess currently exposes:
Position, WorldPosition, LocalPositionRotationEuler, WorldRotationEuler, LocalRotationEulerScale, LocalScale, WorldScaleForward, Right, Up, plus lowercase aliasesSnapshot, LocalSnapshot, WorldSnapshot| Member | Use |
|---|---|
IsPlaying | Whether the Animator is currently playing. |
CurrentState | Current runtime state name. |
NextState | Transition target state name when one is active. |
CurrentTime | Read or set the current playback time. |
PlaybackSpeed | Read or set the playback speed multiplier. |
Play() | Resume or begin playback. |
Stop() | Stop playback. |
Restart() | Restart from the beginning. |
PlayState(string stateName, float startTime = 0.0f) | Jump to a named state. |
SetTrigger(string triggerName) | Raise a trigger parameter. |
ResetTrigger(string triggerName) | Clear a trigger parameter. |
SetBool(...), GetBool(...) | Read and write bool parameters. |
SetFloat(...), GetFloat(...) | Read and write float parameters. |
SetInt(...), GetInt(...) | Read and write int parameters. |
SetString(...), GetString(...) | Read and write string parameters. |
| Type | Current members |
|---|---|
Input | GetKey(), GetKeyDown(), GetKeyUp(), GetMouseButton(), GetMouseButtonDown(), GetMouseButtonUp(), MouseDeltaX, MouseDeltaY, MouseX, MouseY, MouseWheelDelta. |
Cursor | Settable Visible and Locked. |
KeyCode | Letters A through Z, digits Alpha0 through Alpha9, arrows, modifiers, Tab, Enter, Escape, Backspace, Delete, and F1 through F8. |
MouseButton | Left, Right, Middle, X1, X2. |
| Type | Current members |
|---|---|
Screen | Width, Height, Mode, SetResolution(int width, int height), SetResolution(int width, int height, WindowMode mode). |
WindowMode | Windowed, Borderless, Fullscreen. |
QualitySettings | ShadowQuality, ReflectionQuality. |
QualityLevel | Low, Medium, High. |
| Type | Current members |
|---|---|
Time | DeltaTime. |
Console | Log(object?), Warning(object?), Error(object?). |
Audio | PlayOneShot(string assetPath, float volume = 1.0f). |
Physics | OverlapSphereNonAlloc(Vector3 center, float radius, Span<ObjectHandle> results). |
SignalBus | Dispatch(string signalName). |
Genesis.EditorScriptCore is the current editor-extension surface. It exists today,
but it is still much smaller than the gameplay runtime API.
| Type | Current members |
|---|---|
CustomInspectorAttribute | Marks a class as a custom inspector for a target type. |
CustomPropertyDrawerAttribute | Marks a class as a custom property drawer for a target type. |
MenuCommandAttribute | Marks a method as an editor menu command with a path string. |
EditorWindow | Title, OnGUI(). |
Inspector | OnInspectorGUI(EngineObject target). |
PropertyDrawer | OnGUI(string propertyName, object? value). |
Selection | ActiveObject. |
Examples
This standalone example shows how to build a first-person Seed setup with movement, mouse look, cursor capture, weapon animation hooks, and a short muzzle flash.
Keep the controller on the camera Seed so the script can drive the player's view directly. The root Seed acts as the authoring handle, while child Seeds provide the camera, weapon, and optional flash effect.
Player Seed
Head Camera
CameraPart
ScriptBehaviourPart: Game.FirstPersonControllerPart
Muzzle Flash
MeshFilterPart
MeshRendererPart
ArmsGun
MeshFilterPart
AnimatorPart
Assign the related child Seed ids into the script properties. Set either id to 0
when you want movement and look only.
managedTypeName: Game.FirstPersonControllerPart
HideMouseCursor: true
LockMouseCursor: true
EyeHeight: 2.0
MouseSensitivity: 0.13
MuzzleFlashSeedId: 730490
WeaponAnimatorSeedId: 910045
IdleStateName: Idle
WalkStateName: Walk
RunStateName: Run
FireStateName: Fire
Input.MouseDeltaX and Input.MouseDeltaY.Cursor.Locked and Cursor.Visible.Start with explicit public properties so the editor can expose the tuning values and linked Seed ids. The following controller fragments live inside this class.
using System;
using Genesis;
namespace Game;
public sealed class FirstPersonControllerPart : BehaviourPart
{
private Vector3 _position;
private float _yawDegrees;
private float _pitchDegrees;
private float _verticalVelocity;
private Seed? _muzzleFlashSeed;
private Seed? _weaponAnimatorSeed;
private AnimatorPart? _weaponAnimator;
private ScriptTransform _weaponInitialTransform;
private float _muzzleFlashRemaining;
private int _resolvedWeaponAnimatorSeedId;
public FirstPersonControllerPart(ObjectHandle handle) : base(handle) {}
public float WalkSpeed { get; set; } = 5.0f;
public float RunSpeed { get; set; } = 8.5f;
public float JumpVelocity { get; set; } = 6.5f;
public float Gravity { get; set; } = 18.0f;
public float MouseSensitivity { get; set; } = 0.12f;
public float MinPitchDegrees { get; set; } = -82.0f;
public float MaxPitchDegrees { get; set; } = 82.0f;
public float EyeHeight { get; set; } = 1.72f;
public bool HideMouseCursor { get; set; } = true;
public bool LockMouseCursor { get; set; } = true;
public int MuzzleFlashSeedId { get; set; } = 0;
public float MuzzleFlashDurationSeconds { get; set; } = 0.055f;
public int WeaponAnimatorSeedId { get; set; } = 0;
// Add the controller loop, movement, and optional hooks below.
}
The controller captures its authored starting transform, updates input every frame, then writes
the final camera transform back through Transform.Snapshot.
public override void Start()
{
CaptureInitialTransform();
ApplyCursorVisibility();
Console.Log("First person controller ready.");
}
public override void Update()
{
var deltaTime = MathF.Max(0.0f, Time.DeltaTime);
ApplyCursorVisibility();
UpdateLook();
UpdateMovement(deltaTime);
UpdateWeaponInput(deltaTime);
UpdateWeaponAnimation(deltaTime);
UpdateMuzzleFlash(deltaTime);
Transform.Snapshot = new ScriptTransform
{
Position = _position,
RotationEuler = new Vector3(_pitchDegrees, _yawDegrees, 0.0f),
Scale = new Vector3(1.0f, 1.0f, 1.0f)
};
}
Mouse deltas drive yaw and pitch. Clamping pitch keeps the view from flipping over.
private void UpdateLook()
{
_yawDegrees += Input.MouseDeltaX * MouseSensitivity;
_pitchDegrees = Clamp(_pitchDegrees + (Input.MouseDeltaY * MouseSensitivity),
MinPitchDegrees,
MaxPitchDegrees);
}
private void ApplyCursorVisibility()
{
Cursor.Visible = !HideMouseCursor;
Cursor.Locked = LockMouseCursor;
}
Movement is authored as local input, converted through the current yaw, and accumulated into the controller position. The sample keeps gravity simple so the first version is easy to tune.
private void UpdateMovement(float deltaTime)
{
var moveX = 0.0f;
var moveZ = 0.0f;
if (Input.GetKey(KeyCode.A)) moveX -= 1.0f;
if (Input.GetKey(KeyCode.D)) moveX += 1.0f;
if (Input.GetKey(KeyCode.W)) moveZ += 1.0f;
if (Input.GetKey(KeyCode.S)) moveZ -= 1.0f;
var magnitude = MathF.Sqrt((moveX * moveX) + (moveZ * moveZ));
if (magnitude > 0.0001f)
{
moveX /= magnitude;
moveZ /= magnitude;
}
var yawRadians = _yawDegrees * (MathF.PI / 180.0f);
var forwardX = MathF.Sin(yawRadians);
var forwardZ = MathF.Cos(yawRadians);
var rightX = MathF.Cos(yawRadians);
var rightZ = -MathF.Sin(yawRadians);
var running = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
var speed = running ? RunSpeed : WalkSpeed;
_position.X += ((rightX * moveX) + (forwardX * moveZ)) * speed * deltaTime;
_position.Z += ((rightZ * moveX) + (forwardZ * moveZ)) * speed * deltaTime;
if (_position.Y <= EyeHeight + 0.001f && Input.GetKeyDown(KeyCode.Space))
{
_verticalVelocity = JumpVelocity;
}
_verticalVelocity -= Gravity * deltaTime;
_position.Y = MathF.Max(EyeHeight, _position.Y + (_verticalVelocity * deltaTime));
}
The weapon Seed is resolved from an Inspector-provided id. The same pattern works for optional helper Seeds because the controller can skip the feature when an id is not assigned.
private void ResolveWeaponAnimator(bool force = false)
{
if (!force && _resolvedWeaponAnimatorSeedId == WeaponAnimatorSeedId)
{
return;
}
_resolvedWeaponAnimatorSeedId = WeaponAnimatorSeedId;
_weaponAnimatorSeed = null;
_weaponAnimator = null;
if (WeaponAnimatorSeedId <= 0)
{
return;
}
var handle = new ObjectHandle((uint)WeaponAnimatorSeedId, 1, ObjectKind.Seed);
_weaponAnimatorSeed = new Seed(handle);
_weaponAnimator = _weaponAnimatorSeed.Animator;
_weaponInitialTransform = _weaponAnimatorSeed.Transform.Snapshot;
}
private void TriggerMuzzleFlash()
{
ResolveMuzzleFlashSeed();
if (_muzzleFlashSeed is null)
{
return;
}
_muzzleFlashSeed.SetActive(true);
_muzzleFlashRemaining = MathF.Max(0.01f, MuzzleFlashDurationSeconds);
}
Examples
Use World.InstantiateBlueprint() from a running BehaviourPart.
Pass the authored asset path.
public string ProjectileBlueprint { get; set; } = "Assets/Blueprints/Projectile.blueprint";
public override void Update()
{
if (!Input.GetMouseButtonDown(MouseButton.Left))
{
return;
}
var projectile = World.InstantiateBlueprint(ProjectileBlueprint);
projectile.Transform.Position = Transform.Position;
}
Examples
Console.Log(), Console.Warning(), and Console.Error().ScriptBehaviourPart.public MyPart(ObjectHandle handle) : base(handle) {}.using Genesis;
namespace Game;
public sealed class DebugProbePart : BehaviourPart
{
public DebugProbePart(ObjectHandle handle) : base(handle) {}
public override void OnCreate()
{
Console.Log($"DebugProbe created on Seed '{Seed.Name}'.");
}
public override void Start()
{
if (Seed.Animator is null)
{
Console.Warning($"Seed '{Seed.Name}' has no AnimatorPart attached.");
}
}
public override void Update()
{
if (!Input.GetKeyDown(KeyCode.F2))
{
return;
}
var position = Transform.Position;
Console.Log(
$"Seed='{Seed.Name}' active={Seed.ActiveSelf} " +
$"position=({position.X}, {position.Y}, {position.Z})");
}
public override void OnDestroy()
{
Console.Log($"DebugProbe destroyed on Seed '{Seed.Name}'.");
}
}
Reference
| Term | Meaning |
|---|---|
| Seed | Runtime/editor object in a World. |
| Part | Modular functionality attached to a Seed. |
| Blueprint | Reusable serialized Seed hierarchy template. |
| World | Authoring/runtime space containing Seeds. |
| WorldGroup | Grouped set of Worlds loaded together. |
| Signal | Event/message system. |
| .atom | Sidecar metadata format for assets. |
Lifecycle naming is fixed: Create(), Instantiate(), Clone(), Destroy().
Part management naming is fixed: addPart(), removePart(), hasPart(), getPart().
Reference
License
CC BY-NC-ND 4.0
GENESIS Engine is currently distributed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International license.
| License term | Meaning |
|---|---|
| Attribution | Credit the GENESIS Engine project when sharing the licensed material. |
| NonCommercial | Do not use the licensed material for commercial purposes. |
| NoDerivatives | Do not redistribute modified versions of the licensed material. |
The current documentation portal includes the embedded Creative Commons license text below so the full reference stays inside this documentation surface.
Attribution-NonCommercial-NoDerivatives 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright and
certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use
by those authorized to give the public permission to use material in
ways otherwise restricted by copyright and certain other rights. Our
licenses are irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it. Licensors
should also secure all rights necessary before applying our licenses so
that the public can reuse the material as expected. Licensors should
clearly mark any material not subject to the license. This includes
other CC-licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public licenses, a
licensor grants the public permission to use the licensed material under
specified terms and conditions. If the licensor's permission is not
necessary for any reason--for example, because of any applicable
exception or limitation to copyright--then that use is not regulated by
the license. Our licenses grant only permissions under copyright and
certain other rights that a licensor has authority to grant. Use of the
licensed material may still be restricted for other reasons, including
because others have copyright or other rights in the material. A
licensor may make special requests, such as asking that all changes be
marked or described. Although not required by our licenses, you are
encouraged to respect those requests where reasonable. More
considerations for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0
International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-NonCommercial-NoDerivatives 4.0 International Public License
("Public License"). To the extent this Public License may be interpreted
as a contract, You are granted the Licensed Rights in consideration of
Your acceptance of these terms and conditions, and the Licensor grants
You such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material and in
which the Licensed Material is translated, altered, arranged,
transformed, or otherwise modified in a manner requiring permission
under the Copyright and Similar Rights held by the Licensor. For
purposes of this Public License, where the Licensed Material is a
musical work, performance, or sound recording, Adapted Material is
always produced where the Licensed Material is synched in timed relation
with a moving image.
b. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or categorized. For
purposes of this Public License, the rights specified in Section
2(b)(1)-(2) are not Copyright and Similar Rights.
c. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright Treaty
adopted on December 20, 1996, and/or similar international agreements.
d. Exceptions and Limitations means fair use, fair dealing, and/or any
other exception or limitation to Copyright and Similar Rights that
applies to Your use of the Licensed Material.
e. Licensed Material means the artistic or literary work, database, or
other material to which the Licensor applied this Public License.
f. Licensed Rights means the rights granted to You subject to the terms
and conditions of this Public License, which are limited to all
Copyright and Similar Rights that apply to Your use of the Licensed
Material and that the Licensor has authority to license.
g. Licensor means the individual(s) or entity(ies) granting rights under
this Public License.
h. NonCommercial means not primarily intended for or directed towards
commercial advantage or monetary compensation. For purposes of this
Public License, the exchange of the Licensed Material for other material
subject to Copyright and Similar Rights by digital file-sharing or
similar means is NonCommercial provided there is no payment of monetary
compensation in connection with the exchange.
i. Share means to provide material to the public by any means or process
that requires permission under the Licensed Rights, such as
reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the public may
access the material from a place and at a time individually chosen by
them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of the
Council of 11 March 1996 on the legal protection of databases, as
amended and/or succeeded, as well as other essentially equivalent rights
anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the
Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to exercise the
Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or in part,
for NonCommercial purposes only; and
b. produce and reproduce, but not Share, Adapted Material for
NonCommercial purposes only.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public License does
not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor
authorizes You to exercise the Licensed Rights in all media and formats
whether now known or hereafter created, and to make technical
modifications necessary to exercise the Licensed Rights in such media and
formats. The Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications necessary to
exercise the Licensed Rights, including technical modifications
necessary to circumvent Effective Technological Measures. For purposes
of this Public License, simply making modifications authorized by this
Section 2(a)(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every recipient of
the Licensed Material automatically receives an offer from the
Licensor to exercise the Licensed Rights under the terms and
conditions of this Public License.
b. No downstream restrictions. You may not offer or impose any
additional or different terms or conditions on, or apply any
Effective Technological Measures to, the Licensed Material if doing
so restricts exercise of the Licensed Rights by any recipient of the
Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be
construed as permission to assert or imply that You are, or that Your
use of the Licensed Material is, connected with, or sponsored,
endorsed, or granted official status by, the Licensor or others
designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under
this Public License, nor are publicity, privacy, and/or other similar
personality rights; however, to the extent possible, the Licensor
waives and/or agrees not to assert any such rights held by the Licensor
to the limited extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public
License.
3. To the extent possible, the Licensor waives any right to collect
royalties from You for the exercise of the Licensed Rights, whether
directly or through a collecting society under any voluntary or waivable
statutory or compulsory licensing scheme. In all other cases the
Licensor expressly reserves any right to collect such royalties,
including when the Licensed Material is used other than for
NonCommercial purposes.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material, You must:
a. retain the following if it is supplied by the Licensor with the
Licensed Material:
i. identification of the creator(s) of the Licensed Material and
any others designated to receive attribution, in any reasonable
manner requested by the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent
reasonably practicable;
b. indicate if You modified the Licensed Material and retain an
indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this Public
License, and include the text of, or the URI or hyperlink to, this
Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable
manner based on the medium, means, and context in which You Share the
Licensed Material. For example, it may be reasonable to satisfy the
conditions by providing a URI or hyperlink to a resource that includes
the required information.
3. If requested by the Licensor, You must remove any of the information
required by Section 3(a)(1)(A) to the extent reasonably practicable.
For the avoidance of doubt, You do not have permission under this Public
License to Share Adapted Material.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply
to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to
extract, reuse, reproduce, and Share all or a substantial portion of the
contents of the database for NonCommercial purposes only and provided
You do not Share Adapted Material;
b. if You include all or a substantial portion of the database contents
in a database in which You have Sui Generis Database Rights, then the
database in which You have Sui Generis Database Rights (but not its
individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all
or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT
POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND
AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND
CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY,
OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE,
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT,
ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE
OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF
WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT
APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO
YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR
OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL,
PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES
ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN
IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES,
COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT
ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent possible,
most closely approximates an absolute disclaimer and waiver of all
liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and Similar
Rights licensed here. However, if You fail to comply with this Public
License, then Your rights under this Public License terminate
automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it
is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right
the Licensor may have to seek remedies for Your violations of this
Public License.
c. For the avoidance of doubt, the Licensor may also offer the Licensed
Material under separate terms or conditions or stop distributing the
Licensed Material at any time; however, doing so will not terminate this
Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms
or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and independent of
the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall
not be interpreted to, reduce, limit, restrict, or impose conditions on
any use of the Licensed Material that could lawfully be made without
permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the minimum
extent necessary to make it enforceable. If the provision cannot be
reformed, it shall be severed from this Public License without affecting
the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a
limitation upon, or waiver of, any privileges and immunities that apply
to the Licensor or You, including from the legal processes of any
jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses. Notwithstanding,
Creative Commons may elect to apply one of its public licenses to
material it publishes and in those instances will be considered the
"Licensor." The text of the Creative Commons public licenses is
dedicated to the public domain under the CC0 Public Domain Dedication.
Except for the limited purpose of indicating that material is shared
under a Creative Commons public license or as otherwise permitted by the
Creative Commons policies published at creativecommons.org/policies,
Creative Commons does not authorize the use of the trademark "Creative
Commons" or any other trademark or logo of Creative Commons without its
prior written consent including, without limitation, in connection with
any unauthorized modifications to any of its public licenses or any
other arrangements, understandings, or agreements concerning use of
licensed material. For the avoidance of doubt, this paragraph does not
form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.