|
Monday, 14 July 2008 |
Hey guys,
I've recently decided to dive back into researching prediction for our game. If you hadn't noticed I opted to use Server-Side driving for now because it does collisions very accurately. Collisions between objects need to look very good and doing this through prediction usually always shows false-positives due to unstable pings.
You might say, "but TF2 has very good prediction". They have 2 things going for them. Slow paced movement and collisions between players happens client-side. The collisions between projectiles still happens server-side, so you might see false-positives at high pings from the grenades or rockets. The slow movement helps make your client-side player bumping better, but it is still always off by a few feet from what the server sees.
Collisions for Mario Kart require things to happen when you bump a player on the server, whether your about to squish them, hit them with the star, or just plain ram them. This causes events to happen, like stopping their velocity or tumbling at the exact moment both players make contact. It has to look believable.
How do other racing games do it? Every racing game I have seen to date always uses p2p networking. Meaning every player is connected to every other player. This removes the middle man (Server) and clients relate to each other. As you may have seen when someone lags oddities begin to happen, their kart does bigger turns, they start skipping, or doing weird things. Using a server does have it's advantages, the oddities can be removed, but we have to now consider the extra latency between Player1 -> Server -> Player2.
There is a technique called Extrapolate. This means to predict where a kart will be in the future using position data. This could be used for Server-Side driving, and extrapolating players on the client screen to match where it is on the server. This has a negative effect when you turn or go up ramps. It moves forward based on position, so you naturally get predicted into the wall or ground. One of the techniques I plan on trying is to calculate the curve based on 3 positions to try and accurately move along the circle of the turn the player is currently making. However this won't solve all our problems. I then have to detect collisions and move our kart client-side to obey collision rules with the world. Since i'll be forcing my kart to go towards a certain direction, it may not be consistent with what the server is doing, by moving smoothly along the surface, I may be punching the surface on client.
Then there is the client-side method of prediction, and extrapolating to the future on the server. I believe this might be our best bet. However the only limitation I have is not being able to move our physics object multiple times in one frame. The system for doing client-side prediction is a bit more advanced because I have to deal with dummy objects that follow the real objects. This is so I can use data I haven't seen my kart use to predict the Extrapolation curve on the dummy objects. There will be inconsistencies but as long as the server is just a collision detector and doesn't have 100% control over our location it could work.
As you can see the topic isn't an easy one. Prediction is a very guarded secret in the gaming world, so one has to develop their own method. I have however been talking with the makers of DIPRIP and Zero Gear about these prediction techniques and we may be helping each other out since we're all dealing with the same fundamental problem, racing and server-side model.
-Joel
|