Weeknotes 2024 W25: Nanoc 4.13

June 17​–​23, 2024
1400 words

Quick bits:


I finally had my first Gemüsekebab from the food truck near me. I wrote about this place back in March, but did not get around to going there because of the frighteningly long queue.

The queue wasn’t long1 this time around. This was, in part, because I accidentally jumped the queue.2 When I apologized to the people who I jumped in front of, they urged me to stay where I was in the queue. How confusing.

The food was decent and pretty cheap (€6.5) but I don’t think it’s quite worth the queueing time. Would I go there again? Probably not — the queue makes it not worth it.

I don’t understand the hype. The area feels like it has a party atmosphere; so many people are hanging around, having a drink and eating their kebab. But what makes this place so special?3


I released Nanoc version 4.13. This release adds a --focus option, which is useful when you want to recompile only a part of your web site while you’re iterating. It can really help tighten the feedback loop, and that’s always good.4

With the arrival of Nanoc 4.13, the version number looks a little less strange. The version before that was 4.12.21, which looks more like a date — too many digits — than a version number.5


I’ve been having a lot of fun with game development with LÖVE. I’ve created a Solitaire6 implementation, because a) Solitaire is fun and challenging to play, and b) fairly straightforward to implement.

My time is spent in learning the game development framework, and figuring out how to structure the game code, and make the UI/UX juicy. Polish is where it’s at.

I also ended up with a component-based design and a scene tree, which makes some challenges, like alignment and fancy animation, remarkably straightforward.

I don’t have anything to show just yet, and I’ll likely bring it to a more finished state first before sharing anything. Perhaps next week­notes?


I have discovered Itch.io’s list of game jams, and it’s huge.

I only ever participated in a single game jam, and that was ten years ago. At the Berlin Mini Game Jam, I and two others built a game called Black and White. That was fun, but exhausting: we spent eight hours in focus on a Saturday, and it felt like I didn’t have a proper full weekend anymore, and it felt like a Saturday of, well, work.

Still, the game jam was fun and rewarding, and I have clear and fond memories, even a decade later. I’d be up for doing something like that again. Perhaps I will join one of those game jams after all.


There is the common misconception that the best-case time complexity for sorting algorithms is Θ(nlog(n))\Theta (n \cdot \log(n)), with nn being the number of items to sort. But this is only true for comparison sort, and it is possible to get better results in some cases.

One of those cases is drawing element on a screen. Here is some code I wrote earlier:

function Scene:draw()
    -- Group children by z
    local buckets = {}
    for idx, child in pairs(self.children) do
        local bucket = buckets[child.z]

        if not bucket then
            bucket = {}
            buckets[child.z] = bucket
        end

        bucket[idx] = child
    end

    -- Sort groups
    local zs = {}
    for z in pairs(buckets) do
        table.insert(zs, z)
    end
    table.sort(zs)

    -- Draw children
    for _, z in pairs(zs) do
        local bucket = buckets[z]
        for _, child in pairs(bucket) do
            child:draw()
        end
    end
end

This places all items in buckets of a specific z index, and then sorts those buckets. This is why, to nobody’s surprise, this algorithm is called bucket sort.7

Of special note is table.sort(zs), which sorts the collection zs of unique z values. If the number of unique z values is low, then this can be significantly faster.

And yes, I might be optimizing prematurely.


Entertainment:


Tweets and toots:

Links:

Entertainment links:

Tech links:


  1. Rumors on the Internet say that the queue can be up to two hours↩︎

  2. In my defense, Germans don’t know how to queue; I misinterpreted who was queueing and who was just randomly standing around. ↩︎

  3. My money would be on “YouTube personality opens Kebab place,” but I can’t imagine that is the full explanation. ↩︎

  4. Come to think of it, tight feedback loops are generally amazing, and perhaps it is worth writing about this concept in more detail. 90% of the stuff I do at work is tighten feedback loops. ↩︎

  5. Special shoutout to Nanoc 4.11.20, whose version number looks like a date, November 4th, 2020, but was released on December 18th, 2020. This is the release whose version, when interpreted as a date, is the closest to its actual release date. The chance is very slim that any future Nanoc release will have a version whose date interpretation is closer to its own release date than Nanoc 4.11.20, so I suppose it’s only downhill from here. ↩︎

  6. Also known as Patience and Klondike↩︎

  7. My implementation isn’t strictly bucket sort, as I don’t sort the contents of the buckets — the order of children is not relevant. ↩︎

  8. A Short Hike (Adam Robinson-Yu, 2019). ↩︎

You can reply to this weeknotes entry by email. I’d love to hear your thoughts!
If you like what I write, stick your email address below and subscribe. I send out my weeknotes every Sunday morning. Alternatively, you can subscribe to the web feed.