   representing spatial data
  Just about any game will have classes for various geometric objects, points, lines, polylines, rectangles etc. When using these classes to represent stuff in "real" space, are the underlying variables generally int, float, or double?This is possibly a silly question. I'm working on a 2D project, at the moment it uses ints to represent stuff in screen space, positions in real space are floats which just represent meters, not that the exact units are very important except maybe for things like spell area of effect descriptions. Real space is converted to screen space by subtracting a camera offset, applying a scale factor and then rounding off.This seemed the obvious way but I got to thinking about whether I could actually use ints for real space. If the units were something like tenths of a millimeter that should be more than enough precision for the size of my areas. I understand floats have issues with equality testing, and operations are less likely to be deterministic which may be important for multiplayer games. It's hard to see if these issues are actually going to be important at this stage though, I'm quite interested in programming large scale games which I would think might make determinism necessary. Also I can't quite figure out whether you can actually get by with only ints, for example it's very convenient to represent directions with normalised vectors so I'd think that floats would tend to creep back in.I can't think of any reason to go with doubles unless your game world is open and massive. On the face of it you'd think they would be slower, though interestingly I've heard people say that this isn't really generally true any more.Another question is do people generally use templates when writing classes for things like Points, Rectangles etc? So instead of having different classes Point3d, Point3i, Point3f just have Point<int> etc? The only downside I can see is having to keep everything in a header file could slow things down for classes that have to be updated often.Also, are there any good free C++ geometry libraries out there for game developers? I suppose it's the kind of thing that people package as part of game engines, of which there seem to be a lot.   
  doubles can provide double the precision so it's not just a case of whether you need a bigger value for larger world coords. I don't know much about floating-point hardware but i would say the difference in speed between doubles and floats is negligible.   