Skip to main content

Engine design document

This is a rough sketch of the final engine. Treat this as some type of "this is how a 1.0 will look".

Entries marked with βœ” are mostly or fully complete (are used widely throughout the engine and plugins), and πŸ›  means this area needs quite a bit of work before it's usable or it's simply not implemented.

Overall architecture​

  • Elegy.Common - utility library βœ”
  • Elegy.Framework - engine core, handles engine configuration etc. βœ”
  • Engine modules
  • Elegy.GameSDK - the game SDK πŸ› 
  • Elegy.ECS - reactive entity component system library πŸ› 
  • Elegy.Scripting - dynamic C# scripting library πŸ› 
  • Elegy.RenderBackend - Veldrid/Vulkan utilities βœ”

Engine modules​

  • Elegy.AssetSystem βœ”
    • Quake 3-style materials βœ”
    • Data-driven shaders βœ”
    • Model asset loading (plugin-based) βœ”
    • Texture asset loading (plugin-based) βœ”
    • Level loading (plugin-based) βœ”
  • Elegy.AudioSystem (plugin-based)
    • Sound sources, listener
    • Sound FX
    • Geometric acoustics
  • Elegy.ConsoleSystem πŸ› 
    • Logging βœ”
    • Console frontends βœ”
      • External developer console πŸ› 
    • CVars πŸ› 
    • Console commands βœ”
  • Elegy.FileSystem βœ”
    • Mounting game/mod paths βœ”
    • Mounting addon paths πŸ› 
  • Elegy.Input βœ”
    • Keyboard, mouse input βœ”
    • Gamepad & joysticks πŸ› 
  • Elegy.NetworkSystem
    • Utility layer on top of ENet or RiptideNetworking
  • Elegy.PlatformSystem βœ”
    • Windowing (injected) βœ”
    • Time πŸ› 
    • Fundamental engine configuration, e.g. headless mode βœ”
  • Elegy.PluginSystem βœ”+πŸ› 
    • Flexible plugin system βœ”
    • Plugin dependencies πŸ› 
    • Plugin reloading πŸ› 
    • Plugin versioning πŸ› 
  • Elegy.RenderSystem πŸ› 
    • Renderable objects (entities, batches, volumes, lights...) βœ”
    • Views & rendering into windows βœ”
    • Debug rendering πŸ› 
    • Render styles (plugin-based) βœ”+πŸ› 

Legend:

  • plugin-based: implemented in a plugin, engine just provides API
  • injected: implemented externally (e.g. in a launcher), engine just sees API

Elegy.GameSDK subsystems​

  • AI
    • Goal-oriented action planning
    • Use Recast/DotRecast
  • Animation
    • Animation playback and management
    • Animation blending
    • Animation channels
    • Inverse kinematics
  • Client πŸ› 
    • Client controllers (handle input and interaction with the game world) βœ”
    • Keybind system
    • View bobbing and viewport management
  • Entity system βœ”
    • Reactive ECS βœ”
    • Source-style IO βœ”
    • Scripting πŸ› 
  • Game sessions βœ”
    • Menu state, loading state, playing state, paused state etc. βœ”
    • Linking a client into the game βœ”
  • Gamemodes
    • Campaign, deathmatch, team deathmatch, co-op etc.
  • Netcode πŸ› 
    • Mainly intended for LAN co-op
    • Quake-style client-server with prediction and rollback πŸ› 
    • Singleplayer bridge βœ”
  • Particles
  • Physics
    • Rigid bodies
    • Constraints
  • Save-load system
  • UI
    • ImGui for quick'n'easy stuff
    • Custom game UI system for everything else

Optional modules:

  • Vehicle system
  • Vegetation system
  • Virtual reality through OpenXR

Workflow and features​

Overall:​

  • Quake-style workflow.
  • There’s an engine executable in the root folder, accompanied by game folders and a base folder.
  • The base folder contains base engine assets, e.g. a β€œmissing model” model, a β€œmissing texture” texture and whatnot.
  • Each game/mod folder contains a configuration file that describes it as well as its plugins and dependencies.

Mapping:​

  • You’d use an external level editor like TrenchBroom, J.A.C.K. or NetRadiant-custom.
  • You’d also use a map compiler, either as part of your level editor’s compile config, or through a console command.

Modelling:​

  • You’d use a model editor like Blender.
  • Export GLTF for basic props, import via custom tool for extra attributes for complex models.

Texturing, sound design and other trivial asset types:​

  • Quite simply place your PNGs/WAVs/FLACs into a textures/sounds folder, it’s just there.

UI:​

  • Declarative C# UI files sitting in a directory.

Scripting:​

  • Naked C# scripts, S&box-style.
  • Level scripts
  • UI scripts
  • NPC scripts?
  • Weapon scripts?
  • Vehicle scripts?