Sign in

Red Blob Games

@redblobgames.com
2.2K followers 101 following 560 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. www.redblobgames.com

PostsRepliesMedia
Red Blob Games @redblobgames.com · 17/09/2026
New blog post: www.redblobgames.com/blog/2026-09... I was looking at assigning "a" vs "an" articles for English nouns (for procgen purposes), and fell into a rabbit hole …
Diagram showing the first two letters of English words, and whether that word would get the "a" or "an" article in front of it
0238
Red Blob Games @redblobgames.com · 14/09/2026
And here's an example of some code I wrote that was redundant with code I had written earlier. I had forgotten about the earlier code, but llm-buddy reminded me that I had already done this operation and don't need to do it again. It's essentially acting like a linter but on logic instead of style
Screenshot of an LLM pointing out that I had written some redundant code
050
Red Blob Games @redblobgames.com · 14/09/2026
Here's an example of me being careless. It's not a type error, but the code is wrong. llm-buddy got me to look at it again. And yes, I'm careless sometimes :-(
A screenshot of llm-buddy.el telling me that x: centerOfLastRoom[0], y: centerOfLastRoom[0] is likely a bug, and should've been y getting [1]
160
Red Blob Games @redblobgames.com · 19/08/2026
Busy regreening the desert in this simulation
3785
Red Blob Games @redblobgames.com · 09/08/2026
New blog post about the writing of this page www.redblobgames.com/blog/2026-08...
0202
Red Blob Games @redblobgames.com · 09/08/2026
I turned down the exposure to see the details on the lit side, but the other side was too dark. I took this last week: I think I need to figure out hdr or stacking or something else to combine high and low exposures.
Photo of the moon
050
Red Blob Games @redblobgames.com · 02/08/2026
I added some color and shape options to my procedural face generator www.redblobgames.com/x/1845-face-...
Screenshot of a procedural face generator tool I made, where you can control the mouth shape, face shape, and colors
171
Red Blob Games @redblobgames.com · 01/06/2026
I'm amazed it can do this because the code doesn't have any variables named "covert agents". But it was somehow able to figure out that this function is for calculating the purchase price of covert agents:
Decompiled code from Solar Realms Elite
010
Red Blob Games @redblobgames.com · 01/06/2026
Yay! I have been trying to reverse engineer the SRE formulas for combat. LLM context length has become so long that I fed the entire executable into an LLM and asked it to guess which assembly code did what. It didn't figure out combat, but it did find inflationary vs non-inflationary prices:
Gemini attempt to reverse engineer Solar Realms Elite (a game I wrote a long time ago, and lost the source code for)
110
Red Blob Games @redblobgames.com · 26/05/2026
One advantage of having web pages instead of academic papers is that I can keep improving them. Today I added drag handles to the cone/sector section of www.redblobgames.com/grids/circle... You can now adjust these visually instead of using the sliders. But the sliders still work too.
Before: adjust cone size by using slidersAfter: adjust cone size either with sliders or by moving the drag handle
1554
Red Blob Games @redblobgames.com · 20/05/2026
Whee, I'm now getting email spam "Is Your Sludge Treatment Consuming Too Much Energy?"
Screenshot of e-mail spam about sludge treatment
140
Red Blob Games @redblobgames.com · 25/04/2026
Like this?
Refinement of previous screenshot, with one arrow instead of two when they are aligned
110
Red Blob Games @redblobgames.com · 25/04/2026
Yes, that works except the next diagram has two arrows per tile ;-( especially on the left side:
Screenshot of a grid with up to two arrows per tile
110
Red Blob Games @redblobgames.com · 25/04/2026
Trying to show a flow field and also an object following a path in that flow field. Too many arrows? It's growing on me.
Screenshot of a pathfinding flow field and a specific path in that field
4424
Red Blob Games @redblobgames.com · 19/04/2026
2 reminds me of this map (from Tom Patterson) Location: www.google.com/maps/@38.237...
Tom Patterson's map of the Utah canyonlands
140
Red Blob Games @redblobgames.com · 18/04/2026
The pseudocode on my A* and hexagon pages doesn't have types. I'm considering it, but it feels less like pseudocode…
Sample code that uses dynamic typingSample code that uses static typing
3200
Red Blob Games @redblobgames.com · 18/04/2026
New blog post: highlighting the interactive code samples on my hexagons page www.redblobgames.com/blog/2026-04... (and why it was harder on the hexagons page than on the A* page)
Screenshot of code that's highlighted with colors that match the diagrams
1345
Red Blob Games @redblobgames.com · 14/04/2026
What I'm working on: adding highlighting to code samples on my hexagon page. Standard syntax highlighter packages go from text to html, but I have html input, and it can be interactive, so I had to implement highlighting differently. Might be too much color though! Not sure.
Screenshot of my hexagon page without code highlightingScreenshot of my hexagon page with code highlighting added
4314
Red Blob Games @redblobgames.com · 21/03/2026
I continue to find this mesmerizing. Many years ago I learned about modulo circle multiplication from Mathologer on YouTube www.youtube.com/channel/UC1_... www.redblobgames.com/x/1847-matho... (click Animate; or drag the mouse on the diagram to see different parameter values)
2201
Red Blob Games @redblobgames.com · 16/03/2026
Most pages are the same. But a few pages look a lot better. And a few pages look slightly worse. Another example is this comparison where the old formatting rule completely messed up this code comment but the new rule works better:
Old xml white space handling rule in my web site builderNew xml white space handling rule in my web site builder - looks better!
030
Red Blob Games @redblobgames.com · 16/03/2026
A downside of using the same CSS+template for 30 years of writing is that sometimes I change something and it seems ok but leads to subtle differences on some page somewhere. Today: using Playwright+pixelmatch to look for differences. Example here (left side is diff, middle is old, right is new)
Image diff captured a change in whitespace handling on my site
2112
Red Blob Games @redblobgames.com · 05/03/2026
The main page is www.redblobgames.com/articles/sdf... I used msdfgen and webgl for this
393
Red Blob Games @redblobgames.com · 05/03/2026
Blog post: I've been working on a guide to SDF font rendering, and I kept getting stuck. The blog post is about the things that didn't work www.redblobgames.com/blog/2026-02...
Screenshot of several images from my new blog post
3367
Red Blob Games @redblobgames.com · 22/02/2026
I've written up my understanding of SDF and MSDF fonts, and how to use them with msdfgen+webgl: www.redblobgames.com/articles/sdf... (I'll post it on my blog soon too)
Screenshot of five different styles of rendering SDF (signed distance field) fonts
09121
Red Blob Games @redblobgames.com · 19/02/2026
I continue to get distracted playing with shaders, but I am still making progress on this page.
Text rendered with a signed distance field, setting the color based on the shader derivative of the distanceText rendered with a signed distance field, setting the color based on the shader derivative of the distance, but less at higher elevations
260
Red Blob Games @redblobgames.com · 17/02/2026
Taking a quick break to experiment with shaders
Text with a rainbow colored fillText with a rainbow colored outline
160
Red Blob Games @redblobgames.com · 16/02/2026
Here's the animation showing both the "landscape view" and the "rendered font view"
2190
Red Blob Games @redblobgames.com · 16/02/2026
Thanks! Turns out Chlumsky used it too, in his thesis work on MSDF fonts
Figure 1.5 from Chlumsky's thesis work on MSDF fonts shows a distance field drawn as a height field, with a water level showing where the font is rendered
010
Red Blob Games @redblobgames.com · 16/02/2026
Here's a figure from Chlumsky's thesis. The horizontal part of 'e' (both upper and lower line) have distance fields stored in the red and green channels. The upper curved part (both sides) have distance fields in the red and blue channels. Every edge is assigned to 2 out of the 3 distance fields
Figure 6.4 from Chlumsky's thesis work on MSDF fonts
120
Red Blob Games @redblobgames.com · 16/02/2026
They *are* magic, and I don't have a great explanation at the moment. Here's my rough idea— When constructing a single distance field at a corner, the distance field is necessarily round. But if we construct a separate distance field for the horizontal and vertical lines, then we can make it sharp
Comparison of single distance field vs two distance fields
110
Red Blob Games @redblobgames.com · 16/02/2026
Trying to find a good way to build intuition around distance field fonts: how about comparing it to a map? The land is the filled text, the beach is the outline, the ocean is transparent (optionally a glow/shadow effect). Not sure whether this will make sense to the reader.
4231
Red Blob Games @redblobgames.com · 13/02/2026
Making good progress on restructuring the page to be less of a diary and more of a guide. www.redblobgames.com/articles/sdf...
Screenshot showing the difference between resizing a bitmap font and resizing a distance field font
190
Red Blob Games @redblobgames.com · 13/02/2026
Ooh, neat! Might be interesting to see if they're evenly distributed across floating point bit representations (e.g. it's using all the bits effectively and not wasting some of the space). I was trying that with the font page I'm working on and found that NO, we were wasting lots of the "space":
Histogram showing which values are being used in a font data file
110
Red Blob Games @redblobgames.com · 12/02/2026
My before & after, in "Captain of Industry", a game where I have to pay attention to all the waste products:
Screenshot of me dumping wastewater into the ocean, in Captain of IndustryScreenshot of my wastewater treatment system in Captain of Industry
150
Red Blob Games @redblobgames.com · 11/02/2026
How about a glow effect? I think the main problem with the page now is the overall structure. The first section is commands to run. The first section should be about the concepts with visualizations, not a list of shell commands.
Screenshot of a glow effect applied to text
170
Red Blob Games @redblobgames.com · 09/02/2026
Thanks! I think round corners work with soft outlines, and sharp corners work with hard outlines
Screenshot of soft outlines with sharp cornersScreenshot of hard outlines with sharp cornersScreenshot of round corners with hard outlines
020
Red Blob Games @redblobgames.com · 09/02/2026
Here's an example where the font is rendered with MSDF (keeps corners sharp) but the soft outline is rendered with SDF (makes corners round)
Screenshot of a soft outline around text
280
Red Blob Games @redblobgames.com · 08/02/2026
The contour lines show the signed distance field, and we can set the font thickness to a specific distance:
181
Red Blob Games @redblobgames.com · 07/02/2026
These road intersections look beautiful!
214714
Red Blob Games @redblobgames.com · 06/02/2026
I didn't finish in January 2026. Still working on it! :)
Screenshot of contour lines on a signed distance field rendering of a font
1200
Red Blob Games @redblobgames.com · 01/02/2026
Still working on this.
1160
Red Blob Games @redblobgames.com · 19/01/2026
My January 2026 goal is to finish www.redblobgames.com/articles/sdf... It's a writeup on what I learned about SDF (Signed Distance Field) font rendering. I started in 2024 but then never finished. So my goal now is to finish :)
Screenshot from the page I'm writing
511211
Red Blob Games @redblobgames.com · 16/12/2025
It's a little bit of a hack but the idea is to replace just the "C" or "F" character at the end of the regexp match with the string "C (113.0°F)" or "F (26.7°C)". That string acts as a single character for text editing purposes. gist.github.com/redblobgames...
080
Red Blob Games @redblobgames.com · 16/12/2025
I hadn't realized it before but #emacs syntax highlighting (font lock) can do a lot more than assign color. Here I'm parsing the string into a number, doing a calculation, then generating text to show the result
1345
Red Blob Games @redblobgames.com · 18/11/2025
I was looking through my old projects and found this. I love how it looks and want to do more with this www.redblobgames.com/x/1638-voron...
Screenshot of a stylized procedurally generated map that uses little line marks to show mountains, grass, and water
3575
Red Blob Games @redblobgames.com · 12/11/2025
Side project blog post—from 2010 to 2024, RotMG.com had used maps from my mapgen2 project. There are 2^33 possible maps. I didn't know which seeds they used. I figured … let me just try them all … how hard could it be? ;----) Spoiler: found some! not all. www.redblobgames.com/blog/2025-11...
Realm of the Mad God, world #9.Mapgen2, seed 43671-1.
0231
Red Blob Games @redblobgames.com · 11/10/2025
Yeah! I like <output> but don't use it fully, and haven't done enough for screen readers. I've mostly used this to display the result of <input> elements, like this:
Diagram from https://www.redblobgames.com/maps/noisy-edges/ showing the html structure for accessibility, including a <label> element surrounding an <input> and corresponding <output> element
030
Red Blob Games @redblobgames.com · 05/10/2025
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 bugmapgen4 render with floating point bug fixed looks smoother
2311
Red Blob Games @redblobgames.com · 04/10/2025
I'm working on a slider that lets you control how deep the "folds" on the #mapgen4 mountains are
2192
Red Blob Games @redblobgames.com · 03/10/2025
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 gpuNew river renderer: draw directly on the gpu in a shader
0263