编程与软件工程github.com
Craft:用 C 和 OpenGL 着色器写的极简 Minecraft 克隆
Craft: A simple Minecraft clone written in C using OpenGL shaders
2013 — 2018,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
Craft 是开发者 fogleman 用 C 语言和 OpenGL 着色器编写的简易 Minecraft 克隆,代码简洁、体量很小,是学习游戏开发和图形编程的经典示例项目。作者还曾用 Python 写过一个仅约 900 行代码的类似版本。
为什么经久不衰:它把一个看似庞大的游戏拆解成可读的少量 C 代码,多年后仍是学习 OpenGL 和游戏引擎原理的最佳入门项目之一。
HN 评论精选
指出作者还有更精简的 Python 版本,仅 894 行代码。
很酷。这是作者用 Python 写的 Minecraft 克隆:https://github.com/fogleman/Minecraft,Python 版本只用了 894 行代码。
DanielRibeiro查看英文原文
Cool. From the same author of Minecraft clone with Python: https://github.com/fogleman/Minecraft The python version uses only 894 lines of code: https://github.com/fogleman/Minecraft/blob/master/main.py
提醒代码缺少错误处理,属于演示性质而非生产质量。
不是想扫兴,但代码里似乎没什么错误检查、空指针检查等,比如 calloc() 和 fopen() 这类库调用好像永远不会失败。如果目标是“代码行数少”,省略这些可以理解。如果你的大脑会自动进入“代码审查”模式,建议别看源码 :)
ryandrake查看英文原文
Not to be a party pooper, but there doesn't seem to be much in the way of error checking, null pointer checking, etc. e.g. Apparently library calls like calloc() and fopen() never fail. I guess if your goal is "few lines of code" it's understandable to leave that stuff out. If your brain has the tendency to automatically go into "code review" mode, I recommend against browsing the source :)
称赞代码整洁,但遗憾完全没有注释。
看起来很棒,代码非常干净、结构清晰。不过源码里居然一行注释都没有,有点失望。希望作者能加上注释,因为他做的很多事情并不那么显而易见,至少对我来说不是。
Taylorious查看英文原文
This looks awesome. The code is very clean and well laid out. I am disappointed that there are literally no comments in the source code though. Hopefully he will add comments, because a lot of what he is doing is not super obvious, at least not to me.
推荐 Minetest 作为更偏游戏体验的替代品。
对于想要不那么偏教学、更好玩的朋友,我强烈推荐 Minetest,它在基础引擎之上提供了可编程层,可以制作类 Minecraft 的游戏模式。
Karrot_Kream查看英文原文
For folks who want something a bit less pedagogic and more fun to play as a game, I highly recommend Minetest [1] which gives you a programmable layer on top of the base Minetest engine to make Minecraft-like game modes. [1]: http://minetest.net/
历次讨论
同类还值得读
开源应用架构
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编辑精选