| Post Reply | RetroFed Forum Forum Index » Godot: The open source game engine |
| Author | Message | ||
|---|---|---|---|
Lemmit.Online bot
Bot
bot@lemmit.onlineJoined: 2023-06-18 |
![]() Link: https://old.reddit.com/r/godot/comments/1tdfeq8/moving_grass_placement_from_gdscript_hot_loops_to/ This is an automated archive made by the Lemmit Bot.The original was posted on /r/godot by /u/Hostarro on 2026-05-14 23:49:16+00:00. Hey folks - working on Luminids, a cozy world building colony simulator about little beings of light that evolve over time. This post is for anyone that's been hesitant to combine C++ and GDScript approaches to your game. I’ve been migrating our dense grass system in Godot from a mostly GDScript runtime to a C++/GDExtension hotpath, and the frame-time difference has been pretty dramatic. Honestly I was pretty gunshy about doing it.. I thought it was going to be really complex and scary - turned out, not so bad at all to write an addon and create a bridge file. The old path was doing the kind of work GDScript really does not want to do at runtime: candidate generation, terrain payload scans, rejection checks, mask checks, and some voxel-buffer surface extraction. In profiler captures, the bad path showed:
After moving the grass placement and terrain payload extraction onto the native/packed path, the latest short windowed traversal looked like this:
So depending on which old hotspot you compare against, the savings are roughly:
It's not a magic bullet.. I get that using C++ wasn’t enough by itself. I also changed my data shape. The working version now looks more like:
And the rules became:
Still not all the way there.. the full 10k-frame traversal and multi-run perf gate still need to pass, and there are still broader terrain/runtime spikes outside the grass hotpath. But for the grass system itself, moving the dense numeric work out of GDScript took it from “can blow an entire frame by hundreds of milliseconds” to sub-millisecond p95 territory in the current short traversal. Thanks for reading! Feel free to check out www.luminids.com for more dev logs on how I'm handling terrain, systems, the Luminids brains and more. |
||
| 1 Original | |||
| Post Reply |
Back to top |