Implement UDP reliability, clean code

Implement reliable and ordered UDP message sending. Messages that aren't ACK'd will be retransmitted.

Refactor code to replace the player references by pointers, removing the ugly refreshing hacks.

Other minor changes.

WARNING: A lot of things were changed without much testing. May be buggy.