The (hopefully) final version of my guaranteed delivery datagrams code is available on GitHub. This version is smaller, faster and simpler than all my previous attempts and after doing a lot of stress-testing, I am confident if is bug free (modulo some unforeseen corner case. It helps that the code is really simple).
This can be used for any games that needs to use datagrams and do not want to deal with the fact that some datagrams might not be delivered. It works reliably even for big datagrams. The license is Apache 2.0 so, basically, go nuts with it.
There are a couple of caveats though:
- It uses a considerable amount of memory as I have to keep track of per-face datagrams. This can be mitigated by breaking your games into functions with local variables whenever possible and only using globals for things that can not be done another way.
- It uses one byte in the datagram as a header. This means that the maximum datagram size is now 15 (instead of 16) and that the smallest datagram will be 2 bytes instead of one.
Let me know if you have any questions about it.