Files
XCEngine/参考/Fermion/README.md

7.4 KiB
Raw Permalink Blame History

Fermion

English | 中文

中文

Fermion 是一款基于 C++20 构建的高性能、AI 辅助编程实现的游戏引擎。
引擎采用 Render Graph 架构。对底层 API 进行了抽象封装,在实现 OpenGL 渲染的同时,具备支持多后端渲染的扩展能力。核心采用 Forward+ 渲染管线,并集成 EnTT 深度支持 ECS 架构。此外,引擎内置了完整的 C# 脚本系统,以及由 Box2D 与 Jolt Physics 驱动的 2D/3D 物理模拟方案。

命名哲学

  • Fermion费米子:对应引擎核心。费米子是构成物质的基本粒子,象征核心运行时负责承载游戏世界中的一切对象与逻辑。
  • Boson玻色子:对应编辑器。玻色子是传递费米子之间的相互作用的媒介粒子,象征编辑器作为开发者与引擎之间的“交互媒介”,用于搭建场景、调整参数、驱动物体。
  • Photon光子: 对应脚本系统。光子是一种玻色子标志着Photon是编辑器的一部分。并且光子轻、快象征着脚本的轻、快。
  • Neutrino中微子:对应引擎的运行时(Runtime)。中微子是一种费米子,标志着运行时是引擎的一部分。并且中微子几乎不与物质相互作用,就像运行时不直接被玩家看见负责维持内部机制正常运转。

演示

sponza snake material 2d 3d

构建说明

环境要求

  • CMake ≥ 3.16
  • 支持 C++20 的编译器
  • Windows/Linux 已经通过编译
  • Windows/Linux 需要手动安装 Mono

获取源码

git clone https://github.com/Yang-Junjie/Fermion.git
cd Fermion
git submodule update --init --recursive

配置与编译

mkdir build
cd build
cmake .. 
cmake --build . --config Release
cd ../bin
../Photon/csbuild.bat
../Boson/projects/Assets/scripts/csbuild.bat

第三方依赖

项目依赖的库均以源码形式引入,便于跨平台编译与调试:

  • spdlog 高性能日志库
  • entt 实体组件系统ECS
  • glm 数学库(向量、矩阵、变换)
  • Dear ImGui 即时模式图形界面
  • ImGuizmo 编辑器中的变换 Gizmo
  • GLFW 跨平台窗口与输入管理
  • GLAD OpenGL 函数加载器
  • stb 使用进行纹理加载和保存
  • yaml-cpp YAML 序列化(场景保存/加载)
  • box2d 2D 刚体物理引擎
  • msdf-atlas-gen - MSDF 纹理生成
  • freetype - FreeType 字体库
  • Mono - 跨平台 .NET 运行时,用于在引擎中运行 C# 脚本。
  • Assimp - 3D 模型加载
  • JoltPhysics - 3D物理引擎
  • ImguiNodeEditor - 节点编辑器
  • ImViewGuizmo - View Gizmo

参考

  • Hazel 跟着这个教程走的,后期自己进行扩展

许可证

本项目基于 MIT License 开源,详情请见 LICENSE 文件。


English

Fermion is a high-performance game engine built with C++20 and AI-assisted programming. The engine features a Render Graph architecture with abstracted low-level API encapsulation, currently implementing OpenGL rendering while maintaining extensibility for multi-backend support. It utilizes a Forward+ rendering pipeline and deeply integrates EnTT for ECS architecture. Additionally, the engine includes a complete C# scripting system and 2D/3D physics simulation powered by Box2D and Jolt Physics.

Naming Philosophy

  • Fermion: Represents the engine core. Fermions are fundamental particles that constitute matter, symbolizing the core runtime responsible for hosting all objects and logic in the game world.
  • Boson: Represents the editor. Bosons are mediator particles that transmit interactions between fermions, symbolizing the editor as an "interaction medium" between developers and the engine, used for building scenes, adjusting parameters, and driving objects.
  • Photon: Represents the scripting system. Photons are a type of boson, indicating that Photon is part of the editor. The lightness and speed of photons symbolize the lightweight and fast nature of scripts.
  • Neutrino: Represents the engine's runtime. Neutrinos are a type of fermion, indicating that the runtime is part of the engine. Neutrinos barely interact with matter, just as the runtime is not directly visible to players but maintains the internal mechanisms.

Showcase

sponza snake material 2d 3d

Build Instructions

Requirements

  • CMake ≥ 3.16
  • C++20 compatible compiler
  • Tested on Windows/Linux
  • Windows/Linux require manual installation of Mono

Clone Repository

git clone https://github.com/Yang-Junjie/Fermion.git
cd Fermion
git submodule update --init --recursive

Configure and Build

mkdir build
cd build
cmake ..
cmake --build . --config Release
cd ../bin
../Photon/csbuild.bat
../Boson/projects/Assets/scripts/csbuild.bat

Third-Party Dependencies

All dependencies are included as source code for cross-platform compilation and debugging:

  • spdlog High-performance logging library
  • entt Entity Component System (ECS)
  • glm Mathematics library (vectors, matrices, transformations)
  • Dear ImGui Immediate mode GUI
  • ImGuizmo Transform gizmo for editor
  • GLFW Cross-platform window and input management
  • GLAD OpenGL function loader
  • stb Texture loading and saving
  • yaml-cpp YAML serialization (scene save/load)
  • box2d 2D rigid body physics engine
  • msdf-atlas-gen MSDF texture generation
  • freetype FreeType font library
  • Mono Cross-platform .NET runtime for C# scripting in the engine
  • Assimp 3D model loading
  • JoltPhysics 3D physics engine
  • ImguiNodeEditor Node editor
  • ImViewGuizmo View gizmo

References

  • Hazel Initial learning resource, later extended with custom features

License

This project is open-sourced under the MIT License. See the LICENSE file for details.