Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Can one explain the specifics and details of a netplay framework for a game that optimizes connection through a "prediction / rollback" mechanic, as seen in games where speed is a priority (first-person shooters, modern fighting games since Street Fighter IV, etc)?

I have previously studied this article as an example: Source Multiplayer Networking, which describes Valve's techniques used in their shooters on a high, abstract level. However, it is simply too high-level and theoretical to be of use to me. Other similar articles follow this same pattern; none offer code samples or working examples.

I have previously crafted netplay systems that use unoptimized TCP/IP, which is obviously horrendously slow and non-useful for anything except LAN play. Although I have taken a college course on network programming, I am only confident and experienced enough to have made this system through approximate copying of other pre-existing code.

share|improve this question
2  
resource requests are not quite welcome at Programmers. As far as I understand, one would rather present an underlying problem instead - a problem that was intended to be solved with particular resource requested –  gnat Mar 11 '13 at 5:59
    
Given an understanding "conceptually and theoretically," what's stopping you from writing your own? If there's something you don't understand, ask here or on SO, depending on the nature of the question. –  Caleb Mar 11 '13 at 6:23
    
@Caleb I am simply not skilled enough to create something of this nature and complexity from the simplistic information I have read thus far. –  Southpaw Hare Mar 11 '13 at 12:00
1  
Looks like a good question to me. And I have a good explanation so let's reopen. –  Mike Brown Mar 11 '13 at 19:49
2  
Place holder until I can answer. This is how MPEG compression works, it predicts possible changes based on a previous frame. Follow up frames end up being mostly diffs off the previous frames. In a similar way rather than having to synchronize every action across all the clients, the host makes predictions about next frames (aided by facts it knows about the world -- this rocket will travel straight until it hits something) and the clients do the same. The clients receive differences (player a changed direction) and "key frame" updates from the server and synchronize their state to that. –  Mike Brown Mar 11 '13 at 19:55

1 Answer 1

up vote 2 down vote accepted

Prediction/rollback algorithms work similar to MPEG compression. MPEG predicts possible changes based on a previous frame. Follow up frames end up being mostly diffs off the previous frames. When there is a major change...or every so often a Keyframe is encoded to synchronize the true decompressed image with the actuals.

In a similar way rather than having to synchronize every action across all the clients, the host makes predictions about next frames (aided by facts it knows about the world -- this rocket will travel straight until it hits something) and the clients do the same.

The clients receive differences (player a changed direction) in the form of raw input and "key frame" updates from the server and synchronize their state to that. Sending input operations to the clients and a full synchronization every so often from the server decreases the chatter while still allowing the server to be the "master" of state.

I can't remember where I read this article that gave me an good understanding of the technique (either Gamasutra or one of the Game Programming Gems series), but it discusses how this was an improvement of the network stack between Doom 2 and Quake. I did find a nice example in C# that shows a Prediction algorithm that you can build on.

Here is a similar question on Gamedev about that very topic

share|improve this answer
    
This is a bit helpful. It's still intimidating, but worth a shot from this angle... –  Southpaw Hare Mar 13 '13 at 4:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.