When playtesting, make sure you have some international players testing on their own computers set to their own system locales. I didn't learn until a over year after launch that float.Parse() in C# can expect commas for decimals in many parts of the world, and will ignore periods. #GameDev
@robertcarlson Same in C and C++ unless you're careful. Always entertaining if you store data in CSVs or similar.
@TomF @robertcarlson And then what do you do? Does C just not work in many countries?
@yora I only know for sure about C#, but you can pass a CultureInfo object along with the string to parse to get the same behavior regardless of which system it's running on.

@robertcarlson @yora This caused a bug in the Pokemond Diamond/Pearl remakes where the calculator poke app didn't work in some locales bc they were parsing the display text (manually, assuming '.' separator for whole and fractional parts) to get the current calculated value

Moral of the story: Never rely on parsing display text as a source of truth. But also, beware localized string behaviors

@robertcarlson @yora (Personally, I prefer having separate types for "this is an invariant string" and "this is a localized string for display" like Unreal does, but C# works for what it is)

@yora @robertcarlson You have to be careful and set the locale and/or use the explicit-locale calls. It's pointlessly complicated:

https://stackoverflow.com/questions/13919817/how-to-parse-numbers-like-3-14-with-scanf-when-locale-expects-3-14

How to parse numbers like "3.14" with scanf when locale expects "3,14"

Let's say I have to read a file, containing a bunch of floating-point numbers. The numbers can be like 1e+10, 5, -0.15 etc., i.e., any generic floating-point number, using decimal points (this is f...

Stack Overflow