[QUOTE=iPope;31054013]I propose we do an experiment with the next thread, where every post has to be content based. No discussion, just content. Would be interesting to see if people make more progress.[/QUOTE]
Oh god that thread would never end
Just like that song that we dare not speak up or else the post will be mobius long
We should make a Programmers-Chat-Thread!
We should join the IRC channel.
Or the FP Programmer's chat on Steam.
Is there a special FP Programmer's Group?
[QUOTE=Staneh;31054538]Is there a special FP Programmer's Group?[/QUOTE]
[url]http://steamcommunity.com/groups/FP_Programmers[/url]
[QUOTE=Staneh;31054143]We should make a Programmers-Chat-Thread![/QUOTE]
[url]http://www.facepunch.com/threads/1035562-Programmers-of-Facepunch-Chat-Volume-1?highlight=[/url]
[QUOTE=Dr Magnusson;31054383]Or the FP Programmer's chat on Steam.[/QUOTE]
That place is waaay better than waywo nowadays anyways.
[QUOTE=Staneh;31054143]We should make a Programmers-Chat-Thread![/QUOTE]
We would get people coming in "So what is programming exactly....?"
...and then I had a new avatar.
Started learning some Objective-C for making an iOs game because my boss said to. And my god, Obj-C is just downright horrible and unpleasant to look at.
[editline]11th July 2011[/editline]
Kay. Objective-C made me not want to program anymore. Why does MonoTouch cost money?
[QUOTE=NorthernGate;31055123]Started learning some Objective-C for making an iOs game because my boss said to. And my god, Obj-C is just downright horrible and unpleasant to look at.
[editline]11th July 2011[/editline]
Kay. Objective-C made me not want to program anymore. Why does MonoTouch cost money?[/QUOTE]
Give it time, It will grow on you.
[QUOTE=CDeansy;31055228]Give it time, It will grow on you.[/QUOTE]
Objective-C is a horrible language, it's a horrible amalgamation of two different syntaxes
[QUOTE=CDeansy;31055228]Give it time, It will grow on you.[/QUOTE]
If it's horrible to read, I don't want it growing on me; people will start disliking me D:
How could anybody possibly dislike the legendary chad mobile.
[QUOTE=CDeansy;31055228]Give it time, It will grow on you.[/QUOTE]
That's what you told Neo and look what happened to him:
[img]http://1.bp.blogspot.com/_f0bvyZMrZ9k/S5BGaZA5eZI/AAAAAAAAEL0/qTgHUoNbt3g/s400/neo_matrix.jpg[/img]
[img]http://i434.photobucket.com/albums/qq61/Yzooo/111.jpg[/img]
"Clock" I'm making to learn c++, it let's you pick a time and it starts to count from there, inspired by how they let you choose the starting time in Pokemon, lol. :D
Edit: Fixed the clock counting down instead of up, silly minus...
After 2 days of search, in which I almost lost 3000 lines of code, I finally fixed my game. I forgot to initialize one pointer to NULL.
I'm back in business.
Edit: Also ,in the whole process, I found and fixed a bug that I wasn't even aware of.
I was thinking of writing a simple chat server. But not that simple. I wanted to do something like the minecraft packet system (hear me out...) where each network command from the client to server or server to client has an identifier. So, for example:
Client -> server: connects.
Client -> server {0x01,"Somenicknamehere"} (identify)
Server -> client {0x02, true/false} (nickname already in use?)
If above is false then server waits for another 0x01.
Server -> client {0x03, {{"Channel name", 1},{"Channel 2",2}...}
Client -> server {0x04, 2}
Server -> client {0x05, {{"Nick 1",0}, {"Nick 2",1}, {"Somenicknamehere", 2}}}
Client -> server {0x06, -1, "Hello everyone!"}
Server -> all clients {0x06, {"[Somenicknamehere]: Hello everyone!"}}
...
Client -> server {0x06, 1, "Hey there Nick 1."}
Server -> nick 1's client {0x06, 2, "[Somenicknamehere]: Hey there Nick 1"}
...
Client -> server {0x07, "Bye"}
client disconnects
Server -> all clients {0x06, "[Info]: Somenicknamehere has disconnected."}
Or something like that. But I was sort of stumped on how to implement it. I thought of something like this
Main program starts server thread.
Server thread starts listener thread, which starts a thread for each new connected client.
In client thread, read data into buffer, then give it to a PacketParser or something.
PacketParser has an internal buffer, which is added to each time some data is recived. It also keeps a dictionary of packetid (byte/int?):Packet.
Then, in a function that is called each time the client sends data, check if the first byte in the buffer is in the dictionary. If so, call the Packet's parse/handle function, giving it the internal buffer.
The problem is, how do I get the packet's parse/handle function to modify other stuff. For the auth packet for example, how would I get it to set the Client's username field without just passing it the Client? Also, how would I enforce a linear progression of packets? Like, when a client first connects it can't send a 0x06 packet because it doesn't have a username or channel yet. Is there a better way?
[QUOTE=bobthe2lol;31055987]I wanted to do something like the minecraft packet system[/QUOTE]
NO
[highlight](User was banned for this post ("Shitposting again" - Overv))[/highlight]
[QUOTE=garym0de;31056149]NO[/QUOTE]
Tell me in coherent sentences what's wrong with my idea. And please, read the fucking post. In fact, read the next 3 words after what you quoted.
I'm not saying i'm going to code it like Notch coded it, I'm saying that I'm going to use the fundamental idea behind it. That is: each networked command from cilent to server or server to client has an identifier. the IRC protocol does the same thing, except the identifier is a string.
If you're too stupid to read the entire post, not the first half of the first sentence, then get out.
[QUOTE=bobthe2lol;31055987]I was thinking of writing a simple chat server. But not that simple. I wanted to do something like the minecraft packet system (hear me out...) where each network command from the client to server or server to client has an identifier. So, for example:
Client -> server: connects.
Client -> server {0x01,"Somenicknamehere"} (identify)
Server -> client {0x02, true/false} (nickname already in use?)
If above is false then server waits for another 0x01.
Server -> client {0x03, {{"Channel name", 1},{"Channel 2",2}...}
Client -> server {0x04, 2}
Server -> client {0x05, {{"Nick 1",0}, {"Nick 2",1}, {"Somenicknamehere", 2}}}
Client -> server {0x06, -1, "Hello everyone!"}
Server -> all clients {0x06, {"[Somenicknamehere]: Hello everyone!"}}
...
Client -> server {0x06, 1, "Hey there Nick 1."}
Server -> nick 1's client {0x06, 2, "[Somenicknamehere]: Hey there Nick 1"}
...
Client -> server {0x07, "Bye"}
client disconnects
Server -> all clients {0x06, "[Info]: Somenicknamehere has disconnected."}
Or something like that. But I was sort of stumped on how to implement it. I thought of something like this
Main program starts server thread.
Server thread starts listener thread, which starts a thread for each new connected client.
In client thread, read data into buffer, then give it to a PacketParser or something.
PacketParser has an internal buffer, which is added to each time some data is recived. It also keeps a dictionary of packetid (byte/int?):Packet.
Then, in a function that is called each time the client sends data, check if the first byte in the buffer is in the dictionary. If so, call the Packet's parse/handle function, giving it the internal buffer.
The problem is, how do I get the packet's parse/handle function to modify other stuff. For the auth packet for example, how would I get it to set the Client's username field without just passing it the Client? Also, how would I enforce a linear progression of packets? Like, when a client first connects it can't send a 0x06 packet because it doesn't have a username or channel yet. Is there a better way?[/QUOTE]
Make a Client class. Profit.
Start a server. Profit.
Receive clients, preferably in there own threads.
If there is data available, the first byte will be the packetID.
Then just parse the packetids and junk
That's called making a protocol, it's not like Notch was some kind of forerunner in doing that with Minecraft.
[QUOTE=Map in a box;31056235]Make a Client class. Profit.
Start a server. Profit.
Receive clients, preferably in there own threads.
If there is data available, the first byte will be the packetID.
Then just parse the packetids and junk[/QUOTE]
I understand that, but the problem comes when I want to parse the packets. How do I do it? I'd rather not just have one bigass switch or if-if-else statement.
[QUOTE=Downsider;31056286]That's called making a protocol, it's not like Notch was some kind of forerunner in doing that with Minecraft.[/QUOTE]Notch invented UDP
[editline]11th July 2011[/editline]
[QUOTE=bobthe2lol;31056342]I understand that, but the problem comes when I want to parse the packets. How do I do it? I'd rather not just have one bigass switch or if-if-else statement.[/QUOTE]
By having a table that matches packet IDs with a function to act on the packet payload?
[QUOTE=bobthe2lol;31056342]I understand that, but the problem comes when I want to parse the packets. How do I do it? I'd rather not just have one bigass switch or if-if-else statement.[/QUOTE]
That's how Quake's looks, C though, not C++. You could use functions in an array or something, if you wanted, though.
Programming forum is now on the front page. There goes the neighbourhood.
Oh... functions in an array... Why didn't I think of that? I had classes implementing an interface in an array... Derp. Thanks you!
At least send an extra byte or short at the beginning of each packet to indicate packet length. This will make it easier for you to parse it, and it means if you accidently read one byte too many or too few the whole connection won't become corrupt.
[QUOTE=thomasfn;31056548]At least send an extra byte or short at the beginning of each packet to indicate packet length. This will make it easier for you to parse it, and it means if you accidently read one byte too many or too few the whole connection won't become corrupt.[/QUOTE]
main problem with the mc protocol
[QUOTE=garym0de;31056561]main problem with the mc protocol[/QUOTE]
Actually I'd say the main problem is the fact that a position packet (and probably more, like velocity or angle) is sent for each entity 5 times a second down a tcp stream. There's no kind of QoS, hell the server or client don't even know each other's ping.
Sorry, you need to Log In to post a reply to this thread.