Synchronicity!


Well, making steady progress but it's still not great. A few problems have cropped up:

1- planets aren't synchronized properly. I should have seen this coming, it's not hard to fix but the basic problem is that the game is run through an update cycle that is clamped to a certain time range (for sanity's sake, so I'm not updating physics with some huge N = 50 timestep or something when the game goes and generates something; this should be better when generation/loading is threaded but for now...) So what happens is the planetary orbits are synchronized to game time, BUT, then they are updated according to the throttled timeslice. I think what I will do instead is have them keep their own time, they can just as easily call SDL_GetTick or whatever the function is. I can then add another synchronization layer with the game clock, or just leave it like that (I think I'll probably just leave it like that). If I don't do all this, then what can happen is due to differing load times, two players may be on the same planet at the same time, but it will look like night or day to them.

2- zones... arrgh! Well, what I need to do is change how I'm transmitting coordinates (again!) This is also due mainly to planetary lag, which even once I have it synced there will still be some. The beauty of the zone system is that coordinates for planets are specified in some fixed way, so that when you are on a planet, the universe is actually moving, and vice-versa when you are off of a planet. Anyhow, what I am doing now is transmitting ship coordinates in system space, and I need to change it to zone space. This was a problem before for a few reasons, but I think it can be fixed now. What I will do is transmit coordinates zone-relative. I will only set zone coordinates when they change, and the zone coordinate package will include local coordinates. Well, maybe what I need to do is implement command-streams on the object links. When there is a change of zones I can send that as a command, and I know it will arrive before the parameters. Otherwise there is a potential that I'll get the zone information out of sync with the coordinate information, well I don't know. I guess there are a few workable approaches, I can see at least two.

3- stupid NaN! This time, i'm getting a nan force applied but I don't even think there should be any forces applied at all. So it's time to try and get a reproducable situation, and insert an assert-fail so that I can get a traceback, that should give me better idea. Grrr...

2004-05-01


◀ Back