Essentials
Engine-owned documentation. This page maps the low-level
Source/Essentials/layer: platform/compiler prerequisites, process-wide lifecycle helpers, logging, memory, strings, serialization, filesystem, sockets, and utility types used by every higher engine layer.
Purpose
Use this page when changing code that sits below Source/Common/ or when you need to know whether a utility belongs in the reusable engine foundation instead of client, server, tools, or game-specific code.
The essentials layer should stay dependency-light. It is included by most of the engine through Source/Essentials/Essentials.h, so changes here can affect every application target.
Source paths inspected
Source/Essentials/Essentials.hSource/Essentials/Essentials.cppSource/Essentials/BasicCore.hSource/Essentials/BasicCore.cppSource/Essentials/GlobalData.hSource/Essentials/GlobalData.cppSource/Essentials/StackTrace.hSource/Essentials/StackTrace.cppSource/Essentials/BaseLogging.hSource/Essentials/BaseLogging.cppSource/Essentials/Logging.hSource/Essentials/Logging.cppSource/Essentials/ExceptionHandling.hSource/Essentials/ExceptionHandling.cppSource/Essentials/MemorySystem.hSource/Essentials/MemorySystem.cppSource/Essentials/SmartPointers.hSource/Essentials/SmartPointers.cppSource/Essentials/Containers.hSource/Essentials/Containers.cppSource/Essentials/StringUtils.hSource/Essentials/StringUtils.cppSource/Essentials/SafeArithmetics.hSource/Essentials/SafeArithmetics.cppSource/Essentials/DataSerialization.hSource/Essentials/DataSerialization.cppSource/Essentials/HashedString.hSource/Essentials/HashedString.cppSource/Essentials/StrongType.hSource/Essentials/StrongType.cppSource/Essentials/TimeRelated.hSource/Essentials/TimeRelated.cppSource/Essentials/ExtendedTypes.hSource/Essentials/ExtendedTypes.cppSource/Essentials/Compressor.hSource/Essentials/Compressor.cppSource/Essentials/WorkThread.hSource/Essentials/WorkThread.cppSource/Essentials/DiskFileSystem.hSource/Essentials/DiskFileSystem.cppSource/Essentials/CommonHelpers.hSource/Essentials/CommonHelpers.cppSource/Essentials/NetSockets.hSource/Essentials/NetSockets.cppSource/Essentials/Platform.hSource/Essentials/Platform.cppBuildTools/cmake/stages/EngineSources.cmake- related tests under
Source/Tests/
Include and dependency model
Source/Essentials/Essentials.h is the umbrella include. Its include order is the dependency order for the foundation layer:
BasicCore.h— compiler/OS gates, standard library surface, namespace macros, base aliases, exception declaration helpers, and compile-time constants.GlobalData.h— process-wide create/delete callback registration for engine global data.StackTrace.h,BaseLogging.h,ExceptionHandling.h,Logging.h— diagnostic and failure-reporting foundation.SmartPointers.h,MemorySystem.h— pointer and allocation helpers.Containers.h,StringUtils.h,CommonHelpers.h— reusable container/string/utility helpers.SafeArithmetics.h,DataSerialization.h,HashedString.h,StrongType.h,TimeRelated.h,ExtendedTypes.h,Compressor.h— value, serialization, hashing, time, compression, and type helpers.WorkThread.h,DiskFileSystem.h,NetSockets.h,Platform.h— threading, disk access, socket, and host OS abstractions.
Keep new essentials APIs free of dependencies on Source/Common/, Source/Client/, Source/Server/, Source/Tools/, or embedding-project headers.
Subsystem map
Platform and compiler gate
BasicCore.h enforces the selected OS macro (FO_WINDOWS, FO_LINUX, FO_MAC, FO_ANDROID, FO_IOS, or FO_WEB) and requires C++20. It also binds frequently used standard types into the engine namespace and declares core macros such as FO_EXPORT_FUNC, FO_KEEP_DATA_SYMBOL, and namespace helpers.
Platform.h / .cpp owns host-specific helpers that are deliberately small: informational logging, thread names, executable path lookup, process id formatting, fork support where available, and dynamic module loading. Platform-specific application/window/rendering behavior lives under Source/Frontend/, not here.
Diagnostics and failure handling
BaseLogging.* and Logging.* provide the logging foundation. StackTrace.* captures and formats native/script stack information, while ExceptionHandling.* owns exception-reporting helpers. For debugger-facing workflows, use Debugging.md.
Memory, pointers, and lifetime utilities
MemorySystem.* owns backup-memory chunks, bad-allocation reporting, and SafeAllocator. SmartPointers.* contains pointer wrappers used to make ownership and raw-reference intent explicit. Use this layer for generic ownership utilities only; entity lifetime and holder semantics belong in EntityModel.md.
Serialization, values, strings, and hashes
DataSerialization.* contains binary read/write helpers used by network, persistence, resources, and tests. StringUtils.*, HashedString.*, StrongType.*, ExtendedTypes.*, SafeArithmetics.*, and TimeRelated.* provide the small reusable values that higher layers treat as primitives.
Filesystem, compression, sockets, and work threads
DiskFileSystem.* is the low-level disk abstraction. The higher-level mounted resource view is Source/Common/FileSystem.* and is documented in ConfigurationAndDataSources.md. Compressor.* owns generic compression round-trips, NetSockets.* owns raw socket helpers below the higher-level network command/connection model in Networking.md, and WorkThread.* owns simple background-worker infrastructure.
Build integration
BuildTools/cmake/stages/EngineSources.cmake lists essentials files in FO_ESSENTIALS_SOURCE. The essentials target is part of the core libraries used by applications, tools, tests, and generated-code consumers. If a new essentials file is added, wire it through this stage and add a focused test where possible.
Tests to inspect
The essentials layer has direct test coverage in:
Source/Tests/Test_BaseLogging.cppSource/Tests/Test_BasicCore.cppSource/Tests/Test_CommonHelpers.cppSource/Tests/Test_Compressor.cppSource/Tests/Test_Containers.cppSource/Tests/Test_DataSerialization.cppSource/Tests/Test_DiskFileSystem.cppSource/Tests/Test_ExceptionHandling.cppSource/Tests/Test_ExtendedTypes.cppSource/Tests/Test_GenericUtils.cppSource/Tests/Test_GlobalData.cppSource/Tests/Test_HashedString.cppSource/Tests/Test_Logging.cppSource/Tests/Test_MemorySystem.cppSource/Tests/Test_NetSockets.cppSource/Tests/Test_Platform.cppSource/Tests/Test_SafeArithmetics.cppSource/Tests/Test_SmartPointers.cppSource/Tests/Test_StackTrace.cppSource/Tests/Test_StringUtils.cppSource/Tests/Test_StrongType.cppSource/Tests/Test_TimeRelated.cppSource/Tests/Test_WorkThread.cpp
See Testing.md for the complete test-suite map and target wiring.
Change routing
- Compiler/OS gates, namespace, base aliases, and low-level macros:
Source/Essentials/BasicCore.*. - Global create/delete callback registration:
Source/Essentials/GlobalData.*. - Stack traces, logging, and exception reporting:
Source/Essentials/StackTrace.*,BaseLogging.*,Logging.*,ExceptionHandling.*, and Debugging.md. - Generic memory/pointer utilities:
Source/Essentials/MemorySystem.*andSmartPointers.*. - File bytes on disk:
Source/Essentials/DiskFileSystem.*; mounted engine resources: ConfigurationAndDataSources.md. - Socket primitives:
Source/Essentials/NetSockets.*; protocol/command/network runtime: Networking.md.
Validation checklist
- Confirm the change does not introduce a dependency from essentials back into higher engine layers.
- Update
BuildTools/cmake/stages/EngineSources.cmakewhen adding/removing essentials files. - Run the smallest matching essentials test and then the broader
RunUnitTeststarget when behavior crosses utility boundaries. - For diagnostics changes, also verify Debugging.md stays accurate.
- For filesystem/socket/threading changes, validate at least one higher-level consumer if the low-level contract changed.