Results 1 to 9 of 9

Thread: TCP or UDP

  1. #1

    TCP or UDP

    Hello,

    I am developing a simple online card game. What do you think is the best method? using TCP or UDP?

    I plan to add a chat room also in the game. The game will consist 4 players.

    What is a good network component for this kind of games? I plan to use INDY. Any other better one?

    Thank you

  2. #2
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    TCP or UDP

    Indy is a pretty good one. It even works for Lazarus I believe...?

    If you wanted to try something else there is a SDL_net component that JEDI-SDL supports.
    Jason McMillen
    Pascal Game Development
    Co-Founder





  3. #3

    Re: TCP or UDP

    Quote Originally Posted by jamesa
    Hello,

    I am developing a simple online card game. What do you think is the best method? using TCP or UDP?
    A card game doesn't suffer for a little latency, so i suggest you to use TCP, which is easier and reliable.

    What is a good network component for this kind of games? I plan to use INDY. Any other better one?
    Well, Indy or manual socket If you don't have particular needs i suggest you to use Indy.
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  4. #4

    TCP or UDP

    Thanks for the information, yes I agree that for card game we can use TCP without any problem.

    But one thing that concern me, for general online game, is problem with NAT router/firewall.

    Player behind NAT router is not easy to "create game" (hosting online game). Traditionally, this needs to setup port forwarding in the NAT router, to redirect incomming packet to the local ip address of the hosted game.

    I read several articles about a solution for this particular problem:

    http://www.mindcontrol.org/~hplus/nat-punch.html
    http://midcom-p2p.sourceforge.net

    Basically it uses a third server, "INTRODUCER" to help.

    I quite understood the concept, but I cant get my experiment work:

    I tried to host a UDP server behind a NAT router.

    (1) I put a UDP SERVER_1 on Port 5000 on local IP address 10.0.0.1

    (2) A NAT_Router act as gateway, IP address 100.0.0.1 (public ip)

    (3) UDP SERVER_2 on Port 5000, IP address 100.0.0.2 (public ip). This is the INTRODUCER service.

    (4) UDP SERVER_3 on Port 5000, IP address 100.0.0.3 (public ip).

    ....

    SERVER_1 sent data to SERVER_2.
    SERVER_2 will get the IP address of the NAT_Router.

    Using this information, why SERVER_3 can not send any data SERVER_1 ? Because I assumed, after SERVER_1 sent data to SERVER_2, the NAT_Router will create a translation table that will redirect incoming connection on port 5000 to SERVER_1

    Anyone has implemented this using Delphi ?

    Thanks.

  5. #5

    Re: TCP or UDP

    Quote Originally Posted by {MSX}
    Quote Originally Posted by jamesa
    Hello,

    I am developing a simple online card game. What do you think is the best method? using TCP or UDP?
    A card game doesn't suffer for a little latency, so i suggest you to use TCP, which is easier and reliable.
    Easier you say? I would say they are even. They just work a bit differently. UDP doesn't need to keep connection so there's no client list. UDP sends faster but doesn't resend if packets get lost or come corrupted.

    I'm using totally free component WSockets, which provides TCP and UDP client and server for both. Earlier used SimpleSockets2, but found this one better and more reliable.

  6. #6

    TCP or UDP

    i think asphyres net component uses udp and internally resends packages plus it gives you the benefit of compression.

  7. #7
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    TCP or UDP

    User137, do you have a link to the WSockets component package that you use?
    Jason McMillen
    Pascal Game Development
    Co-Founder





  8. #8

  9. #9

    TCP or UDP

    There is also Synapse
    http://z505.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •