ChunkDev 🦋

ChunkDev 🦋

@chunkdev.bsky.social

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

947 followers298 following759 posts

Perlin Noise based rivers have a convenient property: rotating the noise gradient gives them a well-defined local flow direction. The flow even speeds up in narrower regions. I mean well-defined in the mathematical sense. It's not necessarily realistic. #gamedev | #indiedev

ChunkDev 🦋 reposted

Join me for a sunrise walk? I've implemented time-of-day, better atmospheric scattering, airglow so the night sky isn't pitch black, boosted ambient lighting in the dark, and carefully managed transitions. Still missing an actual sun 🤦, moon, stars, and sunrise time stretching. #GameDev #IndieDev

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

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

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

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

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

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

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.

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.

ChunkDev 🦋 reposted

Improved river height interpolation using cubic splines, fixed some weirdness on river banks & deltas. Still hunting a few remaining discontinuities... #indiedev #gamedev #indiegames

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

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

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

ChunkDev 🦋 reposted

Simulating water evaporation & precipitation, driven by a (somewhat fake) fluid simulation for the wind! Need to tweak some constants but overall taking e.g. year-average precipitation and temperature should give me some nice biomes. #indiedev #gamedev #indiegames

ChunkDev 🦋 reposted

I refactored my code that generates a density map for the city to be more detailed and loved the resulting texture so much that I felt compelled to use it in the game. So I added these parallax map displays kind of like some cities have miniature versions of them. #gamedev #indiegame #procgen

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

ChunkDev 🦋 reposted

The level editor is no longer limited to one chunk! The stages can get huge now, if we so desire :D If it gets too large, I'm going to have to set a system where it loads/unloads chunks, but that won't be too tough. #gamedev #indiedev

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

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

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

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

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

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

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