Firstly Fredbill you are wrong, TCP guarantees packets to be in the correct order. Secondly this has been done before the game I want to make is something like runescape which runs completely on TCP their is no UDP involved for runescape. If you type in moparscape.org you can actually get a client and a server of their old runescape editions and it runs perfectly fine.
If I was making a 1st person shooter then I can understand why TCP wouldn't be reliable. But in this case I think its more than acceptable because it saves all the extra work of writing on top of UDP to get it to deliver lost packets, packets in the correct order ect ect.
Its crazy how this discussion ended up with all these posts all I want to know is if a global stream and a local stream is a good idea. The local stream only passes to the client while the global stream passes to all clients so it loops through all the players and sends data through their sockets
Firstly Fredbill you are wrong, TCP guarantees packets to be in the correct order.
Yea, I got that from previous posts... somewhere I've read recently claimed that it wasn't, and I assumed that it was true.
Its crazy how this discussion ended up with all these posts all I want to know is if a global stream and a local stream is a good idea. The local stream only passes to the client while the global stream passes to all clients so it loops through all the players and sends data through their sockets
In games, packets not arriving in order are not very necessary, and lost packets do not effect gameplay at any scale (losing packets is not common anyways). We're trying to tell you that TCP is not useful in this situation. I feel that neither is acceptable.
But if you still want to use TCP, I'd say use a local stream with threads.
IF. you really want to use TCP, IMO, threads are a must.
Global/local sockets? Just no.
Write an intermediate class that, when required, writes data to all or a single stream.
Personally I have three modalities to send data:
To everyone (aka Broadcast), To a single user, or to all BUT a single user.
But you shouldn't begin with broadcast in mind.
Make a 1-to-1 stream class, then a GameState-ish class that keeps track of all users and allows you to send data to a single user.
Done that, make a broadcasting function.
Now I'm not bothering with code and the last couple posts but I am getting annoyed with the people suggesting Raknet. The OP said he wanted to learn while using Winsock so even though I have very little to bother with this it is annoying me that either no one is reading the first couple posts or is being pretty ignorant (not meaning to be mean about it) to the OP. I am just saying please don't suggest something if the OP said he doesn't want to use.
Also don't bother telling me anything. I don't care about talking past this but I got annoyed when I come across this and at least 3 times someone said something the OP already said no to. DO NOT say anything about this post. ONLY read it.
Also don't bother telling me anything. I don't care about talking past this but I got annoyed when I come across this and at least 3 times someone said something the OP already said no to. DO NOT say anything about this post. ONLY read it.
Here's a free clue: on a public forum, you don't get to dictate to other people whether or not they are allowed to reply to what you say. You're no-one special. Your posts are subject to being discussed or disagreed with, just as much as anyone else's.