UDP and float/double values - Java-Games
This is a discussion on UDP and float/double values - Java-Games ; Hi,
I've been working lately on a multiplayer module for a simulator, which
would require me to transmit 12 double values (96 bytes) as often as 10
times per second. Those values are needed in their full precision and
constantly ...
-
UDP and float/double values
Hi,
I've been working lately on a multiplayer module for a simulator, which
would require me to transmit 12 double values (96 bytes) as often as 10
times per second. Those values are needed in their full precision and
constantly change, so I can't dismiss them.
I know that passing directly float and double values can result in
unpredictable results, as there is no such thing as htons() for those
types. I would prefer not to transmit those values in a string format,
since it seems like a complete waste of bandwidth and precision.
Any suggestions?
-
Re: UDP and float/double values
Remy Villeneuve wrote:
> I know that passing directly float and double values can result in
> unpredictable results, as there is no such thing as htons() for those
> types. I would prefer not to transmit those values in a string
format,
> since it seems like a complete waste of bandwidth and precision.
>
> Any suggestions?
Represent every float/double as 2x integers. One for the integer part
and one for the fractional part...?
T
-
Re: UDP and float/double values
T wrote:
> Remy Villeneuve wrote:
>
>>I know that passing directly float and double values can result in
>>unpredictable results, as there is no such thing as htons() for those
>>types.
Sure there are. Look up "htonf" and "htond". FlightGear, for
one, uses those.
John Nagle
Similar Threads
-
By Application Development in forum labview
Replies: 0
Last Post: 12-06-2007, 10:10 AM
-
By Application Development in forum c++
Replies: 1
Last Post: 06-08-2007, 02:51 PM
-
By Application Development in forum DOTNET
Replies: 2
Last Post: 04-28-2007, 05:10 PM
-
By Application Development in forum Graphics
Replies: 19
Last Post: 10-04-2006, 02:44 PM
-
By Application Development in forum Java
Replies: 3
Last Post: 11-07-2003, 07:04 PM