Page 1 of 1

Loading floats stored in scientific notation = Crash

Posted: Fri May 27, 2016 9:23 am
by andrew2110
Hi! Put my game out to beta earlier this week and today have come across a significant bug in my game. On examining their Dialogue System data, I have a float variable called "Travelled" which stores the number of meters the player has traveled. The player had walked so far around the world that their meters was now being stored in scientific notation: Variable["Travelled"]=1.307709E+07;

When I made the call to do:

PersistentDataManager.ApplySaveData (decompressedQuests);

It threw the error: threw exception 'Input string was not in the correct format'

I hacked that value back to zero, and on next load, it all ran fine.

That was the only float value in the database I'm using with the dialogue system, have now converted it to an integer as I can predict the format of that.

Just thought it worth mentioning in case anyone else ever comes across it!

Re: Loading floats stored in scientific notation = Crash

Posted: Fri May 27, 2016 1:39 pm
by Tony Li
Hi Andrew,

Thanks for mentioning this. What version of the Dialogue System are you using? Prior to version 1.6.1, LuaInterpreter (the default implementation of Lua used in the Dialogue System) choked on negative exponents. But I'm not aware of any other issues with exponents. I'll definitely check this out today.

Re: Loading floats stored in scientific notation = Crash

Posted: Fri May 27, 2016 8:36 pm
by Tony Li
I just confirmed that LuaInterpreter has an issue with the plus sign in "1.307709E+07". It does accept ""1.307709E07" without the plus sign, but that's no help if it auto-generates floats with the plus sign. I'll make sure it's fixed for the next release.

Re: Loading floats stored in scientific notation = Crash

Posted: Sat May 28, 2016 1:14 am
by andrew2110
It only really came up as an error because a player fell through a floor in our game and it was counting that falling as distance travelled and ended up travelling 13 million meters. Glad it seems like there'll be a fix, have just switched to using integers for this game now as storing meters travelled with decimal points seems like overkill anyways! Thanks for the speedy investigation!