How infinideastudio/neworld works
Project Type and Purpose
• NEWorld is a 3D sandbox game inspired by Minecraft. Its purpose is to provide a highly optimized, cross-platform game built with a custom C++ engine.
• The README and file structure indicate the game incorporates several components: rendering (using OpenGL), audio, a custom GUI (integrating Noesis GUI), physics/collision (likely handled via BVH structures), and world/universe simulation.
File Structure
• Assets Folder: This directory holds all visual and audio resources – textures, shaders, fonts, and GUIs. It’s key to distinguish that there is a clear separation between GUI assets (e.g., InGame.xaml, MainMenu.xaml and related theme files) and game assets (textures for blocks, items, players).
• NEWorld.Base: Contains core common libraries, including console logging, math (e.g., Vector2, Vector3, Vector4), and system modules such as file management and the message bus. This is your foundational layer.
• NEWorld.Game: Houses most of the game’s logic including the Audio system, GUI management, rendering (both OpenGL specific code and world/renderer modules), and game settings. This directory is the heart of the application.
• NEWorld.Game/Universe: Focuses on the simulation aspect – entity management, world data (chunk management, terrain generation using noise algorithms), and BVHs (bounding volume hierarchies) for spatial queries.
• External Libraries: The External directory contains libraries like bvh, stb, and tsl, which provide essential utilities (such as spatial hierarchy building, advanced hashing, and texture packing support), indicating that many performance-critical parts have been re-invented or custom built.
• NoesisGUI: This integration directory shows that Noesis GUI is used for the user interface. It includes CMake support and helper scripts.
• CMakeLists.txt and related configuration files help in building the game across platforms.
Guiding Architecture
a. Main Components:
• Rendering Subsystem: Include detailed nodes for Shader Management (shader files in Assets/Shaders), Renderer core (NEWorld.Game/Renderer) with subdivisions for GL-specific operations and World rendering (ChunkRenderer, ShadowMaps, etc.).
• Audio System: Represent the Audio module (NEWorld.Game/Audio and AudioSystem files) responsible for sound processing.
• Game Logic and Universe: This component covers simulation aspects like Entities, World (universe and chunk management), Terrain Generation, and the dispatch mechanism for game events.
• GUI Layer: Separate the GUI into two parts – one from the NEWorld.Game/GUI directory for in-game menus and inventory, and another for the Noesis GUI integration (linked to the NoesisGUI directory and XAML files under Assets/GUI).
• Core Base: Represent NEWorld.Base as the core utilities that underpin logging, math, file system, and the messaging bus which supports inter-component communication.
• External Libraries: Illustrate external dependencies (BVH algorithms, stb, and tsl) that assist in optimized performance.
• Assets Repository: Illustrate the Asset management’s role (textures, fonts, shaders) and its directional connection to both the renderer and GUI components.
b. Relationships and Interactions:
• From Assets → Renderer: Assets like shaders and textures feed into the rendering pipeline.
• From Core Base (e.g., MessageBus) → Game Logic and Universe: The messaging system propagates game events and commands.
• Between GUI components and Game Logic: User input via GUI overlays influences game state.
• External libraries impact multiple layers: For instance, BVH support improves simulation performance in the Universe subsystem.
• Dependency between the custom engine layers (NEWorld.Base, NEWorld.Game, and Universe) and the third-party systems like Noesis GUI and OpenGL.
c. Important Architectural Patterns:
• Modularity: The division into Base, Game, and Universe suggests a layered architecture where low-level utilities are separated from high-level game logic.
• Separation of Concerns: Distinct folders for renderer, audio, GUI, and world simulation imply a clean separation between presentation, engine, and simulation layers.
• Performance Optimizations: The sophisticated use of BVH (in External/bvh) and custom algorithms indicates a performance-centric design.
d. Technologies and Frameworks:
• C++20 is used throughout, with modern language features.
• OpenGL 4.5 along with glew and glfw for graphics.
• OpenAL (via openal-soft) for audio.
• LevelDB (mentioned in README) might be used for some persistent data management.
• Noesis GUI for the user interface.
• External libraries for BVH, texture packing, and high performance data structures.