top of page

C++ Game Engine

Time:      Aug 2024 - Now

Role:       Sole Developer

Engine:   Custom C++ engine

C++ Game Engine

Custom

Math

Key Features

  • DirectX 11\12 2D\3D rendering pipeline

  • Math Utilities and Math Utilities Tests\Simulator

  • Multithreaded Job System

  • Renderer, Input System, Event System, Devlopment Console, Audio System, Debug Render System, Net System

  • 2D Particle System

  • File I/O Utilities, XML Parser

Games\ Apps made by this engine:

Screenshot 2025-02-18 160635.png
Procedural World Generator
Screenshot 2025-02-24 112034.png
Simple Miner
Screenshot 2025-01-31 112435.png
Vaporum
Screenshot 2025-01-30 115851.png
Starship Ultimate

Math Utilities and Visualized Test

Math Utilities

​Math Utilities contains many math structs(Vector, Matrix, AABB, Euler Angles etc.) and stand-alone math functions which will be used by the engine code or the game code. These functions include:

  • Clamp and Interpolate

  • Easing functions and Curve class

  • Angles and Trigs

  • Dot Procuct and Cross Product

  • Distance and Projection

  • 2D\3D Geometric Query Utils (point inside, intersection\overlap, nearest point)

  • Transform Functions

  • Ray cast vs. 2D\3D primitives

Visualized Math Test

​To test my implemented math functions, I created a project called math visual test.

The tests are:

  • 3D primitives plane, AABB, OBB, cylinder, sphere (intersection\overlap, nearest point, ray cast).

  • 2D Physics bounce ball machine (fixed update)

  • Easing functions and curves

  • Ray vs. disc (Ray intersection with discs)

  • Ray vs. AABB (Ray intersection with 2D AABBs)

  • Ray vs. line segments (Ray intersection with 2D line segments)

3D Primitives Playground (Intersection\overlap\ray cast\nearest point)

Esaing Functions and Curves

Ray cast vs. AABBs

Physics Pachinko Machine

Ray cast vs. Discs

Ray cast vs. Line segments

Convex Scene Editor

This is another visualized test specifically for 2D convex polygons which inculdes:

  • Convex polygons and convex hulls

  • Draw 2D convex polygons

  • Ray vs. 2D convex polygons

  • Point inside 2D convex polygons

  • Translate, scale, rotate convex polygons around the mouse position

  • World partition algorithm (quad tree and AABB-tree(BVH)) implemented

  • Massive ray vs. 2D convex polygons test

  • Industry standard Save & Load System

Protogame 2D\3D\cmd

Foundational project templates for rapid game development

  • Available Variants

    • 2D Game Framework

    • 3D Game Framework

    • Command-line Game Framework

  • Core Features

    • Minimal implementation (no predefined gameplay logic)

    • Preconfigured build systems and engine integration

    • Perforce-based version-controlled template repository

  • Workflow Benefits

    • Accelerated project initialization through Perforce branching

    • Enables clean-slate development with essential subsystems preconfigured (such as Audio System and Net System will be disabled in protogame cmd initially but can be added back in code)

Renderer

The most frequent used rendering interface in my game and engine is directX 11. I also migrated my renderer to directX 12 and my dx12 renderer has some basic 2D\3D functionality. The graphics work I have done is listed as following:

  • Whole 2D\3D rendering pipeline wrapped with renderer class including texture, shader, constant buffer, vertex buffer, index buffer, etc.

  • Shadow map in the game doomenstein

  • .obj model loading system

  • Phong shader with diffuse map, normal map, specular map, gloss map, and emission map

  • Emissive rendering in my model loading test

  • Fog effect in simple miner

Shadow Map in Doomenstein

Screenshot 2025-02-24 111935.png

Loaded .obj files

Screenshot 2025-02-12 122535.png

Emissive Effect

Screenshot 2025-02-24 112034.png

Fog Effect in Simple Miner

Event System

Template based event system with member function support.

Template Based

The evnet system is using templates so that anyone can register member function as event callback function which is very useful for UI, AI and a lot of systems.

Screenshot 2025-03-05 102926.png

Event Subscription Code Structure Graph

Event Name-Function List

The only recognization of an event is its case-insensitive name, so that each event can have different subscribers and each subscriber can subscribe different events.

As shown below, the event Banana has two subscribers and the event Apple has two too. The evnet Orange has no subsriber.

Screenshot 2025-03-05 104019.png

Event and subscribers

Event Callback Order

Functions have order to be called and return value, and if the previous function returns true, then the event handle process is blocked and ended.

In the examples below:

  • Banana case1: Monkey::Eat() returns true, the event process is done.

  • Banana case2: Monkey::Eat() returns false, Dog::Eat() returns false, and there is no other subscribers, the event process is done.

  • Apple case: Dog::Eat() returns false, QuitGame() returns true, the event process is done.

  • Orange case: No one response, the event process is done.

Screenshot 2025-03-05 105010.png

Event Trigger Examples

Development Console

Features:

A in-game console which can execute development or game commands.

  • Event system based: easy to register commands

  • In game editing

  • Cooperate with network system

  • Can easily print out things

  • Can browse command history and execute history commands

Development console with local network

Multi-threaded Job System

Features:

​Worker-Job structure: workers claim jobs from a deque, jobs are added into the deque.

Worker and job type: workers will only claim jobs having the same type as the worker.

Inner implementation is hidden inside the job system code, and the users will only have contact with the job system instead of actual thread which makes the code more robust and makes the coding easier for people who do not know multi-threading.

Multi-threaded job system Visualization

© 2025 by Xuanchen Shen. Powered and secured by Wix

bottom of page