Level prototyping in Godot with native CSG: draw, measure, play, freeze, and unfreeze any time
programming.dev
Level prototyping in Godot with native CSG: draw, measure, play, freeze, and unfreeze any time
https://youtu.be/hPN2TpN3FSs [https://youtu.be/hPN2TpN3FSs] I’ve been working on CSG Blockout, a Godot plugin for blocking out levels with Godot’s built-in CSG nodes. Version 3.0 is out today. It’s the first version I’d call a level prototyping tool rather than a shape helper. It’s free and MIT licensed. What it does - Build. Drag on any surface to draw a box or a whole room, click a wall to cut a door or a window, push faces with arrows, type exact sizes. - Measure. A player reference shows your character’s height, jump height and sprint-jump arc. Select two platforms to check whether the gap is jumpable, or run a level check that flags slopes too steep to walk and ceilings too low to stand under. - Play. Play From Here drops a first-person test character where you’re looking. It jumps exactly as high and as far as your player metrics say, the same numbers the checks use, so when the jump check says a gap is jumpable, the character can actually make it. - Freeze. A finished room becomes a plain mesh with collision, and Unfreeze gives you the exact CSG back. When the level moves on, you can export to a MeshLibrary for GridMap, or send it to Blender as .glb and swap the refined mesh back in. It’s just Godot nodes Every shape you draw is a stock CSGBox3D, CSGCylinder3D and so on. There’s no level format of its own and no hidden data. Disable the plugin and your scenes open and run exactly as before. If you delete it entirely, here’s what changes: stairs are a CSGPolygon3D underneath and keep their shape; frozen blockout stays a regular MeshInstance3D with collision, you just can’t unfreeze it; the grid materials live in the addon folder, so copy them out first; and bake any Repeater/Spreader before you go. “Isn’t CSG slow?” It can be, so I measured it. Godot only rebuilds the CSG tree you change. With one tree per room, moving a wall takes about 2 ms no matter how big the level is; with 400 primitives in a single tree, it’s about 30 ms. In a running game, live CSG costs nothing per frame, but it has to compute everything while the scene loads: on my machine a 400-primitive level started in 166 ms live and 38 ms frozen. Freezing it takes under 0.1 s, and exports strip the stored CSG. The benchmark is in the repo if you want to run it on your own hardware. What it isn’t It’s not a brush editor: there’s no vertex editing and no per-face UVs. If that’s what you need, Cyclops Level Builder or TrenchBroom with func_godot are good choices. CSG Blockout is for the step before that: getting the layout right and knowing it plays. Godot 4.6+. Interface in 7 languages. - GitHub: https://github.com/qwqzhanqwq/Godot-CSG-Blockout [https://github.com/qwqzhanqwq/Godot-CSG-Blockout] - Asset Library: https://store.godotengine.org/asset/qwqzhanqwq/csg-blockout/ [https://store.godotengine.org/asset/qwqzhanqwq/csg-blockout/] - Benchmarks: https://github.com/qwqzhanqwq/Godot-CSG-Blockout/blob/main/BENCHMARKS.md [https://github.com/qwqzhanqwq/Godot-CSG-Blockout/blob/main/BENCHMARKS.md] It started as a rewrite of LuckyTepot’s CSG Toolkit. I’d love to hear what’s missing from your blockout workflow, and bug reports are very welcome.
0 comments
No comments yet.