Night Engine

Night Engine

Opensource 3D Component-based Game Engine

Tool: C/C++, glsl, Lua

Team Size: 1

My Role: Engine/Graphic Programmer

Development Time: 2 Months

My Contribution:

  • Designed and implemented the overall engine’s architecture, and graphics interfaces

  • Implemented core features such as reflection system, automate serialization, factory, component-based architecture, message system, archetype system, unit test.

  • Built an editor features including gameobject/component inspector, scene hierarchy, archetype editor, dev console.

  • Implemented graphic features such as Deferred rendering, PBR, IBL, instanced rendering, shadow mapping, point/directional/spot light.

  • Created postprocess shaders including bloom, SSAO, tone mapping/gamma correction.

  • Bullet Physics SDK integration


About The Project

  • This project is a 3D open-source 3D component-based game engine, where I mainly focused on creating my own game engine from scratch (several libraries used).

  • The engine are kind of a work in progress, only some of the Core/Graphic part are currently presentable.

  • My motivation for this project is purely out of curiosity and desire to learn more about modern graphic programming techniques and how they are implemented from scratch.

  • The repository of the project is available here.

Current Features

  • Core Engine:

    • Component-based architecture:

      • GameObject contain handles to its components

      • Components allocated contiguously in the memory for each ComponentType

        • Update Loop would be per ComponentType, traversing contiguous memory in an array

      • Factory: All purpose Factory for Object creation

        • Use custom Slotmap Data structure (Handle with direct index lookup)

    • Archetype System:

      • Similar to Unity's prefab and Unreal's blueprint

    • Logging System:

      • Log to file, dev console, and console

    • Input System:

      • Simple Input API with Keyboard, Mouse, and Joystick support

    • Message System: For communication between/among sub-system and GameObject

      • Subscribe, Unsubscribe, SendMessage, Broadcast

    • Reflection System:

      • Macros + Template based

      • Run-time information about the object including name, size, members, base class

        • Useful for serialization, editor field, member traversal, GetComponent by type, etc

    • Automate Serialization:

      • All reflected members can be serialized automatically

      • Can define a custom serialize function for any specific purpose

    • File System:

      • Create, Save, Load Files

      • Useful functions for accessing relative Assets Folder

    • Resource Manager:

      • Loaded resource can be cached, so multiple Gameobject can reference the same texture, models, material, and shader (Flyweight Pattern Style)


  • Graphics: Opengl

    • Opengl Primitive Wrapper:

      • VAO, VBO, EBO, Texture, Shader, Cubemap, UOB, FBO

    • Mesh loading

    • Forward/Deferred rendering

    • Directional Light, Spot Light, Point Light

    • Normal Mapping

    • HDR Rendering

    • Metallic Workflow PBR (Physically-Based Rendering)

    • BRDF Lighting model (Bidirectional Reflectance Distribution Function)

      • Based on Cook-Torrance BRDF with the following terms:

        • Distribution function (D): Trowbridge-Reitz GGX

        • Fresnel equation (F): Fresnel-Schlick Approximation

        • Geometry function (G): Smith's Schlick-GGX

    • Diffuse+Specular IBL (Image Based Lighting)

      • HDR file format to Cubemap conversion

      • Irradiance environment map

      • Prefiltered environment map

      • Environment BRDF LUT

    • Shadow Mapping + PCF (Percentage-closer filtering)

      • Support both Directional Light and Point Light

    • GPU Instanced rendering

    • Postprocessing:

      • FXAA

      • SSAO

      • HDR Tonemapping + Gamma Correction

      • Bloom


  • Physics Engine: Bullet Physics SDK integration

    • Box, Sphere, Capsule, Cylinder Collider

      • Collider Debug Drawer (using opengl)

    • Collision Detection and Resolution

    • Rigidbody Component:
      • Static, dynamic, and kinematic modes
      • Collision Checking Interface


  • Editor:

    • Inspector:

      • Show all the current selected gameobject's components along with its value and editable fields

      • Add/Remove Component, Save Blueprint/Archetype

    • Hierarchy:

      • Show all the gameobject in the scene

      • Search Filter

      • Selected gameobject will appear on inspector

    • Archetype Editor:

      • Search Filter

      • Show all the list of Archetypes along with its component information

      • Add, Rename, Remove an Archetype

    • GameObject Browser:

      • Show all Gameobjects in every active scenes with components information and editable fields

      • Search Filter

      • Create, Remove, Rename Gameobject in the scene

    • Dev console:

      • Show all the Log, Warning, Error

      • Run Unittest

      • Execute any Lua code at run-time

        • Useful for gameplay/graphic debugging

©2017 by Rittikorn Tangtrongchit.