编程与软件工程github.com
我用 C 写了自己的 RTS 游戏引擎
Show HN: I wrote my own RTS game engine in C
2018 — 2021,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
Permafrost Engine 是一位开发者用纯 C 语言从零编写的开源实时战略(RTS)游戏引擎,目标是支持《帝国时代》《命令与征服》《魔兽争霸 3》这类风格的游戏。项目代码质量高,曾于 2018 年和 2021 年两次登上 Hacker News 首页。
为什么经久不衰:它证明了 C 语言在现代依然可以写出结构清晰、可维护的大型项目,对游戏引擎开发者和 C 语言爱好者都是难得的学习范本。
HN 评论精选
代码质量出色,证明 C 在高手手中依然完全可用
代码质量非常高。C 常受批评,而这个代码库用清晰易懂的变通方案弥补了 C 缺少的一些现代特性,比如用前缀模拟命名空间就很好用。当然 C 也确实该受些批评,比如同样的宏在几处重复定义。总之这是一个写得非常漂亮的项目,说明 C 在合适的人手里完全可行。
CraigJPerry查看英文原文
Very nice code quality. C gets a hard time and this code base highlights some of the modern features C is missing by its use of perfectly clear workarounds. E.g. The prefix “namespacing” done here works just fine, easy to understand. The go-style visibility approach is growing on me lately and it works well here. C does deserve some of the criticism right enough, e.g. the same macros re-defined in a few places - it’d be nice if c had a better way than its version of macros although its not actually a problem here because the macros aren’t really big enough to have subtle sharp edges. Ahh a beautifully written project, just shows that maybe C is entirely workable in the right hands.
引擎目标是复刻经典 RTS(帝国时代、红警、魔兽 3)的能力
这看起来是一个 copyleft 项目,试图打造一个既能做《帝国时代》(尤其是 3D 版)、《命令与征服》,又能做《魔兽争霸 3》风格游戏的引擎。很期待它能否通过导入脚本支持运行魔兽 3 的自定义地图。
SolarNet查看英文原文
This appears to be a copy left attempt to build an engine capable of both Age of Empires (especially the 3d ones), Command & Conquer, and Warcraft 3 style games. Interested to see if it ever gets tot he point of running Warcraft 3 custom maps (multiplayer maps with custom code) perhaps through an import script.
建议引擎支持无头运行,把模拟与渲染解耦
看起来很酷,我读了一点代码,是近十年来有理性的人写出的好 C 代码。一个建议:nav.c 依赖 render.h——作为 AI 研究者,我希望更多游戏/模拟器能在不依赖屏幕渲染和真实键鼠输入的情况下运行核心模拟,如果引擎能支持无头(headless)运行就更好了。
blt查看英文原文
This looks cool, I read a little of the code and it seems like good C code written by a sensible person in the current decade. One suggestion: I noticed your nav.c depends on render.h - selfishly, as an AI researcher, I want more games/simulations where it's possible to run the core simulation without expecting to render to a screen or to read input from the real keyboard/mouse. So, if you can structure the engine such that it can run "headless" like this, that would be nice :)
开源 RTS 引擎稀缺,现有选项各有短板
我喜欢这类引擎 :) 还有别的吗?这个不支持 OSX 也没有多人模式。我已经试过 OpenRA 的引擎(慢)和 SpringRTS(OSX 支持差)。
tobyhinloopen查看英文原文
I'd love engines like this :) Are there more? This one doesn't run on OSX & has no multiplayer. I already tried OpenRA's engine (slow) and SpringRTS (poor OSX support)
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选