64-bit integer instead of float in multiplayer games is a good idea?

Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Dedication to the community
Süper Üye
Katılım
10 Haz 2019
Mesajlar
614
Tepki puanı
54
Ödüller
7
Yaş
28
6 HİZMET YILI
64Bit is good but your computer needs more than 8gb of ram
 
Süper Üye
Katılım
15 May 2019
Mesajlar
664
Çözümler
2
Tepki puanı
40
Ödüller
7
Yaş
25
7 HİZMET YILI
A float (32-bit) has a 23-bit mantissa, so at roughly 2^23 (about 8 million) it starts to not be able to represent each integer anymore. So if you assume that you want to place things in a game world at least at 1 millimeter precision, your largest game world that you can represent somewhat safely in floats is 8 kilometers along 1 dimension. That’s not bad actually, but a bit limiting.. and for precise physics 1mm may not be enough.

A double has 52 bit mantissa (2^52 == 4503599627370496), so that is about 4 billion kilometers at 1mm precision, and generally much higher precision for smaller worlds than that.

Still, doubles are inherently non-linear in their precision, so using 64-bit integers representing millimeter or an even smaller unit may be desirable for storing world data.

Of course, as Jeff hints at, you can also store things as 2 numbers, e.g. a 32-bit int for a world cell, and then a float to represent an offset inside that cell.

Then, when you’re ready to do some heavy calculations for physics or graphics, first translate all coordinates involved to be relative to the current cell, entity, or player, after which you can safely convert to float since all coordinates typically will be small.
 
Pooking
Süper Üye
Katılım
20 May 2022
Mesajlar
709
Tepki puanı
90
Ödüller
3
4 HİZMET YILI
64bit use pretty much RAM and slow the calculate down
 
Onaylı Üye
Katılım
30 Eki 2022
Mesajlar
64
Tepki puanı
2
Yaş
29
3 HİZMET YILI
I think you should use strings to not lose the accuracy, and then parse it on the client-side, That's how gRPC big int works for example
 
Üye
Katılım
1 Kas 2022
Mesajlar
48
Tepki puanı
4
Yaş
25
3 HİZMET YILI
int de 64 usa muita RAM não acho muito viavel não
 
Onaylı Üye
Katılım
25 Mar 2022
Mesajlar
52
Çözümler
1
Tepki puanı
4
4 HİZMET YILI
me using 12GB ram its fine for me, and 64GB a lots
 
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...
Üst