Follow

I've been having issues naming variables that should be constrained to [0-1] range. I used to use *percent but that becomes confusing since that could mean [0-100]% and not its 0-1 value. Does anyone have any suggestions?

A friend recommended "ratio" but I'm not enjoying writing it, it has a different meaning in my head.

@worntunic Fraction? Technically any number between 0 and 1 can be represented by a proper fraction.

@GodofGrunts @m3 That sounds good! I've never considered it since in my native language fractions translate to rational numbers which could be 3/2 for example. Outside of math it translates to "a part of something".

@worntunic @m3 A fraction can be 3/2 as well, but those are referred to as "improper fractions" in English. I'm not sure how other languages refer to them.

en.wikipedia.org/wiki/Fraction

@worntunic ooh this has always bugged me too. I've seen "alpha" before as a suffix, it kind of works?

@_benui @worntunic yeah, I use ratio a lot. Normalised or unit would probably be my other options.

@k @_benui @worntunic I quite like to use "[Foo]Scale" since it implies a direct multiple. Or just "t" in code since that's the default parametric symbol in most math equations

@k @sinbad @_benui I use t for interpolation too, but if it's a parameter that should be tweaked by non-programmers, I try to avoid it since it's not descriptive if you don't know about its usage in math/code

@worntunic @sinbad @_benui ah, yeah. True.

I've started leaning into DisplayName= a lot more, if only for my own memory.

@dznz That's good but it has a constrained context. For example, you can't use it to "get a point along the path x% from the start".

Perhaps the lesson is I shouldn't force one name on all the values that have the same constriction but name them by their behaviour

Sign in to participate in the conversation
Gamedev Mastodon

Mastodon server focused on game development and related topics.