style: Apply consistent formatting to all numerical values#29
style: Apply consistent formatting to all numerical values#29Stubbjax wants to merge 5 commits intoTheSuperHackers:mainfrom
Conversation
| Volume = 90 | ||
| LowPassCutoff = 50 | ||
| PitchShift = -10.0 10.0 | ||
| VolumeShift = -20.0% |
There was a problem hiding this comment.
Does the percent give any additional information to the reader?
Since percentage is not bound to 0 to 100, it appears to be a useless information.
There was a problem hiding this comment.
It tells them that a value of 100 is the default.
There was a problem hiding this comment.
Is that so? I expect it depends on context like any other. For VolumeShift I would expect a default of 0%.
There was a problem hiding this comment.
Sure, it would be a default value of 0% for the VolumeShift, but the default would be 100% for the Volume that it is shifting.
Do you suggest removing all % symbols?
There was a problem hiding this comment.
Looking at impl, what it says is "this value is multiplied by 100"
Real INI::scanPercentToReal(const char* token)
{
return scanReal(token) / 100.0f;
}So while 100% would typically be 1, it is 100 in this case.
There was a problem hiding this comment.
What do you mean? That is just a standard % conversion? 100% is effectively a value of 1 as expected?
There was a problem hiding this comment.
I suspect one source of error here could be if someone put a space between the number and the % sign. Then 1 token becomes 2 tokens.
It would be good to add a INI validate tool to the CI so that every INI change is checked against a number of rules.
There was a problem hiding this comment.
There are 3,264 percent (%) symbols in INI files, and this change adds another about 4,000.
There was a problem hiding this comment.
Someone could do the same with a number and mistakenly change a Field = 100 into a Field = 10 0; there are such fields with <int> <int> so it wouldn't look out of the ordinary. The game would likely crash in such a case, regardless.
Is the ~4,000 % additions a concern or just a fun fact?
xezon
left a comment
There was a problem hiding this comment.
I am a bit sceptical about the % sign, but I can understand its intention. It would have been good if simply all relevant variable names had "Percent" in their name. The percent symbol does add a bit of clutter to the value.
Up to you if you want to go ahead with it.
| @@ -159,9 +159,9 @@ AudioEvent MolotovCocktailShatter | |||
| Sounds = gexpmola gexpmolb gexpmolc gexpmold gexpmole gexpmolf | |||
| Control = INTERRUPT RANDOM | |||
| Priority = NORMAL | |||
| VolumeShift = -10 | |||
| VolumeShift = -10% | |||
| PitchShift = -20 40 | |||
There was a problem hiding this comment.
Side note: It is strange that VolumeShift takes % and PitchShift does not.
There was a problem hiding this comment.
Perhaps, but this is how the game parses the data. I suppose pitch is not typically limited to a range.
| Volume = 90 | ||
| LowPassCutoff = 50 | ||
| PitchShift = -10.0 10.0 | ||
| VolumeShift = -20.0% |
There was a problem hiding this comment.
There are 3,264 percent (%) symbols in INI files, and this change adds another about 4,000.
Would you prefer to remove the % signs? |
|
Right now, I am 50 50 on it and have no clear preference. |
You mean you're 50% on it? 😛 What specifically are you sceptical about? The readability of There are plenty of instances where a Behavior = CountermeasuresBehavior Example
EvasionRate = 30.0% ; Percent format suggests that 30.0% of missiles are diverted
EndBehavior = JetAIUpdate Example
OutOfAmmoDamagePerSecond = 10.0% ; Percent format suggests that the jet loses 10.0% of its max HP per second
EndArmor Example
Armor = CRUSH 200.0% ; Percent format suggests that CRUSH damage is multiplied by 2
EndMy original intention was to only standardise fields that alternated between formats. For example, in the retail data, However, rather than just fixing the inconsistencies and then dealing with the anticipated "why not fix them all?" feedback, I opted to just fix them all in the first place. It makes sense to indiscriminately apply the same standard across all data to avoid manually auditing every field as well as eliminating any potential sources of confusion over format inconsistencies. I can apply the change as originally intended if desired. I can also drop the commit (068e105) that adds missing |
|
It is up to you if you want to go ahead with it. I am 50% for and 50% against it. |
Do you have any strong reasons for or against the change? It seems like the additional visual clutter entirely comprises your 50% against? |
I would be in favour of the percentage sign. I looked up other games (e.g. Stellaris) and they use fractions rather than percentages all over - which makes a lot of sense as you know the number is used how it is shown. For percentage the modder needs to know the value gets divided by 100. I think adding the percentage sign is a good way of visualizing this. Ideally we would use fractions everywhere, but that is a step too far atm I think. |
Reasons against:
|
Counterarguments:
|
This change applies consistent formatting to all numerical values (integers, floats and percentages) across all INI files.
Note: Formatting is based on the how the data is parsed by the code, and not based on common or expected usage. For example,
FXList → ParticleSystem → InitialDelayis expected in milliseconds, but its value is read viascanRealand therefore it is formatted as a float.Before
After