concinnity_engine/lib.rs
1//! The runtime crate. Holds the world loop, the ECS, the GraphicsSystem renderer
2//! driver, audio, and physics. The GPU-free render-prep lives in
3//! `concinnity_core::render` and the hardware backends (Metal/DirectX/Vulkan/
4//! Win32) in concinnity-device; this crate drives them through a
5//! `Box<dyn RenderBackend>` from `concinnity_device::init_backend` and never
6//! names a concrete backend. Depends on concinnity-core and concinnity-device
7//! (no concinnity-cook, no image decoders). The editor crate (concinnity-dev)
8//! drives this crate's App / renderer through the public API widened here; the
9//! modules the editor reaches
10//! into are `pub` so it can name their paths, but individual internals stay
11//! `pub(crate)` unless the editor specifically needs them.
12pub mod blob;
13pub mod components;
14pub mod ecs;
15mod heap;
16
17#[cfg(test)]
18mod bench;
19
20// Renderer-free foundation shared with the build/validate pipeline: the result
21// vocabulary, the payload decoders, and the runtime geometry generators, all
22// from concinnity-core. Re-exported under the historical crate::* paths so the
23// rest of the client keeps resolving. world.jsonl I/O lives in concinnity-cook
24// (authoring), which the runtime does not link.
25pub(crate) use concinnity_core::{bake, geometry, result};
26
27// The access-declaration mask builders, reached crate-wide as
28// `crate::component_mask!` / `crate::resource_mask!`.
29pub(crate) use ecs::access_ids::{component_mask, resource_mask};
30
31pub mod app;
32// Flat entry point for a shipped player: run a compiled world from a state dir.
33// The runtime bin calls `concinnity_engine::run_from` rather than reaching
34// through the `app::run` module path.
35pub use app::run::{BlobSource, run_from};
36// The application surface a host embeds: construct an App, populate its world,
37// and drive it with `App::run` / `App::run_with`. Exported flat so the
38// `concinnity` facade crate re-exports these under its own root.
39pub use app::run::{PipelineMode, RunOptions, init_logging};
40pub use app::state::App;
41// Redirect runtime-writable state (`saves/` + `settings`) before `run_from`
42// when the content dir is read-only. Exported beside `run_from` so the runtime
43// bin's entire entry API lives on this crate.
44pub use concinnity_host::store::paths;
45pub use concinnity_host::store::paths::set_writable_state_dir;
46
47// Export-time compilation of the built-in shaders into the cache segment a
48// bundle ships, for backends that compile them at renderer init. Re-exported
49// so `cn export` reaches it without a direct device dependency.
50#[cfg(any(backend_dx, backend_vk))]
51pub use concinnity_device::precompile::{
52 Report as ShaderPrecompileReport, precompile_builtin_shaders,
53};
54pub(crate) mod cbor_file;
55pub(crate) mod config;
56/// Crash reporting: panic hook, native fault capture, local report files.
57/// `pub` so the binaries install the hooks and the editor composes the
58/// recent-log ring layer into its tracing subscriber.
59pub mod crash;
60pub mod shutdown;
61// 3D positional sound and screen-triggered cues, and the one module that names
62// kira.
63pub(crate) mod audio;
64// The standalone startup-error window, shown when a fatal startup failure
65// happens before any world exists.
66pub(crate) mod error_screen;
67pub mod gfx;
68pub(crate) mod hud;
69pub(crate) mod input;
70// The rigid-body simulation driver: builds a `concinnity_core::physics::Simulation`
71// from the world's physics content and steps it on the fixed tick.
72pub(crate) mod physics;
73// Declarative logic (Behavior components + the shared world variables
74// store), scheduled before SpawnSystem so its requests apply the same tick.
75pub(crate) mod behavior;
76// The rayon job pool, re-exported under the historical crate::jobs path. `pub`
77// so the editor's hot-reload decoder keeps reaching it through
78// `concinnity_engine::jobs`.
79pub use concinnity_host::thread::jobs;
80/// Runtime resource tables (per-kind, handle-indexed views of the blob's resource
81/// stream). `pub` so the editor's in-memory build path can construct the tables it
82/// inserts into the world, mirroring the shipped-runtime loader.
83pub mod resource;
84// Runtime entity churn (Lifetime/Spawner ticks + spawn/despawn/reparent
85// drains), scheduled immediately before GraphicsSystem.
86pub(crate) mod spawn;
87pub(crate) mod story;
88pub(crate) mod text_input_system;
89pub(crate) mod ui;
90
91// Asset API
92pub use components::*;