Loading floats stored in scientific notation = Crash

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
andrew2110
Posts: 39
Joined: Wed Sep 03, 2014 2:44 am

Loading floats stored in scientific notation = Crash

Post 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!
User avatar
Tony Li
Posts: 22100
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading floats stored in scientific notation = Crash

Post 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.
User avatar
Tony Li
Posts: 22100
Joined: Thu Jul 18, 2013 1:27 pm

Re: Loading floats stored in scientific notation = Crash

Post 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.
andrew2110
Posts: 39
Joined: Wed Sep 03, 2014 2:44 am

Re: Loading floats stored in scientific notation = Crash

Post 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!
Post Reply