Back in 2001 I was working on a PS2 game which was a combat flight simulator. I was responsible for the flight physics and player controls. One day I left the game playing and the PS2 controller on the desk while I got on with some coding. After a while I looked up to see the on screen representation of the aircraft shaking itself to pieces. It was a puzzle, nobody could figure out why it was doing this. So we repeated the test over and over again with the same results. We eventually discovered what it was. The aircraft had been flying through the virtual world and its position was now at the extreme edges that could be represented by a floating point number so what we were seeing was an error in precision of floating point numbers. For that particular game this was not an issue because once all of the elements of the game were in place the player could never reach those edges. This does however present a problem with Xiotex. When flying through the world after a while rotation starts to get a bit 'jerky' and the reason for this is the same as the PS2 game. The solution is easy though and it involves translating from one coordinate space into another which is local around 0,0,0.
The only visual thing added to the game recently is the draft 'targeting reticule' which is represented by another piece of amazing coder art. The player uses this to target items and AI in the world to get more information or to attack them. I had originally played with a roaming reticule that matched the location of an AI object but it didn't really work that well so I am sticking with a centrally placed system until something better comes to mind. Having the reticule in a consistent central position does present an interesting design challenge though. I want the player to be able to use it to discover what type of AI they are pointing at, it's level, its shield charge and what kind of cargo it is carrying. With the roaming reticule this was easy because the player could use the mouse pointer to click on the object they want to find out about and the reticule would follow that object but now it is central the mouse pointer clicking does not feel the same so I have to come up with another method such as always ray-casting down the centre point of the screen to match with whatever is in the central line or do a sort of auto lock on to the closest object. The ray-cast idea can cause problems with smaller object that might move in and out of the ray-cast at frequent intervals but that can be solved by keeping an object's information in place for a minimum amount of time.
Xiotex - Coder art, reticule and floating point errors
The joys of floating-point... a friend of mine was working on a space sim at one point (not sure whether it's properly abandoned yet ) and had to do some quite extensive hackery to get smooth movement of small craft yet still maintain massive render distance for distant planetary bodies.
Also, mmmmmm, programmer art.
Also, mmmmmm, programmer art.
If "the origin" doesn't have any particularly awesome meaning for a set of numbers you're storing, you should be using fixed-point instead of floats. Examples include world coordinates and game time. 64-bit fixed-point support is very fast, ubiquitous, and has totally reliable precision - there's no "magic spot" where stuff works differently, and it's got massive range and precision. Whereas float64 support is crap and slow, and float32 has precision with a mind of its own.
I seem to recall a rant about this topic [url]http://www.eelpi.gotdns.org/blog.wiki.html#[[A%20matter%20of%20precision]][/url]
I seem to recall a rant about this topic [url]http://www.eelpi.gotdns.org/blog.wiki.html#[[A%20matter%20of%20precision]][/url]
TomF wrote:If "the origin" doesn't have any particularly awesome meaning for a set of numbers you're storing, you should be using fixed-point instead of floats. Examples include world coordinates and game time. 64-bit fixed-point support is very fast, ubiquitous, and has totally reliable precision - there's no "magic spot" where stuff works differently, and it's got massive range and precision. Whereas float64 support is crap and slow, and float32 has precision with a mind of its own.
I seem to recall a rant about this topic [url]http://www.eelpi.gotdns.org/blog.wiki.html#[[A%20matter%20of%20precision]][/url]
Tom! Long time since we last talked (2005 I think). As usual, excellent article and it has certainly given me cause to re-think what I am doing. Now I am going to have to go and write a whole heap of fixed point classes.
Vendetta Online has this issue, but its so subtle that it takes a week of flying straight at top speed for it to appear. Also, the more I look at this, the more it reminds me of a LAN demo of a game in progress called Parsec. It was meant to be a multiplayer space fight game, but the production was stopped. If you want the source code, its right here. Its C++ from 2003, so its changed a lot, but it may give you ideas!
Who is online
Users browsing this forum: No registered users and 9 guests