Sign in

ChunkDev 🦋

@chunkdev.bsky.social
937 followers 297 following 753 posts

Building ChunkCity - an Infinite City Builder for PC & mobile 💻📱. No engine, built with #Kotlin

PostsRepliesMedia
ChunkDev 🦋 @chunkdev.bsky.social · 17/08/2026
I had the spontaneous idea to let active meshes follow paths and have colliders. The result: an elevator. I never planned to support any of this. I suspect this will be useful for quite a few other things, too. Paths can be edited directly in the game’s built-in mesh editor. #gamedev | #indiedev
0235
ChunkDev 🦋 @chunkdev.bsky.social · 17/08/2026
We have strange spike formations at home
010
ChunkDev 🦋 @chunkdev.bsky.social · 13/08/2026
I finally added retractable landing gear to airplanes. For now, it happens automatically based on distance to the ground. Technically, the wheels are "active reference" meshes that the airplane system takes control over. #gamedev | #indiedev
0142
ChunkDev 🦋 @chunkdev.bsky.social · 09/08/2026
Quest markers are in, but there aren’t any quests yet. Targets are currently simple points with a radius, but they’re represented in three ways: on the minimap, as a screen-space indicator, and as a 3D marker in the world. A lot of steps just to tell the player where to go. #gamedev | #indiedev
1172
ChunkDev 🦋 @chunkdev.bsky.social · 05/08/2026
Reminds me of my construction sites 🥲
010
ChunkDev 🦋 @chunkdev.bsky.social · 04/08/2026
Added cogs to my game
090
ChunkDev 🦋 @chunkdev.bsky.social · 30/07/2026
Now with light switching. To keep chunk meshes such as buildings static, emission color and activation times are encoded in the vertex data and evaluated by the shader based on the time of day. #gamedev | #indiedev
1153
ChunkDev 🦋 @chunkdev.bsky.social · 28/07/2026
I could keep doing this forever. Quite literally, this world is infinite. #gamedev | #indiedev
0152
ChunkDev 🦋 @chunkdev.bsky.social · 26/07/2026
Originally, I wanted buildings to stay as static as possible, with referenced submeshes baked into them. Now I’ve added “active references”: With that, referenced meshes can become their own entities, allowing them to move, rotate, and light up independently. #gamedev | #indiedev
1193
ChunkDev 🦋 @chunkdev.bsky.social · 24/07/2026
Finally added a day night cycle to my city building game. #gamedev | #indiedev
0344
ChunkDev 🦋 @chunkdev.bsky.social · 22/07/2026
Cranes! I’m really enjoying this workflow: Create the meshes in the game’s built-in mesh editor, and then copy their IDs to reference them in code to do stuff. #gamedev | #indiedev
0123
ChunkDev 🦋 @chunkdev.bsky.social · 21/07/2026
My game (still) runs smooth on a 13 years old device #gamedev | #indiedev
1585
ChunkDev 🦋 @chunkdev.bsky.social · 20/07/2026
Cheap but effective night view
0120
ChunkDev 🦋 @chunkdev.bsky.social · 17/07/2026
I hate that car, but the light bar looks neat
030
ChunkDev 🦋 @chunkdev.bsky.social · 17/07/2026
Maybe, just maybe, I am using too many of those lights.
270
ChunkDev 🦋 @chunkdev.bsky.social · 16/07/2026
When you slep a cheap light overlay on your scene and it just looks better. At this point I have various system whose sole purpose is to render a bunch of particle like effects with as few draw calls as possible.
060
ChunkDev 🦋 @chunkdev.bsky.social · 14/07/2026
It's been a while. Here I added an effect radius preview. Technically I am using the same mechanism I use to mark objects without mesh rebuilding in general: Special marker meshes that get drawn only at certain pixels using stencil masks.
060
ChunkDev 🦋 @chunkdev.bsky.social · 31/01/2026
First post of the year after a few stressful weeks at work. Added support for Kotlin objects (singletons): no lazy init yet, but the implementation was refreshingly straightforward. #kotlin
823912
ChunkDev 🦋 @chunkdev.bsky.social · 05/01/2026
I just learnt that Valve used it in Half-Life and called it "Half Lambert"
020
ChunkDev 🦋 @chunkdev.bsky.social · 02/01/2026
Nice, top 80%
120
ChunkDev 🦋 @chunkdev.bsky.social · 02/01/2026
I tried similar things before but this one works exceptionally well while being extremely simple yet elegant. Also thanks for sprinkling in hermite splines, just to conclude that even math says it's a great solution.
030
ChunkDev 🦋 @chunkdev.bsky.social · 30/12/2025
I considered doing it this way, but adding a separate function and calling it reliably behind the scene sounds like a major headache. So instead I added special instructions to the VM to communicate a bit mask of used default values to the function. They are only present before inlining.
060
ChunkDev 🦋 @chunkdev.bsky.social · 29/12/2025
Taught my Kotlin scripting runtime to handle default parameters and named arguments. For simplicity, default evaluation lives in the function body and gets removed when inlined at the call site. #kotlin
81826
ChunkDev 🦋 @chunkdev.bsky.social · 25/12/2025
Angular lerping done wrong in production
6244
ChunkDev 🦋 @chunkdev.bsky.social · 22/12/2025
Good question. I don't support default or named parameters nor `by` keyword yet so that may be a limitation. In terms of raw performance see the attached screenshot where I let it calculate prime numbers up to 1,000,000. My project is under 10k LOC.
120
ChunkDev 🦋 @chunkdev.bsky.social · 21/12/2025
Added vararg support to my runtime. Fewer things broke than expected. #kotlin
103118
ChunkDev 🦋 @chunkdev.bsky.social · 19/12/2025
Implemented a Vector3 inspired by libGDX in my Kotlin scripting runtime. Overriding equality just works - and later sharing the native host class should work seamlessly as well. #kotlin
1025313
ChunkDev 🦋 @chunkdev.bsky.social · 06/12/2025
I added thread support to my runtime. It’s mostly a wrapper around Kotlin’s threads - and of course I had to demonstrate it with the obligatory race-condition example. #kotlin
733917
ChunkDev 🦋 @chunkdev.bsky.social · 03/12/2025
Sorry I had to use the most useless CS-class example ever to show off interfaces working. #kotlin
1237121
ChunkDev 🦋 @chunkdev.bsky.social · 30/11/2025
I discovered that adding new opcodes is sometimes easier if I introduce them through handwritten MiniKt assembly functions, so I can reuse the normal function resolution. The compiler inlines them anyway. #kotlin
1430415
ChunkDev 🦋 @chunkdev.bsky.social · 29/11/2025
Added generics for classes. It was painful. I wasn’t aware how much the compiler does for you. #kotlin
1200
ChunkDev 🦋 @chunkdev.bsky.social · 28/11/2025
Me: I won’t add many features to this tiny Kotlin scripting runtime. Also me: adds function-level generics. #kotlin
947318
ChunkDev 🦋 @chunkdev.bsky.social · 28/11/2025
Something I like to use it for it resources where you call some sort of start() method and then must not forget to call a corresponding end() method. You can write that logic once in a function and never again forget to call end():
110
ChunkDev 🦋 @chunkdev.bsky.social · 27/11/2025
I would assume so, given that without the inline modifier you cannot use statements like return to return the outer function from within the lambda
040
ChunkDev 🦋 @chunkdev.bsky.social · 27/11/2025
One of Kotlin’s wildest features: you can define control flow altering functions using lambda expressions with a special syntax. Thanks to aggressive inlining it’s basically free. #kotlin
2948928
ChunkDev 🦋 @chunkdev.bsky.social · 25/11/2025
Higher-order functions take other functions as arguments. The fun part: you must not inline the call unless the target is constant - otherwise you break semantics (and your VM). #kotlin
1241024
ChunkDev 🦋 @chunkdev.bsky.social · 23/11/2025
I did the absolutely sane thing of letting the script run another script; Kotlin-ception achieved #kotlin
5994
ChunkDev 🦋 @chunkdev.bsky.social · 23/11/2025
Got sidetracked and ended up writing a tiny raytracer for performance benchmarks. 😅 #kotlin
1160
ChunkDev 🦋 @chunkdev.bsky.social · 22/11/2025
This is my first time implementing class inheritance via vtables (in my tiny Kotlin runtime). A::foo() vs B::foo() get resolved through vtables in the generated code if they cannot be resolved statically. Seeing it work correctly is more satisfying than it should be. #kotlin
1765136
ChunkDev 🦋 @chunkdev.bsky.social · 20/11/2025
Imagine your embedded runtime throwing exceptions with real stack traces - and your IDE actually picking them up correctly so you can easily navigate there. 🤯 #kotlin
3856629
ChunkDev 🦋 @chunkdev.bsky.social · 20/11/2025
The journey continues. I’m still aiming for the point where I can take some random Kotlin code and execute it within Kotlin. Recent additions: - Explicit nullability - Safe calls - Extension functions #kotlin
070
ChunkDev 🦋 @chunkdev.bsky.social · 18/11/2025
You can inject functions into the embedded runtime. Doing this manually gives a clear separation and control over what the embedded code can do.
270
ChunkDev 🦋 @chunkdev.bsky.social · 17/11/2025
Though the custom println didn’t get inlined as the compiler decided it was too long to bother
090
ChunkDev 🦋 @chunkdev.bsky.social · 17/11/2025
My embeddable Kotlin scripting language just got a new feature: classes. And if you look at the assembly, you can see the function calls getting inlined. #kotlin
1537120
ChunkDev 🦋 @chunkdev.bsky.social · 15/11/2025
110
ChunkDev 🦋 @chunkdev.bsky.social · 15/11/2025
Sometimes you get one of those insane ideas you know you’ll regret, but it’s just too intriguing. So… I’m building a compiler for a subset of Kotlin - something I can embed into Kotlin/JVM projects like Lua, but with static typing and better performance. #kotlin
2756828
ChunkDev 🦋 @chunkdev.bsky.social · 06/11/2025
I added a tree cutter for your tree cutting needs. #gamedev | #indiedev
2295
ChunkDev 🦋 @chunkdev.bsky.social · 05/11/2025
Originally, terrain editing was click based. However, I noticed that clicking like a hundred times to make a hill is rather inconvenient. So now there's continuous terrain editing. #gamedev | #indiedev
0717
ChunkDev 🦋 @chunkdev.bsky.social · 03/11/2025
Experimenting with clipping based transparency. In contrast to actual alpha it doesn't require special sorting or separate draw calls. However, some GPUs - especially mobile ones - tend to dislike this type of rendering pretty much. It's also quite noticable on lower resolutions.
130
ChunkDev 🦋 @chunkdev.bsky.social · 02/11/2025
What’s going on here? Why is everything…chrome? #future | #gamedev | #indiedev
2114