The Orange Duck
theorangeduck.com · Personal blog · on HN since 2012
Daniel Holden writes about game animation, machine learning, and programming, including parser combinators, springs, and Markov chains.
What HN saysCommenters recommend his 17-line Markov chain and spring roll-call posts as clear explanations, and cite his animation and language-implementation work.
74HN people shared it
17linked it in comments
81stories submitted
1.3Kstory points
7 months agolast shared
2012people per year2026
Most-shared posts
- 1You could have invented Parser Combinators11 people · 156 points · first shared 2014 · 28 comments on HN
- 2Phase-functioned neural networks for character control in games8 people · 30 points · first shared 2017 · 1 comments on HN
- 3Spring-It-On: The Game Developer's Spring-Roll-Call5 people · 8 points · first shared 2021 · discussion on HN
- 4Line Markov Chain5 people · 8 points · first shared 2017 · discussion on HN
- 5Machine Learning, Kolmogorov Complexity, and Squishy Bunnies (2019)4 people · 257 points · first shared 2019 · 21 comments on HN
- 6Why Can't I Reproduce Their Results?4 people · 189 points · first shared 2020 · 124 comments on HN
- 7My Neural Network isn't working! What should I do?3 people · 46 points · first shared 2017 · discussion on HN
- 8Cubic Interpolation of Quaternions3 people · 4 points · first shared 2023 · discussion on HN
- 9In Defence of the Unitype3 people · 4 points · first shared 2014 · discussion on HN
- 10Let's talk about animation quality2 people · 238 points · first shared 2024 · 78 comments on HN
- 11Local Minima, Saddle Points, and Plateaus2 people · 52 points · first shared 2018 · 10 comments on HN
- 12Infinity doesn't exist2 people · 18 points · first shared 2015 · 5 comments on HN
- 13Encoding Events for Neural Networks2 people · 7 points · first shared 2021 · discussion on HN
- 14Subspace Neural Physics: Fast Data-Driven Interactive Simulation2 people · 5 points · first shared 2019 · discussion on HN
- 15Writing Portable OpenGL2 people · 3 points · first shared 2013 · discussion on HN
What HN people wrote when they linked it
max_ · 2024-02-01
If you want a quick insight into Markov Chains I recommend this resource by Orange Duck.
Orange Duck has an implementation of a Markov chain in 17 lines of Python. [0]
[0]: https://theorangeduck.com/page/17-line-markov-chain
odobo · 2024-01-16
If you enjoyed this post, I would highly recommend this blog post on springs. Springs basically are PD controllers, and I reference this post all the time to understand how to use them: https://theorangeduck.com/page/spring-roll-call
modeless · 2023-11-08
IK doesn't "solve" the core problem of realistic character motion. Sure you can tweak foot positions to stop them from sliding but the farther they get from the original animation data the worse the result will look. It's no panacea.
There are new approaches to generating realistic character motion being shown at SIGGRAPH every year, getting better and better, but the best ones are largely too expensive for games to adopt. Plus, for player-controlled characters, at a certain point you run into a fundamental tension between control responsiveness and physical realism of animations.
I recently saw a great article on the topic which even comes with a WebGL demo: https://theorangeduck.com/page/code-vs-data-driven-displacement#footlo…
qwertyuiop924 · 2016-09-11
"people on the 'net jerking themselves off" is a pretty good descriptiob of freenode's ##c. I'll quote Daniel Holden (the author of the book on implementing a lisp you mentioned above)'s words on the matter[1]:
This channel is hardly known for being friendly. Generally anything other than K&R is regarded as Socratic corruption. And not checking the return value of malloc is on par with adultery. Nor do they have much concern for encouraging the next generation of C programmers. I remember witnessing a new C programmer ripped for several minutes on the channel for simply mentioning the heap and stack in their explanation. Instantly he was shot down with "implementation detail and not defined in the C standard" and told to ask his question in #unix. The channel is generally a great place to go if you want to be told you're an idiot.
1: http://www.theorangeduck.com/page/ready-fight
dismister · 2024-10-31
I'm sure there will be lots of people recommending great books, so i want to give you some general advice:
sadly, a lot of language related libraries are in C/C++, so if using those sounds a pain to you, just ignore them for now.
get somthing simple working soon, such as an interpreter for Forth [0] written in any language you already know.
do the parsing later, there is so much more to learn about compilers and language runtimes!
when it's finally time for parsing, i recommend parser combinators [1]. they are pretty easy to implement yourself, once you have understood the concept and are very flexible.
do not forget about proper error messages with line/col information.
any kind of performance optimisation is strictly forbidden until you know what you are doing.
[0] https://en.m.wikipedia.org/wiki/Forth_(programming_language)
[1] https://www.theorangeduck.com/page/you-could-have-invented-parser-comb…
cyber_kinetist · 2021-09-03
I think of neural networks as "smooth compression" - something that compresses a key-value database into a continuous non-linear function. Previously Daniel Holden wrote about something similar in his blog (https://theorangeduck.com/page/machine-learning-kolmogorov-complexity-…
I agree with the author's sentiment that "learning" might be a misleading term. Neural networks can just be seen as specialized programs that just compress certain kinds of data extremely well (at the cost of extremely high pre-computation). But it's still a very useful technique to tackling previously intractable problems.
Thorrez · 2020-11-05
That reminds me of this story[1]. The author shared some code that was so bad, that the recipient of the code was kicked out of the country. Receiving bad code can have some extreme consequences.
[1] http://theorangeduck.com/page/reproduce-their-results#sourcecode
unmole · 2017-06-21
Another good introduction: http://theorangeduck.com/page/you-could-have-invented-parser-combinato…
notriddle · 2017-05-26
[Plain Elixir has one data type.](http://www.theorangeduck.com/page/defence-unitype)
daveguy · 2017-05-03
Source paper is here:
http://theorangeduck.com/media/uploads/other_stuff/phasefunction.pdf
devrandomguy · 2017-05-01
nnq · 2016-06-29
Cool... but nitpick about the parsing part (only glanced at it): why do people always forget about parser combinators and don't present them as obviously 'the first thing to try' when making a new language?!
They seem the simplest and most intuitive tool for an unbiased newbie designing a new language, and you can even introduce them by skipping the theory with something like this: http://theorangeduck.com/page/you-could-have-invented-parser-combinato… .
gshrikant · 2015-11-01
I think both the library and the book are written by the same author [1].
[1] http://theorangeduck.com/page/you-could-have-invented-parser-combinato…
norswap · 2015-02-22
The C Preprocessor might be functional in the same sense as the lambda calculus but that's about it.
And actually it isn't really: it needs to be supplied "evaluations" to work. Evaluation is naturally recursive but cpp only performs one pass, so you need to explicitly request more evaluations (or "scans").
See here: http://pfultz2.com/blog/2012/05/10/turing/ and here: http://theorangeduck.com/page/c-preprocessor-turing-complete
nine_k · 2015-01-29
Why write an FSM and backtracking explicitly? Use parser combinators, they basically do the same thing, just express it in a clearer, grammar-friendly way: http://theorangeduck.com/page/you-could-have-invented-parser-combinato…
dahart · 2018-11-30
It would be pretty interesting to use a neural network for AO! It's a good coincidence you linked to SSIM based adaptive sampling, I'm actually using the research you linked to: I implemented the OptiX API for SSIM prediction. So far, we've used it for choosing where to send more rays, but I'm not aware of anyone using it to adapt the max distance for AO rays. That might be fun & fruitful to try!
I'm not certain, but I think in theory that capping the max distance will always bias the AO (to the extent that AO even makes physical sense). You can reduce the bias by mixing lengths, but I'm not sure if you can ever fully compensate for it. More importantly, it's always (theoretically) biasing to separate AO shading from the normal surface shading & lighting calculation. AO is a beautiful simple hack, but I'm not sure it will survive the future, especially as ray and compute budgets increase.
I know I've seen other AI attempts to learn AO & global illumination, just googling a bit:
http://theorangeduck.com/page/neural-network-ambient-occlusion
https://www.youtube.com/watch?v=z_zmRWxU-PY
gus_massa · 2014-01-28
From a previous article of the same author: http://theorangeduck.com/page/c-preprocessor-turing-complete
> This is a fairly clear distinction and a compelling argument. Clearly there are languages where you can effectively express unbounded recursion function() { function() } and the C preprocessor is not one of them.
>* But there are a number of subtleties going on here. For example, if we consider the set of macros I created to be the "machinery", and the "language" to be the Brainfuck input to my system, then it is indeed Turing complete. That is - I have created machinery which can simulate Turing complete languages. Taking all the above definitions into account, consider how odd it is that Turing complete machinery can be expressed in a non Turing complete language.*
And from the “Brainfuck interpreter written in the C preprocessor”: https://github.com/orangeduck/CPP_COMPLETE
> Currently the maximum recursion depth is set to around 1000 and the data array size around 100. These can be easily extended but for now, as a general rule of thumb computations exceeding 1000 steps may not run.
Here is the problem. We can consider the one-step-interpreter: it’s a function that has as arguments a program, the current instruction index and the whole memory state, and this function computes the next instruction index and the next whole memory state. This one-step-interpreter is primitive recursive.
He put that function inside a bounded loop, which is also implementable as a…