HackerURLs

一次又一次被重新发现的经典。

同一个链接,相隔一年以上,一次又一次被人重新发现、再次冲上 Hacker News 首页。能经受住这种时间检验的,大多是值得一读再读的文章。每篇附中文标题,讨论最热的那些再加上中文导读和高赞评论翻译。

从名人堂开始
  • 4,700+篇经过时间检验的经典

Hall of fame

名人堂

在经典库里看全部精选

上首页次数最多、而且有中文导读的 30 篇。时间轴上每个黑点是一次上首页,空心点是一次没冲上去的投稿。

  1. 正在载入经典…

Archive

经典库

按第一次上首页的年份分布,点柱子筛选。

排序

    About

    这些经典是怎么挑出来的

    1. 01

      合并同一个链接

      读取 Hacker News 自 2006 年以来的全部链接投稿,把 http/https、www、跟踪参数等写法不同的同一篇文章合并成一条。

    2. 02

      只留经得起时间的

      同一链接至少两次拿到 50 分以上(约等于上首页),而且两次相隔一年以上;再由 AI 剔除状态页、产品首页和新闻事件。

    3. 03

      写导读、译评论

      上首页次数最多的 2,000 篇配上中文导读、"为什么经久不衰",并精选翻译 HN 高赞评论。导读由 AI 生成,可能有误。

    算法与计算机科学redblobgames.com编辑精选

    游戏中的六边形网格

    Hexagonal grids for games

    5次上首页
    7年跨度
    2,103累计得分
    246条评论

    2013 — 2020,它一次次回到首页

    黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。

    导读

    Red Blob Games 的六边形网格教程,系统讲解游戏中六边形网格的坐标系(轴向、立方坐标等)、邻居计算、与像素坐标互转、视野与寻路等常见问题。页面以大量可交互的 Canvas 插图演示,是游戏开发领域公认的权威参考。

    为什么经久不衰:它把六边形网格中所有容易踩坑的数学问题一次讲透,交互式示例直观易懂,多年来被反复推荐,至今仍是该主题的首选资料。

    关键词 游戏开发六边形网格坐标系统交互式教程

    HN 评论精选

    六边形网格在 MMO 服务器负载均衡上比方形网格更有优势

    六边形网格的一个用例是持久化 MMO:把世界划分成六边形网格可以在多台服务器间做负载均衡。这比方形网格更有优势,因为方形网格的一个角要与另外 3 个方块共享,而六边形只与 2 个共享,玩家跨世界移动时移交服务器的开销更小。

    sillysaurus查看英文原文

    One use case for a hex grid is for a persistent MMO. Dividing the world up into a hex grid allows you to load-balance the world across different servers. This is more advantageous than a square grid because square grids share a corner with 3 other squares, whereas hex grids share only 2. That means it's less costly to hand off a player to different servers as they're running across the world.

    实战经验:只用到文中少数几个算法,且绘制时要注意抗锯齿问题

    这是个绝佳的资源,已收藏。我最近用 canvas 实现了棋盘游戏 Hex,其实只用到“邻居”“六边形转像素”“像素转六边形”这几部分。Hex 用的是菱形网格,文章居然没提到这种可能,它的坐标系更简单,就是行列而已,求邻居也不难。另外我发现绘制棋盘出乎意料地棘手:第一版直接对每个格子调用画六边形函数,结果因锯齿伪影看起来很糟,有些线重复、格子大小不一。最后我预先算好垂直边长度和对角边的 dx、dy 的整数值,反复用这些整数来绘制。

    graue查看英文原文

    This is an amazing resource. Bookmarked. I recently implemented the board game Hex[1] using canvas. I didn't need most of this stuff... really only "neighbors", "hex to pixel" and "pixel to hex". Hex uses a rhombus grid, a possibility surprisingly not mentioned in this article, which makes choosing a coordinate system easier. It's simply row and column, and finding a cell's neighbors is simple, if slightly counterintuitive. From my code: (let [possible-neighbors [[ col (dec row)] ; Upper left [(inc col) (dec row)] ; Upper right [(dec col) row ] ; Left [(inc col) row ] ; Right [(dec col) (inc row)] ; Lower left [ col (inc row)]]] ; Lower right ...) I found drawing the board unexpectedly tricky. In my first iteration I simply wrote a "draw hexagon" function that plugged in all the mathematical values, then called this function for each cell. The result looked terrible due to aliasing artifacts. Some lines were doubled and not all cells appeared the same size. In the end I precomputed integer values for the length of the vertical sides and the dy and dx for the diagonal sides, then used these integer values repeatedly to draw the board. For converting pixel coordinates to hexes I used a different method[2]. If the pixel is inside the interior rectangle of a hex (the part of the hex with top and bottom removed), we know it's in that hex. Otherwise it's in the top or bottom of a hex, and I use the direct algebraic formula (y=mx+b style) for the hex tops' diagonal lines to find out if the point is above or below that line. Maybe these approaches of mine would be helpful for someone whose needs are more basic, as they rely on less cleverness than the techniques in this article. [1] http://toxicsli.me/hex/ [2] https://github.com/graue/cljs-hex/blob/master/src-cljs/locate-cell.cljs

    六边形网格看似简单实则容易踩坑,应先查资料再动手

    这些内容全凭自己摸索很难做对。去年 Ludum Dare 上我尝试用 websocket 在六边形网格上做多人格斗游戏,第一天全耗在让六边形网格上的移动生效,第二天耗在多人代码上,48 小时结束时游戏技术上能跑,但完全没有美术,也一点都不好玩。当然如果我早点去找六边形游戏的资料就会看到这类文章,但不知为何我没想到它会难,因为看起来只是些简单的三角函数。

    tinco查看英文原文

    This stuff is pretty hard to get right when doing it all by heart. Last year I tried to make a multiplayer fighter on a hexagonal grid using websockets for a Ludum Dare, but I wasted the first day on making moving around on the hexagonal grid work, and the second on making the multiplayer code work, so at the end of the 48 hours the game was working technically, but I had no art whatsoever, and it wasn't fun at all :P Ofcourse if I had taken the time to look for resources on building hexagonal game I would have found a lot of things like this article (though probably not as concisely summarised as in this one), but for some reason it didn't occur to me that it could actually be hard, since it seems like it's just some simple trigonometry. Others said it was a fools errand to make a multiplayer game for a Ludum Dare (48 hour game compo), but actually if I hadn't been so stubborn with the hexagons I think I would have had enough time to build a pretty cool game.

    该资源在核反应堆模拟等专业领域同样实用

    真不错。我的工作是模拟采用六边形燃料组件的先进核反应堆,我的代码里用过不少这里的内容。这是个优秀的资源,我会推荐给那些来自传统方形栅格世界的同行。

    acidburnNSA查看英文原文

    That's neat. I spend my work days simulating advanced nuclear reactors that have hexagonal fuel assemblies. In my codes I've used a lot of this info. This is an excellent resource that I'll be referring people who come from the more traditional square lattice world.

    历次讨论

    同类还值得读

    1. 位运算技巧集

      Bit Twiddling Hacks

      斯坦福页面上的经典位运算技巧合集,收录了 popcount、前导/尾随零、位反转、交换、舍入等大量技巧,并附有解释和性能讨论。

      算法与计算机科学上首页 8 次 · 2011–2024graphics.stanford.edu编辑精选
    2. 如何不按平均评分排序

      How Not To Sort By Average Rating

      经典文章解释了为什么按平均评分排序不可靠:只有少量评价的条目(比如仅一条五星)会轻易排到最前,而评价数量的差异被忽略。

      算法与计算机科学上首页 7 次 · 2009–2024evanmiller.org编辑精选
    3. 数据结构可视化

      Data Structure Visualizations

      旧金山大学 David Galles 教授制作的数据结构与算法交互式可视化网站,涵盖 B 树、红黑树、排序、图算法等,可逐步操作观察其运行过程。

      算法与计算机科学上首页 6 次 · 2011–2021cs.usfca.edu编辑精选
    4. 1996 年以来的计算机科学最佳论文奖

      Best Paper Awards in Computer Science since 1996

      Jeff Huang 维护的一个汇总页面,收录了自 1996 年以来计算机科学各主要会议的“最佳论文奖”获奖名单,并按年份和会议整理,方便读者一站式浏览历届获奖论文。

      算法与计算机科学上首页 6 次 · 2010–2018jeffhuang.com编辑精选
    5. 算法(Jeff Erickson)

      Algorithms, by Jeff Erickson

      伊利诺伊大学 Jeff Erickson 教授的算法课教材,免费在线开放。

      算法与计算机科学上首页 5 次 · 2018–2022jeffe.cs.illinois.edu编辑精选

    打赏支持

    打赏二维码

    觉得有用,请作者喝杯咖啡。

    WeChat

    关注向阳乔木

    微信公众号「向阳乔木推荐看」

    微信公众号「向阳乔木推荐看」二维码

    微信扫一扫;在微信里打开本页时,长按二维码识别。