Making my 1970's-style renderer multi-threaded

https://news.ycombinator.com/rss Hits: 4
Summary

Filip Hráček / text / Making my 1970’s-style renderer multi-threaded The following article describes a Flutter use case that is so niche that I wouldn’t be surprised if I’m literally the only person who has it at this point. Still, I personally love to read deeply technical articles even when their usefulness for me is unclear at best — so I decided to write this anyway. Use case My game is mostly 2D, but it includes a retro 3D renderer. From the start of working on the game, I wanted a specific look which I’m going to call “a combination of 1970s sci-fi aesthetic and modern military UI”. Download the WEBM video. For this aesthetic, a “normal”, modern 3D renderer just wouldn’t work. So I decided to create a software (non-GPU) 3d renderer mostly from scratch. This allowed me to have complete control over every aspect of the final look of the 3d objects, and since we live in the 21st century, our contemporary computers are more than capable of running the renderer at high framerates. Single-threaded beginnings As a rule, I try to build every prototype feature single threaded first before adding the complexity of concurrency. Since we’re talking about 1970s graphics running on 2020s computers, I was able to keep the renderer single-threaded, on the main thread, for something like 2 years. Then again, a 3d renderer is a 3d renderer, so I didn't completely ignore performance during that time. One cool thing about Flutter is that you get access to some low level drawing APIs, including Canvas.drawVertices. This method allows you to send a list of triangles (with various colors and/or textures) basically straight to the GPU. Perfect for my use case. Pretty soon after implementing the initial 3d renderer, I addressed the fact that I’m creating a new list of triangles every frame. That means a lot of memory allocation and garbage collection. So I went with the slightly more low-level method of creating lists in Dart: TypedData. Dart classes like Float32List (which is a subcl...

First seen: 2025-11-27 04:33

Last seen: 2025-11-27 07:35