Wednesday, August 11, 2010

Client Side Prediction with jME3 & Mina

Recently I have been researching various topics related to networking and games. I've always understood the basic fundamentals and have implemented lower level networking for non-game related applications but games are  different. You have to deal with latency and all the issues related to that. So I did some more detailed research into client side prediction and dead reckoning algorithms. Below is a test video of a server and 3 client instances. You may be thinking "but your running everything locally so there is no latency". It's true that local connections have almost no latency but the server is running at 8 FPS and the client is running at 60 FPS. Based off the clients last known information about the objects position, rotation, angular and linear velocity it makes a decent guess as to where the objects should be in the following frames before the sever sends another update.

The client and server are both using jME3 for the scenegraph and/or rendering and Mina for the low level NIO networking. If I ever have to write lower level code again to deal with selectors it will be too soon.