by siliconmountain on 12/8/20, 1:27 AM with 74 comments
by amitp on 12/8/20, 5:26 AM
Tech notes for the curious:
I started the page in 2013 based on notes I had been collecting for ~20 years before that. I update this reference page as I come up with better visualizations and explanations. The last major update was in 2018 when I rewrote it from using d3.js to using vue.js. It greatly reduced the amount of code I was writing, and also let me make the page more interactive. I then added lots more (doubled coordinates, links to papers, axes legends, diagonal directions, side by side comparisons) and improved most of the existing sections. In 2019 the changes were minor, rewriting the map storage section and improving performance. In 2020 I improved the cube/hex animation, the pixel-to-hex section, and added Rust sample code. There's lots more I could add to the page[1] but I don't have any specific plans for when I'll get around to it.
The page is svg- and js-heavy. I prerender the diagrams on the server (try loading it without js!). Then using IntersectionObserver on each section of the page, I swap the static diagrams and text with interactive versions. This improves load times somewhat, because almost no JS has to run on page load.
For printability I process the page with xsltproc, extract all the links, and turn them into footnotes. Try print preview on the page to see these. Unfortunately the diagrams are broken when printing in Chrome (it works in Firefox) so I need to investigate.
[1]: https://www.notion.so/redblobgames/f8bc2f44fba94607afa9c0671...
by furyofantares on 12/8/20, 1:50 AM
It reminds me of old school web. When google first came on the scene I was amazed at how many informational pages from either hobbyists or professionals existed (but which I wasn't finding with older search engines), where someone just decided to put everything they know about some topic into a page in glorious detail.
by aidenn0 on 12/8/20, 2:29 AM
Hexagonal grids give you precise measurements in exactly 6 directions.
If you approximate sqrt(2) as 1.5 then square grids give you pretty darn accurate measurements in 8 directions, including 2 pairs of directions that are orthogonal, which is good for rectangular features like buildings.
Furthermore the distance between two points can be quickly calculated with (long-side + 1/2 short-side), which is doable in your head, unlike the distance calculation on a hex grid.
Lastly, if you divide the circle into a large number of slices and calculate the average error for path distance using hex or squares, among those slices, the average error (compared to pythogorean) is smaller with squares (obviously for small multiples of 6 and small multiples of 8 respectively, one or the other will be preferred).
by yudlejoza on 12/8/20, 2:32 AM
by mrtnmcc on 12/8/20, 3:05 AM
by jsjohnst on 12/8/20, 2:50 AM
[0] https://www.flickr.com/photos/jeremyjohnstone/3979747216/
by elihu on 12/8/20, 5:17 AM
by dang on 12/8/20, 5:57 AM
2019 https://news.ycombinator.com/item?id=19184412
2017 https://news.ycombinator.com/item?id=14627711
2015 https://news.ycombinator.com/item?id=9537009
2015 https://news.ycombinator.com/item?id=8941588
Discussed at the time: https://news.ycombinator.com/item?id=5809724
by type_enthusiast on 12/8/20, 2:08 AM
The source site also has a lot of great stuff on applications of computer science to less-thought-of aspects of game development (by which I mean people usually think of pixel-blasting 3D engines as "game development", but there's a lot more to it)
by keyle on 12/8/20, 3:54 AM
by Timothee on 12/8/20, 2:17 AM
I've been doodling with Processing and was working on hexagonal Truchet tiles. (basically random tiles that have paths connecting to any random tiles next to it, with hexagons as tiles instead of squares)
I ended up having to figure out some of that stuff again, in particular the coordinate system inside each tile so that I could deal with integer coordinates and translate them into the right fraction of the radius.
It was fun to figure out what I needed, so I don't regret it :)
And I am also planning on doing something with cubes, so this page will come in handy.
Thanks for sharing! I love how it covers all aspects of the problem.
Result of the tiling: https://twitter.com/_timothee/status/1330315929641570304
Diagram of my coordinate system: https://twitter.com/_timothee/status/1327859098642046976
by rgovostes on 12/8/20, 2:07 AM
https://hn.algolia.com/?dateRange=all&page=0&prefix=true&que...
by cookiengineer on 12/8/20, 3:02 AM
I've been on this website so often, and pointed other people so many times to it... I hope this never gets lost and is archived.
If Amit would write a book about gamedev, I'd definitely buy it and add it to my collection.
by taywrobel on 12/8/20, 2:17 AM
by michaericalribo on 12/8/20, 4:54 AM
by neilfrndes on 12/8/20, 3:03 AM
by goldenkey on 12/8/20, 8:45 AM
https://github.com/churchofthought/HexagonalComplexAutomata
Or in WebGL:
by xipho on 12/8/20, 2:17 AM
by Groxx on 12/8/20, 2:27 AM
by bransonf on 12/8/20, 5:22 AM
It’s something I’m dabbling in, but no doubt an order of magnitude more difficult to implement than orthodox chess.
The idea of indexing by cubes is so obvious once you discover it, but maybe not as easy to intuit. Same goes for the data structures.
by shwestrick on 12/8/20, 2:00 AM
by swayvil on 12/8/20, 4:24 AM
https://en.wikipedia.org/wiki/Truncated_trihexagonal_tiling#...
Scaleable like a square grid.
12 directions.
by swsieber on 12/8/20, 1:52 AM
It's a great page. It was invaluable to me.
by rcarmo on 12/8/20, 9:51 AM
by willis936 on 12/8/20, 4:18 PM
by ChrisMarshallNY on 12/8/20, 2:16 AM
Thanks for posting it.
I don’t need to do this too often, but I like having choices.
by devsquid on 12/8/20, 2:09 AM
by wycy on 12/8/20, 3:17 AM
by joshu on 12/8/20, 2:25 AM
by darkwinx on 12/8/20, 10:11 AM