3 ms·
Even in smaller applications this is incredibly relevant. I've recently written something that's meant to interface on a local area network, just controlling s
by jamal-kumar 5y ago
Even in smaller applications this is incredibly relevant.
I've recently written something that's meant to interface on a local area network, just controlling something on another computer, literally just one or two users at a time -- thing is the precision of floating points are a big thing here, and we have to consider that. So all of the bignum stuff had to stay server-side in C++ after much messing around doing math client side in javascript only to learn the hard way how completely broken that is. Fun fact - You can't maintain state when floats start to drift off of values they were supposed to land on due to javascript's crappy math libs
- xboxnolifes 5y agoJavascript can get messy even if you just need integers, since even naively used integers are stored as doubles. This means that sending a random 64-bit identifier from a server to a client and just trying to read it as an int can give the wrong value if you aren't careful.
- petrocrat 5y agoDid you try to use javascript's BigInt data type?
- jamal-kumar 5y agoI clearly stated we were working on floating points here, ones originally provided by the c++ application. There was a thought to just make everything into big integers here but for this particular application it really just was the realization that all of this stuff was better off server side anyways for state maintenance reasons
- andai 5y agoRecently I've been dabbling in developing online multiplayer games. After some agony trying to make the chaos go away (rewinding time, merging conflicting physics states...), I realized I could actually harness it by re-framing the product from something serious into something lighthearted (eg. making goofy physics the whole point of the game). At worst, it lowers the expectations (eg. relative to something serious/competitive where jankiness is unacceptable), and at best may actually produce laughter. I hope.
- jamal-kumar 5y agoI mean as long as you can keep it from crashing completely? Sounds fun
- rwallace 5y agoI'm curious, what problems did you have with JavaScript math? I had the impression it was bog standard IEEE 754 same as every other language nowadays, but I have never tried doing any serious calculation in that language.