Numbers changing
by Daniel Brown · in Torque Game Engine · 05/25/2005 (7:47 am) · 2 replies
Hey all,
I'm trying to send a new variable in the update stream for shapebase, but for some reason the number i tell it to be in the engine isnt the same as the number that comes up when I echo it?
I am using stream->writeSignedFloat and readSignedFloat, i write the number 60 but when its read its apparently 0.087 or 0.049 it changes from time to time. Any ideas?
I'm trying to send a new variable in the update stream for shapebase, but for some reason the number i tell it to be in the engine isnt the same as the number that comes up when I echo it?
I am using stream->writeSignedFloat and readSignedFloat, i write the number 60 but when its read its apparently 0.087 or 0.049 it changes from time to time. Any ideas?
About the author
#2
This means that you would have to be able to know on the sending end the exact range limit of your specific variable, and divide by a constant on the sending side (server), then multiply on the receiving side (client) to extract back out the exact number.
For development purposes, many times it's easier to just use read() and write() for float numbers (not optimized), and then optimize out at a later point to the more speedy signedFloat calls.
05/25/2005 (4:17 pm)
Additionally, write/read Float's are designed specifically (for optimization purposes) to require your float number to be between -1 and +1 (0 and 1 for unsigned).This means that you would have to be able to know on the sending end the exact range limit of your specific variable, and divide by a constant on the sending side (server), then multiply on the receiving side (client) to extract back out the exact number.
For development purposes, many times it's easier to just use read() and write() for float numbers (not optimized), and then optimize out at a later point to the more speedy signedFloat calls.
Torque Owner Chris Labombard
Premium Preferred