To give a bit of background, I'm developing an MMO in the web browser. Crazy? Yes, but it certainly isn't impossible. The server sends updates to the client by means of long-polling JSONp tags which are opened in advance and marked for updates to be sent at a certain timestamp.
The problem is that you simply can't pump too much information into a browser. At some point, there's a barrier as to both the speed and quantity of information that you can send, so I'm looking to implement some type of system that would allow the server to send periodic updates of remote users' positions rather than "realtime" updates. Is there any reliable way of doing this without shooting myself in the foot?
I've read about a heuristics technique that analyzes the motion of a player over time to generate a function which could be used to simulate the player's pathfinding "technique". This would then be used to interpolate the position of the remote player between updates. Any thoughts on this or another technique I could use?
Answer
Optimizing mmo network performance does indeed come down to movement prediction. Luckily there are a few different strategies you can use in your MMO with regards to movement, and some of them are much easier to predict than others.
If at all possible don't worry about where players ARE, worry about where they are going. Let's say your game has some sort of point and click interface where a player picks where they are going. This makes perfect sense for a mouse-driven MMO. In this case you do not have to update periodically with their current location. Instead, you just need to tell every client where each player is heading and when they expect to get there (and maybe some pathing info if you need it). You can then animate it entirely on the client. If a player changes their mind you can then send updated info to the clients. there may be a bit of rubber banding, but without direct player control it won't be noticeable. This approach can even be used in crazy physics environments, as much of Eve's motion is predicted on the client using complicated math.
If it's absolutely vital that your players must have direct movement control, you're then going to need fps-style movement prediction. This is probably overkill for any sort of web-based MMO (are your players really using controllers or wasd to move?), but you will need it if collision is important. In this case you end up doing a much more complicated version of the above, where the client will attempt to determine where a player is heading based on the position and velocity of a player that is sent down over the network. But the prediction errors here will feel much worse, especially in a laggy environment. Stay away from this method if at all possible.
No comments:
Post a Comment