| Mirage Source http://web.miragesource.net/forums/ |
|
| UDP/TCP Hybrid Game http://web.miragesource.net/forums/viewtopic.php?f=210&t=1462 |
Page 1 of 1 |
| Author: | Matt2 [ Wed Mar 07, 2007 9:58 pm ] |
| Post subject: | UDP/TCP Hybrid Game |
I don't know where I read this, or if it's even on this forums. All I know is that, I got the idea to try and mix the two up. I've gotten some comparisons and reading done. I know it's been done, for the article I read on it said so, but I want to try and implement that onto MS. I'm sure, by now, we all know the difference between TCP and UDP. TCP being reliable but slow, and UDP being unreliable but fast. But for those who don't know why, here are the comparisons taken from Wikipedia: Quote: Difference between TCP and UDP
TCP is a connection-oriented protocol, a connection can be made from client to server, and from then on any data can be sent along that connection. Reliable - when you send a message along a TCP socket, you know it will get there unless the connection fails completely. If it gets lost along the way, the server will re-request the lost part. This means complete integrity; things don't get corrupted. Ordered - if you send two messages along a connection, one after the other, you know the first message will get there first. You don't have to worry about data arriving in the wrong order. Heavyweight - when the low level parts of the TCP "stream" arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together. Streaming - Data is read as a "stream," with nothing distinguishing where one packet ends and another begins. May be multiple packets per read call. UDP is a simpler message-based connectionless protocol. With UDP you send messages(packets) across the network in chunks. Unreliable - When you send a message, you don't know if it'll get there, it could get lost along the way. Not ordered - If you send two messages out, you don't know what order they'll arrive in. Lightweight - No ordering of messages, no tracking connections, etc. It's just "fire and forget"! This means it's a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets. Datagrams - Packets are sent individually and are guaranteed to be whole if they arrive. One packet per one read call. The idea of using UDP to replace TCP is insane! But, using UDP to send packets that don't really matter as much, might be a better approach at making a faster game, reducing the 'stream', as it's refered to, of data. I am currently working on research and seeing if it could even be done to Visual Basic. It should, so, using it for MS would help, no? Especially for things like player movement. Anyways, keep checking back. I will be updating this post with my finds, and if I fully implement it, I will be updating with the code. Thank you guys for reading! I hope this helped some of you understand UDP better, and also understand TCP as well! |
|
| Author: | Robin [ Wed Mar 07, 2007 10:05 pm ] |
| Post subject: | |
Using it for 'less important' packets? That's gonna be a bitch when trying to do something. |
|
| Author: | Matt2 [ Wed Mar 07, 2007 10:31 pm ] |
| Post subject: | |
I'll have to work on that part... -.- |
|
| Author: | William [ Wed Mar 07, 2007 10:46 pm ] |
| Post subject: | |
Moved to Knowledge Base. |
|
| Author: | Coke [ Thu Mar 08, 2007 12:22 am ] |
| Post subject: | |
Well to be honest the way things are going, i dont think uber speedy packets and such are going to be that important on a program such as MS. PC's are getting more powerfull, internet speeds are getting faster... I wish we could learn what kind of systems WoW and Guild wars use, especially Wow; so many packets must be being sent its insane o.0 |
|
| Author: | Spodi [ Thu Mar 08, 2007 12:57 am ] |
| Post subject: | |
WoW uses TCP. TCP/UDP hybrids are hardly worth it for a 2d ORPG. Many 3d MMORPGs use TCP. The packet speed isn't that important, just fluency and smoothness. |
|
| Author: | Verrigan [ Thu Mar 08, 2007 5:25 am ] |
| Post subject: | |
Asheron's Call uses some UDP packets.. If you're sending a player's health to them every 5-10 seconds.. It's not really going to matter much if they lose one of those packets. |
|
| Author: | Spodi [ Thu Mar 08, 2007 6:55 am ] |
| Post subject: | |
But then again, its probably a poor network structuring to be sending them their health every 5-10 seconds. You could do it for values like positioning and stats and such, but a lot would probably just go to waste. I may just think too much in a TCP style, though, since thats what I use from day-to-day. If you work at it hard so you can support packets coming in the wrong order, a reliable UDP would be nice, since then you can throw in that the TCP/IPv4 headers are 40 bytes while UDP/IPv4 are only 28 per packet, plus the UDP would be getting there faster (just not in order as often). Either way, overkill for MS. |
|
| Author: | Coke [ Thu Mar 08, 2007 7:29 am ] |
| Post subject: | |
What if key points are 'flagged' in the code, for example all the instances where a players health could change, i am all for sending packets only when needed... packet spamming makes me want to cry, but sending packets on the event is so tedious... Sub PlayerHPChange() for the win xP |
|
| Author: | Spodi [ Thu Mar 08, 2007 3:13 pm ] |
| Post subject: | |
Thats what I did, and it seems to work pretty well. Keep a variable for every stat that needs to be updated when it changes. Every time you assign a value to the stat, check if it is a new value. If so, set the changed flag to true. Then, every few hundred milisecs, check through all the variables and see if you need to update. |
|
| Author: | Coke [ Thu Mar 08, 2007 7:54 pm ] |
| Post subject: | |
Would you be able to give me a code overview of how you have done that? Sounds quite effective |
|
| Author: | Spodi [ Thu Mar 08, 2007 11:37 pm ] |
| Post subject: | |
Well you can just check vbGORE's server code. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|