Custom measuring units in the editor?

Everything in Godot is measured in pixels. This is… tedious if you don’t want your game to be measured in pixels. Especially if you don’t have art skills and you just want to throw together a prototype - a pretty simple workflow is to define a custom pixels per unit, and then draw simple shapes with respect to that unit. The root transform will convert your unit-one assets into pixel space, no problem.

However, because everything is measured in pixels, if you want to do this in Godot you’re making circles and squares at the scale of one pixel and zooming in 12k % on the editor. And don’t forget to turn off snapping or you’ll have some issues if you want your shapes to be centered about their coordinates. A pretty simple solution to this is just to add the ability to change the unit that the editor measuring scale uses.

This is something I recently asked in the help category to see if it’s even possible. Seems like it’s not, and it seems like complaining about that fact will earn you a circle-jerk of people crapping on your “not too bright idea.” Call it what you will, but this is a feature that’s pretty wide-spread across many other major engines, including both Unreal and Unity. So let’s address some of the concerns that people had on that thread (that are really non-issues), hopefully in the appropriate place since some of you seem to really care about rules here.

  1. Such a feature would affect “every conceivable operation” - yes and no. The ability to change the units your project uses already exists in Godot. Just change the transform on your root node… And in fact, having it affect every conceivable operation is the entire benefit. A custom unit enables you to think in the units that are relevant to your project, instead of thinking in pixels. Your root transform will convert everything to pixel space for you. However, like I said, that’s already possible in Godot. The feature I want to see is to just to be able change the scale that the measuring ticks use. Hopefully this only affects one operation - which is rendering the measuring ticks.

  2. “Deviating from 1 pixel per unit only reduces your floating point precision,” - There’s some kind of a misconception here. At the end of the day, 40 pixels is 40 pixels, regardless of if you work it into every asset or if a transform does that for you. If the scale of your project requires more precision than a single-precision float can offer, you should use a double.

  3. “Units are just a dubious bloat that goes against that lean-and-mean principle.” This is genuinely funny because if you think affine transforms are bloat, I’ve got news for you - they’re already in the engine. The “bloat” that the feature I want to see would add is an editor settings option. The idea that either affine transforms or an additional editor setting is bloat genuinely makes me laugh.

  4. “It’s a waste of performance, potentially significant, and would need constant housekeeping in many parts of engine’s native code.” - A waste of performance is pretty subjective here. If you like thinking in pixels, then yes, it’s a waste of performance - so don’t use it in your project if you don’t want it. And “potentially significant and in need of constant housekeeping” is pure speculation. I hypothesize that it’s incredibly insignificant to implement and would require virtually no housekeeping.

    On that note, it’s also extremely premature optimization to be worried about the flop count of adding a root transform (which again - is something you decide to do by adding the node to your scene - I’m explicitly not asking for this by default - just a way to change the scale the editor uses for its measuring ticks). If you decided to add a root transform and then realized the extra dozen or so flops it adds to calculations is a problem, then take it out.

  5. “don’t want to scare new users with a change of scale halfway through the project” - This can easily be done in a backwards compatible fashion though. People in Godot seem to be used to working with pixels, so the Rule of Reasonable Defaults dictates that the default measuring scale should be in pixels. Adding the ability to change that doesn’t have to mean changing it by default.

  6. “[because of concern 5] it would be best to scare new users with the option at project creation, as if (imo) picking one of three rendering devices doesn’t cause enough decision paralysis.” - Concern 5 is a non-issue, so no - I disagree here. I personally think it would be best to put this in an editor setting (or potentially on a gizmo or in the icon hotbar) so you only have to think about it if you’re particularly looking for it.

On a side note, scenes by default already have a root node where you can change the scale, and it already affects every conceivable operation regardless… (besides - of course - rendering the measuring ticks)

Why not make a proposal?

2 Likes

You still missed to present your actual use case. You’ll have to do that anyway if you plant to formally request a feature.

So the question remains - why would you not want to measure in pixels? Perhaps articulate that better.

Remember that neither Unity nor Unreal have dedicated 2D engines comparable to Godot’s. They “fake” 2D using their 3D renderers, which are unit agnostic. so the custom unit implementation there boils down to scaling and conversion for gui display. Even that I’d consider a bloat as you can always interpret a nameless 1 unit however you want. In the context of how Godot’s 2D engine operates, sticking strictly to pixels makes perfect sense. Familiarize yourself a bit more with it rather than wanting it to operate like some other engine you had prior experience with.

You also might want to look at how Godot’s Control nodes and gui layouting system work. I suspect the solution to this (presumably) XY problem could actually be there.

In any case if you think custom units are a must in Godot, best to throw it in front of the devs and see what they think about it.

2 Likes