返回资讯中心
外部精选
软件工程
#社区热议

Hedra is a 3D open world game I wrote from scratch while in highschool

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.

Hacker Newsmaxilevi2026/10/22 · 4 天前13 分钟阅读

以下正文同步自 Hacker News,版权归原站所有,已转换为易读排版。

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.

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.

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

Beatiful procedurally generated worlds

Quests and bosses

100+ items with rarities system

Skills and skill tree system with N+ skills

4 different classes with 2 specializations each ()

Procedurally placed structures generated dynamically

Fishing, crafting, etc

Trading and NPCs

Companions and pets

Beatiful soundtrack

Navigation, maps

Different dimensions

More stuff I don't recall :)

Engine Features

Fully fledged renderer using modern OpenGL

Skinned mesh rendering

Support for loading and playing generic animations

Collada (.dae) parser

Static mesh rendering

Screen space reflections

Screen space ambient occlusion

Bloom, FXAA & MSAA

Modding support

CI for automatically deploying to a Steam beta branch

Localization support

Sound support using OpenAL

Python scripting support

Module system for loading data oriented objects

Steam integration

Fully fledged UI & controls system (dropdowns, buttons, etc.) written from raw OpenGL

Dynamic shader system for reloading during runtime

Frustum culling, occlusion culling,

Mesh simplification for runtime level of detail (LOD)

Skybox support

Shadows

3D trails renderering support

Particle system using object instancing in opengl

bulletphysics integration

Chunk system for infinite worlds support

.ply parsing support

Dynamic meshing support using MarchingCubes

Custom implementation of basic C# primitives and allocators (like Lists) for supporting stack allocated lists and minimizing the automatic runtime allocations (and thus the GC).

1000+ plus test cases

Framework for mocking game components and doing integration testing on games

Image and asset compression for faster loading and smaller size

Entity component system

More stuff I don't recall :)

Interesting bits

WorldRenderer.cs. Renders the entire world in just 3 (actually it depends on how partitioned is the data buffer, but it was designed to be in 3) draw calls (water, terrain, instanced) using glMultiDrawElements.

Fishing.py. Written in Python as a mod script using IronPython, directly interacts with the C# API.

NativeArray.cs Implementation of an array primitive using a custom allocator. The same project provides heap based allocators as well as stac based ones using stackalloc. The idea was to minimize the automatic heap allocations (and thus avoiding the GC) during the game frames.

The world is fully procedurally generated, there is no world save file. Only the player contents are saved and the world seed. The rest is created at runtime.

The world is voxel based but an isosurface extraction algorithm called Marching Cubes is applied to extract an implicit continous surface from the discrete voxels.

The name "Hedra" comes from tetrahedra which is the shape used in the original iso surface extraction algorithm I implemented Marching Tetrahedra

The game only supports loading .PLY and .DAE models, both which are in plaintext and the models have no textures. Therefore if you put this into perspective, this means I wrote a bunch of text that reads text and creates interactive images from this. I think this is pretty cool.

Screenshots

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.

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

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.

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

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.

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.

The build process is pretty straightforward.

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

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →