Molecular Matters
blog.molecular-matters.com · Personal blog · on HN since 2015
Stefan Reinalter writes about C++ game engine programming, covering lock-free work stealing, custom allocators and data-oriented design.
What HN saysCommenters recommend it as a "goldmine" for no-nonsense software design, with posts on task schedulers and memory allocators.
15HN people shared it
7linked it in comments
13stories submitted
178story points
2 years agolast shared
2015people per year2026
Most-shared posts
- 1Lock-Free Work Stealing, Part 1: Basics2 people · 49 points · first shared 2015 · 5 comments on HN
- 2Getting the type of a template argument as string in C++ – without RTTI2 people · 3 points · first shared 2015 · discussion on HN
- 3Homepage2 people · first shared 2019
- 4Adventures in data-oriented design – Part 3b: Internal References1 people · 73 points · first shared 2021 · 2 comments on HN
- 5Lock-Free Work Stealing, Part 4: Parallel_for1 people · 37 points · first shared 2015 · discussion on HN
- 6Lock-Free Work Stealing, Part 2: A specialized allocator1 people · 4 points · first shared 2015 · discussion on HN
- 7A faster quaternion-vector multiplication1 people · 3 points · first shared 2020 · discussion on HN
- 8Using runtime-compiled C++ code as a scripting language1 people · 3 points · first shared 2016 · discussion on HN
- 9Lock-Free Work Stealing, Part 3: Going Lock-Free1 people · 2 points · first shared 2015 · 1 comments on HN
- 10Lock-Free Work Stealing, Part 5: Dependencies1 people · 2 points · first shared 2016 · discussion on HN
- 11Generic, type-safe delegates and events in C++ (2011)1 people · 1 points · first shared 2017 · discussion on HN
- 12Live++ 1.0.0 released1 people · 1 points · first shared 2018 · discussion on HN
- 13Stateless layered multi threaded rendering part 11 people · first shared 2019
- 14What happened to the molecule engine1 people · first shared 2015
- 15Properly handling keyboard input1 people · first shared 2024
What HN people wrote when they linked it
w4rh4wk5 · 2024-09-17
We've invested some time to improve this situation for the games we port, at least to some extent. Keyboard input is read as a combination of scan code + win32 virtual key information to determine the physical key pressed on your keyboard. This way the keybindings are (almost) independent of the keyboard layout.
However, we also reflect your current key bindings with dynamic button prompts that tell you which key to press in game. For this we translate the determined physical key back through the selected keyboard layout to figure out what the corresponding label on your keyboard might be.
Most of this is just win32 API shenanigans, but the following post provides a bit more detail on reading inputs this way.
https://blog.molecular-matters.com/2011/09/05/properly-handling-keyboa…
Raugharr · 2019-12-31
https://www.redblobgames.com/ talks about map generation, A*, and algorithms for hex based grids.
https://blog.molecular-matters.com/ talks about a task scheduler and several types of memory allocators.
https://www.gamasutra.com/blogs/ChrisSimpson/20140717/221339/Behavior_… is an overview of behavior trees.
metaobserver · 2019-12-03
If you are into no-nonsense software design, Molecular Musings [1] written by Stefan Reinalter is also a goldmine. As is anything written or said on topic by Mike Acton, whose ramblings de-facto brought DOD into the mainstream [2][3]. Regarding good old days, remember Flipcode? ;) [4]
[1] https://blog.molecular-matters.com/
[2] https://macton.smugmug.com/Other/2008-07-15-by-Eye-Fi/n-xmKDH#!i=59342…
[3] https://www.youtube.com/watch?v=rX0ItVEVjHc
[4] https://flipcode.com/archives/articles.shtml
tuxalin · 2019-06-17
Glad to hear that!
I dont have anymore the exact numbers, usually when you have around 1000 commands/calls you won't really feel a difference, in that case even using std::sort is fast enough and there's no point in using radix sort, however when you go over 10k commands/calls you'll feel it (can be up to a msec on the dispatch side).
You can check this great post that provides numbers (see part 4): https://blog.molecular-matters.com/2014/11/06/stateless-layered-multi-…
The performance should be very similar and it even goes further by adding thread local storage to reduce false sharing even more, which I didn't add but should be considered as it's easy to do.
devbug · 2016-04-07
This unfortunately breaks down with (bad acting) NIFs. Thankfully you can mark 'em as the dirty evil little things that they are (with negligible overhead): ERL_NIF_DIRTY_JOB_CPU_BOUND. [1]
I implore anyone interested in Erlang or its surrounding languages, to read its source code. [2] More specifically, the BEAM. I'll warn you that it's very 80's hackeresque, but in a good way. Incredibly pragmatic. The way they achieve their world-class scheduling? Tip: not via a perfect theoretical design cooked up in some comp-sci lab. [3] If you've been following game engine design within the last 9 years or so, you'll probably have a good idea of how they do it. [4][5]
[1]: https://medium.com/@jlouis666/erlang-dirty-scheduler-overhead-6e1219dc…
[2]: https://github.com/erlang/otp/tree/maint/erts/emulator/beam
[3]: https://hamidreza-s.github.io/erlang/scheduling/real-time/preemptive/m…
[4]: http://blog.molecular-matters.com/2012/04/05/building-a-load-balanced-…
[5]: There's a hell of a lot of depth to this problem domain. Charles Bloom's guiding principles for Oodle are spot, and well worth a look.
Kristine1975 · 2016-05-24
C++ supports it if you're willing to use more or less complicated templates:
http://bannalia.blogspot.de/2015/09/c-encapsulation-for-data-oriented.…
https://blog.molecular-matters.com/2013/10/22/implementing-a-semi-auto…
SloopJon · 2015-08-25
The home page describes it as "the foundation for all our tools, with parts of the engine being available to licensees as stand-alone game engine bits."
This post suggests that it is intended to compete with Unreal and CryEngine:
http://blog.molecular-matters.com/2015/08/12/what-happened-to-the-mole…
One of the posts about runtime-compiled C++ states that iOS is not a target platform.