engine/
lib.rs

1// SPDX-FileCopyrightText: 2024 Jens Pitkänen <jens.pitkanen@helsinki.fi>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5//! This crate makes up most of the runtime engine, containing all engine
6//! systems except for the platform-specific ones. The platform-specifics are
7//! implemented by platform crates, which call and are called from this crate
8//! via the [`platform`] traits.
9//!
10//! Since game engines consist of relatively independent systems, most of this
11//! crate is not exported in the root, but instead in the top-level modules,
12//! each exposing a distinct part of the engine.
13//!
14//! Generic core systems and types are provided by:
15//! - [`allocators`]: Memory allocators used by other parts of the engine,
16//!   mostly collections, for allocating dynamic amounts of data. Allocators can
17//!   be allocated from other allocators, and as such, the engine takes one main
18//!   allocator in [`Engine::new`] which is used directly or indirectly for all
19//!   allocations made by the engine.
20//! - [`collections`]: Simple collection types oriented around up-front
21//!   allocation. There are no Vec-style reallocating collections, to make using
22//!   linear allocators feasible, which in turn is desirable for performance.
23//! - [`geom`]: Geometry types and related math operations.
24//! - [`multithreading`]: Utilities for spreading work between multiple CPU
25//!   cores.
26//!
27//! Specific game engine systems can be found in:
28//! - [`resources`]: Resource/game asset types and their loading systems.
29//! - [`renderer`]: Low-level renderer.
30//! - [`input`]: Input handling.
31//! - [`mixer`]: Audio playback.
32//! - [`game_objects`]: A scene/game object/component system to build gameplay
33//!   systems on.
34
35#![no_std]
36#![warn(missing_docs)]
37
38// Exported to allow instrumenting functions generated with macros.
39pub use profiling;
40
41#[cfg(any(test, doctest))]
42/// A simple platform implementation for use in tests.
43pub mod test_platform;
44
45/// Low-level memory allocators used for all dynamic allocation in the engine.
46///
47/// The idea is to use any system allocators a few times at startup to create
48/// these allocators, and then suballocate from that. This should keep
49/// performance characteristics more predictable between different platforms.
50pub mod allocators;
51/// Collection types for varying memory access patterns. Backing memory provided
52/// by allocators in the [allocators] module.
53pub mod collections;
54/// Runtime game object model types and functionality.
55pub mod game_objects;
56/// Geometry related types and operations.
57pub mod geom;
58/// Input events and their translation into game-specific actions.
59pub mod input;
60/// Audio playback system and types.
61pub mod mixer;
62/// Utilities for splitting work to be processed in parallel.
63pub mod multithreading;
64/// Low-level graphics-related data structures and functionality.
65pub mod renderer;
66/// The resource database and everything related to querying, loading, and using
67/// assets from it.
68pub mod resources;
69
70mod engine;
71
72pub use engine::{Engine, EngineLimits};