Night Engine
Opensource 3D Component-based Game Engine
Tool: C/C++, GLSL, Lua
Team Size: 1
My Role: Graphics Programmer
Development Time: 2 Months (July 2018 – Sep 2018)
Note: This project started as a short 2 months project that I occasionally come back and update things here and there (Lua support is later pulled out of the project)
Overview: A personal project, where I focused on creating a custom 3D game engine using C/C++, opengl, bullet, imgui (editor).
• Core system: reflection system, serialization, factory, component-based architecture, message system, archetype system, unit test, file system, resource manager.
• Graphic: PBR, IBL, HDR, Deferred rendering, shadow map, mesh loading, dir/spot/point light, normal map, postprocessing.
• Editor Tools: Component Inspector, Scene Hierarchy, Dev console, Material Editor, GBuffer Debugview, Archetype editor, and GameObject Browser
• Physics Engine: Bullet SDK integration, Colliders, Rigidbody, Collision detection API.
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 gamepad 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)
- Component-based architecture:
- Graphics: Opengl
- Minimal Opengl API Wrapper
- Runtime shader recompilation via console command
- Mesh loading
- GPU Instanced rendering
- Deferred rendering + HDR Linear lighting
- Directional Light, Spot Light, Point Light
- Normal Mapping + Alpha test shader
- Metallic Workflow PBR (Physically-Based Rendering)
- 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
- Based on Cook-Torrance BRDF with the following terms:
- Diffuse+Specular IBL (Image Based Lighting) for HDRI sky
- HDRI sky format to Cubemap conversion (irradiance + prefiltered environment map)
- Shadow Mapp + PCF Soft shadow
- Support both Directional Light and Point Light (Omnidirectional)
- Postprocessing: FXAA, SSAO, Filmic Tonemapping + Gamma Correction, Dithering, 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
- Box, Sphere, Capsule, Cylinder Collider
- 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: contain various useful commands for running unit test, logging, cpu profiling, physics debug draw, renderdoc capture, runtime shader compilation, etc
- Material Editor:
- Simple Material Editor window for editing material properties, custom shader can exposed some properties by inheriting from MaterialProperty struct
- Support editing all basic types + texture property
- Inspector:
GOAP AI Project
Goal Oriented Action Planning AI
Tool: Unity Engine (C#)
Team Size: 1
Development Time: 1 Week
Overview:
• GOAP AI Project is a research project for my game AI class, where I choose to explore the GOAP (Goal Oriented Action Planner) System for agents that allow them to plan the sequence of action based on its goal and the current state of the world.
• This means that even though many agents can have the same goal, they can choose to take different sequence of action that gives the AI a more dynamic feel.
• For this project, I wanted to simulate a simple 2d action shooter AI where both of the agent’s goal is simply attempting to kill each other and their goal changed in response to the current state of the world.
A* and Terrain Analysis
A* Pathfinding and Terrain Analysis Project
Tool: C++
Team Size: 1
My Role: AI Programmer
Development Time: 2 Week
Overview:
• A* Pathfinding and Terrain Analysis Project is a project for my game AI class, where I implemented A* pathfinding algorithm with several heuristic functions (Euclidean, Octile, Chebyshev, Manhattan), path post-process such as rubber banding and path smoothing with Catmull-Rom Spline.
• I also implemented several Terrain Analysis techniques including wall openness, rear cover, overall visibility, agent visibility, and search with decay.
• These Terrain Analysis techniques are shown on the influence map, which can be easily integrated into the game to provide more information to the Agents and create an illusion of intelligence.