Red Blob Games
@redblobgames.com
1.5K followers 97 following 330 posts
Hi! I'm Amit Patel. I explain algorithms and math with interactive web pages (incl. pathfinding, hexagons, procgen maps, voronoi). Wrote Solar Realms Elite; helped w/Barren Realms Elite and Realm of the Mad God. https://www.redblobgames.com/
Posts Media Videos Starter Packs
redblobgames.com
Minor request: could you link to the corresponding caniuse pages for these features, so that a year from now if someone's reading your page they can see if there's any progress from Safari? e.g. caniuse.com?search=final... and caniuse.com?search=dispose
"finalizationregistry" | Can I use... Support tables for HTML5, CSS3, etc
caniuse.com
Reposted by Red Blob Games
hillelwayne.com
I have a sparkling new blog post for you all! "A Very Early History of Algebraic Data Types" traces the history from the first innovation by John McCarthy, through its early use in imperative programming, and to its mainstreaming in FP. Come check it out!

www.hillelwayne.com/post/algdt-h...
A Very Early History of Algebraic Data Types
Been quiet around here! I’ve been putting almost all of my writing time into Logic for Programmers and my whole brain is book-shaped. Trust me, you do not want to read my 2000-word rant on Sphinx post...
www.hillelwayne.com
redblobgames.com
Also notice the difference in the black line for the coastline — much smoother in the new code
redblobgames.com
I could, but there were also weird artifacts that I didn't like, so I'm looking for ways to intentionally add noise (maybe blue noise) without getting the other artifacts. But it's more work than putting the bug back in ;)
redblobgames.com
Yeah, it's because I was storing the elevation in two bytes, and the low byte got scrambled, so some of the elevations end up being higher or lower than they should be. And those glitches are at regular intervals, so it kind of looks neat :)

But now I am storing elevation as one float
redblobgames.com
I've been fixing numerical precision issues in #mapgen4 but some of those issues led to interesting textures that I liked.

(It may be hard to see them on the screenshots)

I'd like to have interesting textures that are intentional instead of the result of a bug …
mapgen4 render with a floating point precision bug mapgen4 render with floating point bug fixed looks smoother
redblobgames.com
You can play with it now on www.redblobgames.com/x/2524-mapge... and I will push it to the main mapgen4 page after more testing
Mapgen4 Renderer
www.redblobgames.com
redblobgames.com
I'm working on a slider that lets you control how deep the "folds" on the #mapgen4 mountains are
redblobgames.com
New blog post: rewriting the mapgen4 river render www.redblobgames.com/blog/2025-09...

I had been drawing river segments on the cpu to a texture, and then reading that texture on the gpu. I changed it to draw river segments on the gpu directly.
Old river renderer: draw to the cpu, then read from that on the gpu New river renderer: draw directly on the gpu in a shader
redblobgames.com
I'm outputting to a WebGL R16F texture in mapgen4. It has a float channel, so I thought … I can set my frag shader to write to "out float" instead of "out vec4". But nope! :) I will change it back to "out vec4" and output three dummy values, which get thrown away.

(I'm learning WebGL2 this week)
Screenshot of buggy output from my shader
Reposted by Red Blob Games
b0rk-reruns.jvns.ca
how I got better at debugging

permalink: wizardzines.com/comics/bette...
from our free zine "So you want to be a wizard": wizardzines.com/zines/wizard/
A comic about computing. A transcript may be available at the link in the post.
Reposted by Red Blob Games
b0rk-reruns.jvns.ca
tips for reading code

permalink: wizardzines.com/comics/tips-...
from our free zine "So you want to be a wizard": wizardzines.com/zines/wizard/
A comic about computing. A transcript may be available at the link in the post.
redblobgames.com
New blog post: after a long break, I'm upgrading some of mapgen4's code (features, performance, bugs, ui, etc.) www.redblobgames.com/blog/2025-09...
A screenshot of mapgen4's map generator, with an ocean to the east, a land mass to the west, and a peninsula to the southeast
Reposted by Red Blob Games
sketchplanations.bsky.social
In The Clock of the Long Now, Brand describes a coniferous forest:

The needle changes within a year.
The tree crown over several years.
The patch over many decades.
The stand over a couple of centuries.
The forest over a thousand years.
The biome over ten thousand years.
redblobgames.com
Downside is that this can get me stuck in a "local maximum". As a result I'm very much stuck in web stuff, and don't know Unity or Unreal at all. But there are sooooo many interesting projects on my list that I haven't felt like I need to learn Unity/Unreal to expand my set of potential projects
redblobgames.com
And here too it depends on the audience. If I'm doing it for ME then I'm happy to learn something new if I already wanted to learn it. But I'm not especially motivated to spend lots of time learning something big that I'm not interested in, just to be able to use it for a small project.
redblobgames.com
(And the past few years I've been trying to do more for me)

Marginal cost — I look at what knowledge I already have, what code I already have, etc. So doing something with 2D hexes in JS is going to be easier (lower cost) than doing something 3D in Unity, because I'd have to learn Unity (high cost)