Sorry but you seem to contradict yourself. If a reliable ordered stream is not what games usually need (and I agree with that statement), there's no point in trying to "mimic" TCP with some custom protocol built on top of UDP. |
I don't see where I contradicted myself, but I see where the confusion might lie. You don't want to mimic TCP exactly to the tee, instead you will mimic the features of TCP that you need (Either using the same implementations for the feature or coding a custom one that suits your needs better), and leave out those that you don't.
Basically what I mean is that you are creating your own custom protocol over UDP that has all (That are relevant) the benefits that TCP provides to games without the downfalls.
If you just want to have the most recent data as quickly as possible, UDP is all you need. |
No UDP alone will be no where near functional for pretty much most games.
Can you give an example of a TCP functionality that can be "cherry-picked" this way, without making the protocol as slow as TCP? |
1. Sure, you will definitely want the virtual connection functionality of TCP so that is one thing that you will code over UDP.
2. Trying mimic the reliability of TCP but doing it without a stream which causes the packet backups. This is one main aspect where we want some of the reliability features that TCP provides without the downfalls mentioned before.
There is many ways to code this and a lot of them depend on the project. Some thing included are packet ID's, arrival acknowledgements, handling lost packets, ect. Some will be coded basically the same as with TCP some will be drastically different.
3. We also want to implement flow control like TCP does so that we can dynamically scale the rate of data sent based on the connection.
What I was saying earlier is that if the game is using TCP, it may be very hard to change it to use UDP, because the game may assume it is using a reliable ordered stream. And it may be buggy if some data is lost or received in wrong order. |
Ya that is true, sorry about going a bit off topic there just wanted to point out that custom protocols built on top of UDP will not be just as slow as the TCP protocol.