Casey Muratori
caseymuratori.com · Personal blog · on HN since 2018
Casey Muratori is a game programmer and creator of Handmade Hero who writes about API design, performance, and code structure.
What HN saysCommenters repeatedly recommend his 'Semantic Compression' post for structuring low-level code and credit him with coining immediate-mode GUIs.
117HN people shared it
59linked it in comments
69stories submitted
544story points
4 months agolast shared
2018people per year2026
Most-shared posts
- 1Semantic Compression34 people · 167 points · first shared 2018 · 41 comments on HN
- 2The Worst API Ever Made (2014)20 people · 78 points · first shared 2018 · 9 comments on HN
- 3The Thirty Million Line Problem17 people · 22 points · first shared 2018 · 3 comments on HN
- 4Immediate-Mode Graphical User Interfaces (2005)15 people · 9 points · first shared 2019 · discussion on HN
- 5Stable Filtering – Part 18 people · 16 points · first shared 2019 · discussion on HN
- 6Walk Monster (2012)7 people · 77 points · first shared 2018 · 10 comments on HN
- 7API Design – Layers vs. Engines vs. Reusable Components6 people · 4 points · first shared 2018 · discussion on HN
- 8The Color of Noise (2014)3 people · 81 points · first shared 2023 · 12 comments on HN
- 9Stable Filtering – Part 23 people · 31 points · first shared 2019 · 2 comments on HN
- 10The Player Movement System in “The Witness”3 people · 4 points · first shared 2018 · 4 comments on HN
- 11Why Software Patterns Are Bad, Period2 people · 1 points · first shared 2021 · 2 comments on HN
- 12How to get clang++ to find link.exe2 people · 1 points · first shared 2019 · discussion on HN
- 13About2 people · first shared 2025
- 14Blog 00032 people · first shared 2021
- 15Homepage2 people · first shared 2019
What HN people wrote when they linked it
runjake · 2025-10-23
For others who don’t know who Casey Muratori is:
https://caseymuratori.com/about
https://en.wikipedia.org/wiki/Casey_Muratori
He's also that guy in many of ThePrimeagen's YouTube videos.
And wow, that was a great rabbit hole to go down. Interesting guy.
imron · 2024-09-11
My favorite article on this topic is “semantic compression” [0] by Casey Muratori.
0: https://caseymuratori.com/blog_0015
smaddox · 2022-10-25
On knowing how to structure low level code, I highly recommend reading Casey Muratori's blog post on Semantic Compression: https://caseymuratori.com/blog_0015
And, more generally, watching some of his (free) handmade hero video series: https://handmadehero.org/
cma · 2022-05-06
> when any game developer worth his grain of salt could do that very trivially.
Just to note that Casey isn't any game developer, but one who is an expert on 2D UI rendering and popularized his own gui rendering type (probably more or less used in some older games but not articulated?): immediate mode rendering:
https://caseymuratori.com/blog_0001
He's basically an expert in this domain with a very popular approach to performant 2D gui rendering.
panzerboiler · 2022-03-26
The best explanation is probably the one by Casey Muratori (https://caseymuratori.com/blog_0001). He devised the technique and conied the term in 2002.
RealityVoid · 2021-10-04
I was curious as well, I dug a bit and I found this:
https://github.com/cmuratori/refterm
I think he just went ahead and created a completely different terminal.
Also, some background, the original raiser of the PR is Casey Muratori, of Handmade Hero fame:
https://www.youtube.com/channel/UCaTznQhurW5AaiYPbhEA-KA
https://github.com/cmuratori/
https://caseymuratori.com/
maccard · 2021-01-29
Have you written any collision deta code? The difference between collision detection between two boxes in 2d , and two convex hulls in 3d is many orders of magnitude.
Compare [0] to [1]. Being 2D makes factorio many many times simpler than an equivalent 3d game.
None of that has any bearing on the quality of the game,it's an excellent game, and a great technical product to boot.
[0] https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision…
[1] https://caseymuratori.com/blog_0003
disposedtrolley · 2019-11-15
This is a quote from the related blog post (https://caseymuratori.com/blog_0015) that I found interesting:
> Starting from a place where the details don’t exist inevitably means you will forget or overlook something that will cause your plans to fail or lead to suboptimal results. Starting with the details and repeatedly compressing to arrive at the eventual architecture avoids all the pitfalls of trying to conceive the architecture ahead of time.
While I disagree that OOP is completely useless, I have found that designing a solution with an OOP mindset can lead to a time consuming and tedious exercise of trying to figure out the best names and interaction patterns for things that might not need to exist to begin with. Sometimes a language constraint or the design of a library you want to use prevents the OOP vision from being realised in the implementation.
badatshipping · 2019-02-08
Slate Star Codex: https://slatestarcodex.com/
Martin Shkreli: http://martinshkreli.com/
Casey Muratori: https://caseymuratori.com/
Pimpus · 2018-04-27
That reminds me of a blog post[0] I once read by Casey. It does a great job of capturing my thoughts on the subject: in short, that premature abstraction is evil and a productivity killer. Many programmers fall into the trap because of how tempting it is to try and make everything neat and tidy, despite the costs in programmer productivity, program performance, and code maintainability.
[0]: https://caseymuratori.com/blog_0015
cvoss · 2025-01-07
The blog post is lacking critical details stating what exactly the problem definition is. But making some assumptions, I believe the objective is to find a decently short path using less computation time than A*, rather than to specifically find the shortest path.
I will direct the author to any number of references in the field of robotic motion planning. These are algorithms designed to deal with continuous spaces, which is the limiting case of the author's problem with too fine grained a resolution in the A* search graph.
Checking the textbook on my shelf, Principles of Robot Motion (2005), I find an algorithm called "Tangent Bug" within the first 30 pages, which is similar in spirit to the author's proposed approach. The textbook goes on for 500 more pages to develop a host of more sophisticated techniques, including "sampling-based planning," which the author may find extremely useful.
Edit: Just recalled this excellent blog post of Casey Muratori on using one of the sampling algorithms, "RRT", for The Witness: https://caseymuratori.com/blog_0005
GuestHNUser · 2024-04-22
The issue with those books is that they don't have any concrete data that affirms that they are worth following. And, in fact, that style of code is largely to blame for why modern software feels so sluggish. They often reduce performance by 10x if not 100x or worse. I like this video on the topic for reasons not to follow SOLID principles[0]. Muratori also has an excellent talk on writing APIs that are flexible and performant[1]. As for books on understanding the hardware performance, Computer Systems: a Programmer's Perspective, is the best example (not the international edition though, according to the author's recommendation).
I'm not aware of any architecture books recommended by anyone that cares about performance unfortunately. Most high performance software is written iteratively, meaning they aren't assuming a code structure from the start. Andreas Fredriksson, a lead engine programmer at Insomniac Games, has an excellent quote on how he writes high performance software[2]:
> Work backwards from hard constraints and requirements to guide your design. Don’t fall into the trap of designing from a fluffy API frontend before you’ve worked out how the thing will handle a worst case. Don’t be afraid to sketch stuff in while you’re proving out the approach.
> The value is what you learn, never the code. Hack it and then delete the code and implement “clean” or whatever you need. But never start there, it gets in the way of real engineering.
> As an industry we spend…
Calavar · 2024-03-27
My personal experience is that it depends on the context.
Writing new functionality is usually easy if it's self contained. If I know what inputs I will have and what outputs I want, then I generally have a pretty solid idea of how to derive one from the other before the first keystroke.
But if I find that the new functionality is turning into an internal API that will be consumed in multiple places for multiple use cases, things aren't so obvious anymore. You have a combinatorial explosion of design parameters: not just inputs, outputs, and algorithm, but also issues like ownership of data, ownership of the stack, which inputs are supplied at which point in the process, when is it legal to consume outputs and in what ways, push vs. pull interface, two functions for similar functionality vs. one with a flag. When the design parameter space gets this large, it's hard to reason about it ahead of time, and sometimes the most straightforward API doesn't reveal itself until you write code that uses it and realize that there's needless boilerplate or inconsistency that opens up room for logic errors. Then you go back and refactor to eliminate that. Casey Muratori calls this iterative process semantic compression [1]. I don't agree with all his software development takes, but I think he hits this one pretty squarely on the head. The key insight is that an experienced programmer can write good code on the first pass, but it usually takes a second pass to write great code.
[1]…
gingerBill · 2022-08-18
Author of the article here:
I highly recommend reading the previous article to this one posted (Pragmatism in Programming Proverbs) to get a better understanding of what I am expressing, since "The Essence of Programming" is a sequel to that article. I originally wanted to write the previous article in normal prose article, regarding the topic of "Pragmatism in Programming", however I thought I’d experiment in style by writing in a proverbial style.
> The fact that it happens to execute without bugs and produces the correct output is far less important than the code being readable, comprehensible, and consistent as part of the larger system.
I partially disagree with this. If the code executes without bugs (very rare) and produces the correct output, then that code solves the problem. The next task is to make it readable, comprehensible, and easy to maintain whilst not trying to introduce other bugs.
I recommend reading Casey Muratori's article on "Semantic Compression" https://caseymuratori.com/blog_0015
This article is a good overview of the idea I am trying to express in this reply. It's very important to get things working BUT then actually improve it, don't just stop there!
overgard · 2022-07-04
Well, I'm not saying you should discredit advice from people who haven't made great works (IE, most of us), just that it's a question you need to ask to put their commentary in perspective.
Especially when someone like Uncle Bob says: "The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that. This is not an assertion that I can justify. I can’t provide any references to research that shows that very small functions are better. What I can tell you is that for nearly four decades I have written functions of all different sizes."
Well, alright, in that context he's asking us to just take his word for it, but there are no tangible arguments here. Whereas Casey Muratori has a much more thoughtful exploration of this topic ( https://caseymuratori.com/blog_0015 ), and he's also written some very excellent code (in terms of solving difficult problems and doing useful things)
chrissinclair · 2022-02-09
This is an interesting article, but seems to fail to complete the point being made. Yes, having a very flexible API that has lots of possible entry points and extensions is useful to experts, but risks overwhelming those new to the API, especially if they are also new to the domain. Likewise having a convienent, inflexible API can lead to short term adoption at the expense of long term commitment.
Despite making both of these points, and even then going as far as to say you can package a more flexible API into less flexible but more immediately convienent parts arbitrarily, it doesn't quite complete the point by indicating what you really want to aim for is a layered API that allows you to start off with a convienent, high level wrapper and as you need more flexibility, peel off that layer specifically in the place you need it. As ever, talking in the abstract about such things make them seem easier than they are, but still a worthwhile goal.
It's slightly surprising the post doesn't quite make this point, considering that they directly link to Casey Muratori's talk on exactly this as a footnote: https://caseymuratori.com/blog_0024.
Separately, I also find it interesting that there are domains that seem to be deliberately eskewing the layered approach within a single API in favour of requiring separate users to write the higher level convience libraries. Notably some of the modern graphics APIs, including WebGL and WebGPU, which provide the 'lower level' access to…
pastenpasten · 2021-04-26
What asiachick wrote below.
Muratori has demonstrated to me one time too many that he hasn't a got a clue about the things he's talking about.
To be precise: He may or may not have a clue about some things he's talking about, but I don't know enough about them to form an opinion. But in more than one occasions he went on to talk (sometimes at great length) about things where I know he's mostly or completely wrong in what he said.
I don't have a way to know the scope of these things, the things he doesn't know or understand yet talks about. Maybe it's just when it comes to "systems programming". Maybe it's everything that isn't game design and programming. And maybe he's wrong about games too. As I said, I don't know enough to judge everything he says, but the things I was able to judge convinced me not to trust him and his opinions.
And since I can't set the scope safely, I have to not trust him regarding everything.
For example, while his post[1][2] on ETW being "the worst API ever made" is slightly amusing and has _some_ good points, it mostly demonstrates:
(a) Inability or unwillingness to read the documentation. It would have saved most of his problems. But let's say that to criticize the _design_ of an API we can disregard that for a moment.
(b) Inability or unwillingness to pick the right tool for the task or pure trolling.
(c) Worst of all: Complete lack of understanding of the goals, purposes, limitation, design goals and tradeoffs of the system.
You can't…
wrsh07 · 2020-07-31
Pretty good takes here in the comments (shout out to references to "pit of success")
There are two things worth mentioning, though.
1) the best pragmatic programming recommendation is "semantic compression" by Muratori [1]. Incidentally, I find it to be an effective "takedown" of the sort of dogmatic oop that anyone criticizing oop is criticizing
2) Muratori might disagree with this, but for me the whole point of a new class (type) is new invariants [2]. If you need a new invariant, you make a new type. Sticking to this principle has helped me keep classes small and focused without really thinking about other things like "single responsibility". There are a few exceptions (eg you might need a new type to work with a particularly clunky API, like some Map Reduce ones), but it's really that simple.
As a bit of an aside, the worst code I have written hasn't been purely OO nor purely functional. It's been when I've mistakenly tried to add new ideas to existing code that break the paradigm.
[1] https://caseymuratori.com/blog_0015
[2] https://en.m.wikipedia.org/wiki/Class_invariant
svat · 2020-05-15
“OOP” is one of those terms (like most terms) that have a narrow meaning and a broad meaning, and either proponents or detractors can use one of them in arguments:
• OOP, narrow sense (emphasis on “object”): data-with-associated-functions, encapsulation, etc.
• OOP, broad sense (emphasis on “oriented”): organizing your program around objects that model the nouns in the problem domain, “everything is an object”.
A (satirical) illustration of the latter is in the first few paragraphs of https://caseymuratori.com/blog_0015 (from 2014), which gives an example where, to write a payroll system, you first start by designing classes for “Employee”, “Manager”, etc.
A (non-satirical) illustration is in the infamous “TDD Sudoku” series of blog posts (follow the links from http://ravimohan.blogspot.com/2007/04/learning-from-sudoku-solvers.htm… or https://news.ycombinator.com/item?id=3033446) where (in contrast to Norvig's program which just solves the problem) the TDD/OOP proponent ends up with a “class Game”, “class Grid”, “class Cell”, “class CellGroup” (with derived classes “Row”, “Column”, and “Square”), but ends up nowhere. (From Seibel's post: “…got fixated on the problem of how to represent a Sudoku board. […] basically wandered around for the rest of his five blog postings fiddling with the representation, making it more “object oriented” and then fixing up the tests to work with the new representation and so on until eventually, it seems, he just got bored and gave up,…
pjc50 · 2018-04-16
This reminds me of "[semantic] compression oriented programming": https://caseymuratori.com/blog_0015
The arary languages have always struck me as the extreme end of this. The semantics are very dense: each operator does a lot. Intermediate results aren't granted names. The few people who can follow this find it pleasant as the "extraneous" information is removed. Most people find it hard to adapt to. And it doesn't readily suit a lot of business logic.
Possibly the one context where arrays-as-language-primitive has really taken off is the 3D processing world, first with OpenGL's matrix stack computation and later with shader programming. Note that shader programming is the other way round: you don't start with a screen object and apply functions to it mapped across all the pixels (fragments), you write a small program as if for one pixel. Even if the end result is executed in a highly parallel fashion.
andai · 2026-06-21
See also: Muratori, Semantic Compression ("Compression-Oriented Programming")
https://caseymuratori.com/blog_0015
Previously discussed:
https://news.ycombinator.com/item?id=17090319
https://news.ycombinator.com/item?id=36455794
https://news.ycombinator.com/item?id=46183091
TeMPOraL · 2026-03-18
I really like Casey Muratori's "[Semantic] Compression-oriented programming" - which is the philosophical backing of "WET" (Write Everything Twice) counterpart to DRY.
https://caseymuratori.com/blog_0015
JimDabell · 2026-02-13
I think this is the source of the confusion:
> To describe it, I coined the term “Single-path Immediate Mode Graphical User Interface,” borrowing the “immediate mode” term from graphics programming to illustrate the difference in API design from traditional GUI toolkits.
— https://caseymuratori.com/blog_0001
Obviously it’s ludicrous to attribute “immediate mode” to him. As you say, it’s literally decades older than that. But it seems like he used immediate mode to build a GUI library and now everybody seems to think he invented immediate mode?
jesse__ · 2025-12-23
> the key to productive software development is more and more libraries
You had me until this statement. The idea that "more and more libraries" is going to solve the (rather large) quality problems we have in the software industry is .. misguided.
see:
https://www.folklore.org/Negative_2000_Lines_Of_Code.html
https://caseymuratori.com/blog_0031
dundarious · 2025-12-17
I see this as an expression of the same underlying complaint as Casey Muratori's 30 Million Line Problem: https://caseymuratori.com/blog_0031
Casey argues for ISAs for hardware, including GPUs, instead of heavy drivers. TFA argues for a graphics API surface that is so lean precisely because it fundamentally boils down to a simple and small set of primitives (mapping memory, simple barriers, etc.) that are basically equivalent to a simple ISA.
If a stable ISA was a requirement, I believe we would have converged on these simpler capabilities ahead of time, as a matter of necessity. However, I am not a graphics programmer, so I just offer this as an intellectual provocation to drive conversation.
latexr · 2025-03-07
You may enjoy “"Clean" Code, Horrible Performance”, from Casey Muratori.
https://www.youtube.com/watch?v=tD5NrevFtbU
Casey specialises in game engine research and development
https://caseymuratori.com/about
And has an ongoing course on computer performance for programmers.
https://www.computerenhance.com/
scott01 · 2024-11-04
Casey Muratori’s content has had a profound influence on me as a programmer. I’ve enjoyed going through his articles (check out “Stable Filter” [1] if you haven’t yet), as well as his course “Computer, Enhance” [2].
1. https://caseymuratori.com/blog_0035 2. https://www.computerenhance.com/
forgotpwd16 · 2024-05-07
>"built like a videogame"
A term coined Casey Muratori for this is immediate-mode GUIs or else IMGUI programming[1]. Hence the name for the very popular Dear ImGui project. GPUI used for Zed is mentioned as hybrid immediate and retained mode UI framework[2].
[1]: https://caseymuratori.com/blog_0001 (fist post on his blog!) [2]: https://github.com/zed-industries/zed/tree/main/crates/gpui
beaumayns · 2024-01-21
For a pretty good explanation of the algorithm, check this out: https://caseymuratori.com/blog_0003
Consider also the minkowski portal refinement algorithm: http://xenocollide.snethen.com/mpr2d.html . Similar idea, but I find it more intuitive.
Tyr42 · 2023-11-16
Speaking of grass distribution.
https://caseymuratori.com/blog_0009
There is a lot of detail that goes into it sometimes.