Lost Echo’s Preview 46 – Hybrid Moth Pathing System
Lost Echo’s – Preview 46
Building a Hybrid Pathing System for Moth AI
For this week’s Lost Echo’s preview, I took a break from the game‑console design work and shifted focus to something I’ve wanted to tackle for a while: a “dynamic” pathing system that adapts to the station’s shape. The long‑term goal is to use this for more complex AI behaviors, but for now I’m testing everything with Moths.
I put dynamic in quotes because the word tends to imply full procedural generation — building paths inside the environment, handling collision objects, and behaving more like a NavMesh + A* setup. That’s not what I’m doing here.
A Hybrid Pathing Approach
Hallway path layout in Blender, with segmented Curve3D branches that the Moth AI uses to choose randomized routes through the station
The system I’m doing is kind of a hybrid approach. The Moths are loosely following predefined paths. The Paths are designed in blender, segmented and then baked and exported into a format that Godot can read, and then in the code, and then the Moth AI can dynamically choose a random path (often between 5-13 different options) for each section and room. I say they’re loosely following those path’s, because there still a little bit going on so that the scene’s look more natural.
Some of the path’s I purposely included gaps between to account for the shutters and doors, and the code is set up so that they more naturally glide to those positions over time rather than immediately snap to those positions. There are also additional offsets applied so that the moths aren’t cluttered up in strict lanes as they’re flying around. There are a few cases in these early tests where the paths look too obvious, but I’ll continue to poke around at it.
Light-Swarming Behavior
Beyond basic movement, I’ve been experimenting with Moth‑specific behaviors, like swarming lights. I haven’t implemented a full dynamic power‑tracking system for each room yet, but the current setup lets me test whether they’ll break from their loops to swarm lights, then return when they’re done.
Eventually, lights will have weighted importance. Right now, Moths treat shutter lights the same as hallway lights, but in‑world they should be far less attractive when the power is on than off.
Exporting Blender Curves to Godot
If you’re wondering how I would be able to export 3D Curves from Blender for use in Godot, I actually wrote a plugin to help with that.
When I was originally researching ways of doing this I noticed the common approach was to export a JSON file, and then using an interpreter to load the curve as a JSON file. I felt like this was overly complicating the problem, especially considering the fact that Godot Resource files are written as plain text, so I went through the process of building and testing a blender plugin that will export a Curve3D as a Godot ready file.
It’s for free on Github for anyone else who needs it:
https://github.com/jbmedlin/blender-godot-curve3d-exporter
What’s Next
Right now, the hallways and a couple of rooms are fully set up. Next steps:
- Finish creating and exporting paths for the remaining rooms
- Add clean transitions between rooms
- Add door detection
- Add real light detection (ignore lights that are off)
- Apply weighted attraction to different light types
Wrapping Up
This week was all about laying the groundwork for more believable AI behavior, and the Moths were a good first step to test out the functionality. Next week I’ll be finishing the remaining room paths and tightening transitions, and I’ll also be experimenting with weighted light attraction so shutter lights feel more important.
I’m including a short video below showing the current flight tests. If you’re curious about the Curve3D exporter I built for this workflow, you can check it out on GitHub as well.
More updates soon as Lost Echo’s continues to take shape.
Leave a Reply