Search code examples
c#databasetcppacket

How to send information fast like many games do?


I'm thinking like the methods games like Counter Sstrike, WoW etc uses. In CS you often have just like 50 ping, is there any way to send information to an online MySQL database at that speed?

Currently I'm using an online PHP script which my program requests, but this is really slow, because the program first has to send headers and post-information to it, and then retrieve the result as an ordinary webpage.

There really have to be any easier, faster way of doing this? I've heard about TCP/IP, is this what I should use here? Is it possible for it to connect to the database in a faster way than indirectly via the PHP script?


Solution

  • TCP/IP is made up of three protocols:

    1. TCP
    2. UDP
    3. ICMP

    ICMP is what you are using when you ping another computer on a network.

    Games, like CounterStrike, don't care about what you previously did. So there's no requirement for completeness, to be able to reconstruct what you did (which is why competitors have to tape what they are doing). This is what UDP is used for - there's no guarantee that data is delivered or received. Which is why lag can be such a problem - you're already dead, you just didn't know it.

    TCP guarantees that data is sent and received. Slower than UDP.

    There are numerous things to be aware of to have a fast connection - less hops, etc.