Level prototyping in Godot with native CSG: draw, measure, play, freeze, and unfreeze any time

11 days ago by zhan to c/godot

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.

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.

insomniac_lemon 1 point 7 days ago

First thought is make a bigger example with real game-play, so it's more than just an animation.


I'm not sure I'm the target audience as I want something a bit more than cubes and stairs etc. Gridmap properly calculating at least convex exterior hulls (e.g. 2x3x2) into proper occupancy would be a big jump for the sort of 5-mesh workflow I have so far. Multi-scale could still be improved beyond that, too.

Brush editors might be closer (in the sort of situation where something like a pillar/statue/fountain/table etc might be made that way and instanced) though even Quake-style geometry is probably a full-time skill. EDIT: extrusion probably would go a long way for me, though. A ceiling/wall profile isn't such an un-navigable feature.

Especially as I'm leaning more towards textureless colors (which is why I prefer semi-modular pieces over CSG). I'm guessing per-instance shader parameters (for color modulate, glow multiplier) would work fine at first but may get lost during CSG operations (with vertex color support that wouldn't be an issue). I have started a palette so per-color materials is actually something I could do, but no I don't want dozens of materials for basic color... I already am trying to narrow down a dozen materials for different surfaces/uses.

path: 0 26207962, hotness: undefined, score: 1, children: 0
godot
godot

@programming.dev

login for more options
7967
1188
529

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

  • Posts need to be in english
  • Posts with explicit content must be tagged with nsfw
  • We do not condone harassment inside the community as well as trolling or equivalent behaviour
  • Do not post illegal materials or post things encouraging actions such as pirating games

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

  • The icon is a modified version of the official godot engine logo (changing the colors to a gradient and black background)
  • The banner is from Godot Design

go to feed...