Here is - TCP 2D Code

Community Forums/Showcase/Here is - TCP 2D Code

Xzider(Posted 2006) [#1]
I took the time out to code this to "heyyouimintojesus",so he could learn off of it,now im releasing it to everyone if they want it.To people new to TCP.This is NOT commented,but i will give support if you email me at Leaedas_Treehopper@... , again , study the code.

http://www.sitesled.com/members/xelev/OnlineTest.zip

Features :
Enter your name
Pop up in game as a pink stickman
Name above your head
If somone else joins,pop him up too with name above his head
you can walk around and see people walk around


Steven Noyce(Posted 2006) [#2]
Does using TCP instead of UDP slow it down at all? What I mean is, have you checked to see how long after something is done on one computer before it actually happens on another computer?

I have not used TCP before, but I was using direct play and the slowdown was about 9 seconds per minute you kept playing the game. When you first start the game, everything updates instantly on all computers, and seems to be working fine, but as you keep playing, the network slows down. The frame rate stays the same on all computers, but it takes a while for a movement done on one computer to happen on another.

I was just working on transferring to UDP so that it would be faster, but TCP seems easier so if it is not very much slower than UDP that would make things easier for me!


Bouncer(Posted 2006) [#3]
I tested it out with 2 clients and the delay is unbeleviable even for transferring a few co-oords...


Damien Sturdy(Posted 2006) [#4]
BlitzNerd:

Use UDP wih careful programming.TCP causes the system to wait for a response- UDP just sends it and the game continues without waiting.


Xzider(Posted 2006) [#5]
Delay depends on computer/network speeds. If you use dial-up TCP is not for you;)


Bouncer(Posted 2006) [#6]
I have 8mb broadband, so I don't think that my network speed is the issue... I ran the 2 clients on the same machine btw...


Xzider(Posted 2006) [#7]
yeah..Well, I havnt heard anyone else with this problem..I know it happens to people with bad internet:) But it works fine with me..There is a 500MS delay,thats already built in the code for smooth moving,if thats what you mean.


Steven Noyce(Posted 2006) [#8]
To use UDP, could I basically just replace the TCP commands with the corresponding UDP command? Or would I have to change other things as well?


Chevron(Posted 2006) [#9]
Using TCP is fine for certain applications, where the data transfer has to be exact, such as Chat, file transfer programs, or games where speed is not an issue such as a board game.

Any arcade/action realtime game will need to use udp and even using this takes a lot of clever coding to acheive anywhere near aceptable results, regardless of connection speed.


Xzider(Posted 2006) [#10]
UDP sucks in my opinion.I just love TCP, WoW uses TCP,and it looks fine to me.I believe Everquest 2 does too


Damien Sturdy(Posted 2006) [#11]
TCP would be more usable in blitz if blitz didn't halt when waiting for a response. WOW etc doesnt halt, it checks in the background for a response. That allows the game to continue while things are occuring.

TCP's wait time makes it slow.