project-hedra README

项目的 README,来自 github.com/maxilevi/project-hedra。合并为一个 markdown 文件:README.md。

Project Hedra

All code at the pre-ai tag and in its earlier history was written before AI-assisted development.

Project Hedra is an ambitious open-world, low-poly RPG. Choose your class, explore endless procedurally generated worlds, unlock different skills and complete procedurally generated quests.

More screenshots at (Screenshots)

Timeline/Context

I started this project when I was in highschool (around 15 yo) in order to learn how OpenGL worked.

The scope creep quickly arrived and after a few years it turned into a fullfledged 3D game and game engine. The codebase has around 100k LOC and the game has first class support for Linux and Windows.

Features

The million lines of code are not in vain. The game and engine are both full of features :)

Game Features

Engine Features

Interesting bits

Interesting facts

Screenshots

image image image image

TODO add more

Code Structure

Overall Architecture

The game is a mod to a base engine. The idea of architecturing this way was to force myself to maintain the mod API up to date, therefore encouraging access to make mods.

Hedra

Basically the entire game. This includes AI logic, components, world generation, module systems, object placement and lots of other stuff.

Hedra.Engine

The core parts of the engine, this defines all the abstractions to the world. It handles rendering, sound, different base systems as well as the general windowing, game loop and platform features. The split was not done at the start so some stuff might still be outside.

Framework

Core primitives used in the engine. This includes heap and stack allocators, custom implementations of lists and arrays as well as wrappers to pointers to native and some other useful primitives

HedraTests

Test suite that

Asset Builder

Command line tool to compress the game assets into convenient binary files. Combines images, models, sound files, shaders into a single binary file with a structure designed for fast data retrieval.

Server

Once upong a time Hedra used to support multiplayer. It worked by doing UDP Hole Punching and having clients communicate P2P, this server was in charge of that. You might also see some networking remnants in the Engine code.

How to build

The build process is pretty straightforward.

  1. Checkout all the submodules
  2. Run the build depedencies scripts
  3. Compile the C# solution

You can check the GitHub actions workflows for some examples on Linux and Windows.

project-hedra (maxilevi/project-hedra)

正在搜索数据库…

这是什么?Project Hedra 是一款 3D 开放世界低多边形动作 RPG 游戏,同时也是为它打造的自研游戏引擎。作者从高中时期开始从零编写,包含程序化生成的世界、任务、职业、技能以及完整的体素渲染器。整个代码库约 10 万行 C# 代码。
它只是一款可以玩的游戏,还是也能当作可复用的游戏引擎?它的架构是:游戏本身实际上是运行在独立基础引擎('Hedra.Engine')之上的一个模组,因此引擎代码(渲染、声音、窗口)与游戏专属代码(AI、世界生成、物品)是分开的。不过,这个引擎是专为本游戏打造的,并没有作为独立 SDK 发布。
我该怎么构建和运行它?没有安装程序,也没有二进制发行版,需要从源码构建:检出所有 git 子模块,运行构建依赖脚本,然后编译 C# 解决方案。GitHub Actions 工作流展示了 Linux 和 Windows 下可用的构建步骤。
编译它需要先安装什么?你需要 .NET/C# 工具链来编译解决方案,还需要项目的 git 子模块(其中包括它的 Bullet Physics 集成),以及构建依赖脚本所拉取的各类第三方库。
在尝试之前有什么需要注意的吗?没有现成的发行版,因此你必须通过子模块和脚本自行构建。多人联机功能(基于 UDP 打洞的 P2P)曾经存在,但似乎已被移除,引擎中只留下了一些网络相关的残留代码;另外,截图部分被标记为 TODO。
它能在 Windows 和 Linux 上运行吗?可以,该游戏对 Linux 和 Windows 都提供完整支持;文中没有提到 macOS。
为什么项目叫 'Hedra'?这个名字来自 'tetrahedra'(四面体),即作者在转向 Marching Cubes 之前,所实现的原始等值面提取算法(Marching Tetrahedra)中使用的形状。
如果没有世界存档文件,游戏是怎么记住世界的?世界在运行时完全由种子程序化生成;保存的只有玩家数据和该种子,地形本身并不保存,因此每次都会以确定性的方式重建整张地图。
代码里最酷的技术细节是什么?WorldRenderer.cs 使用 glMultiDrawElements,只需大约 3 次绘制调用(水体、地形、实例化对象)就能渲染整个体素世界;体素区块还会在运行时通过 Marching Cubes 算法转换为平滑的表面。
我能为游戏编写模组吗?可以。引擎提供了模块系统和模组支持,模组可以用 Python 编写脚本,并通过 IronPython 直接调用 C# API,随附的 Fishing.py 脚本就是例子。
作者
maxilevi
大小
112.5 MB
星标
197
更新
提交Oct 22
时长
7年
提交 · 90 天