Game Development Community

Floating point precision errors within gigantic landscapes

by Cor Schols · in Torque Game Engine · 12/04/2008 (6:57 pm) · 1 replies

Hello,

I'm currently thinking of acquiring a license for TGEA. However, I would like to know one thing on forehand:

How does TGEA deal with floating point precision errors in gigantic paged landscapes? Or better I should ask: how does TGEA handle all positioning and coordinates within gigantic landscapes?

Imagine a landscape, existing out of tens-of-thousands of patches vertically aswell as horizontally. One patch would be 512x512 tiles in size. Coordinates would never be able to fit within a 32-bit integer, of within a floating point (precision errors). How does TGEA handle this type of thing? Does the landscaping engine offer custom / extended coordinates? (e.g.: (TerrainPatch, X, Y, Z)

A numeric example - obviously impossible:
Obj1.Pos : (X = -3242984375934324, Y = 2394820348203948204829482034, Z = 17389)
Obj2.Pos : (X = 89898999989899993, Y = -9498989080099809999999222110, Z = 238)

Example of possible solution:
Obj1.Pos : (Patch = 8499, X = 2349, Y = 34, Z = 17389)
Obj2.Pos : (Patch = 7584953, X = 12, Y = 2384, Z = 238)


Am I required to device a custom solution myself to extend the terrain engine, or is there built in support?
Or am I supposed to split up the terrain in zones, eventhough it is said that the landscaping engine supports virtually endless terrain - limitted by disk space only?

An answer, or a valid link to existing information would be appreciated. Couldn't find any so far.


Kind regards,
Coriiander

About the author

Recent Threads


#1
12/04/2008 (7:21 pm)
You'll have issues with very large worlds for the exact reason you mentioned, yes.
The larger your positional coordinate numbers are, the less exact it gets. You could obviously bump this up to 64 bits, but that'll only delay a problem you'll eventually face anyway.

It's better to divide your zone into areas with local coordinate systems, but as you observed this is something you'd have to implement yourself, and probably it doesn't matter what engine you pick here in this particular case.