Network test
- npissoawsome
- Posts: 114
- Joined: June 8th, 2012, 3:01 pm
Re: Network test
Where did you guys learn network programming? I'm interested in it, but can't find anything helpful
Re: Network test
As i am not so use to programming i read alot on these web pages.
the second one was given from LuX
http://www.directxtutorial.com/
http://www.win32developer.com/
http://msdn.microsoft.com/en-us/library/default.aspx
after alot of reading, then it's just try and error to get it working into the chili framework. My implament so far, is far far away from finished and working propertly. As my program starts to move in slowmotion when i get the client to acctually connect to the host
the second one was given from LuX
http://www.directxtutorial.com/
http://www.win32developer.com/
http://msdn.microsoft.com/en-us/library/default.aspx
after alot of reading, then it's just try and error to get it working into the chili framework. My implament so far, is far far away from finished and working propertly. As my program starts to move in slowmotion when i get the client to acctually connect to the host
Re: Network test
I bet it's moving slow motion because you're using blocking calls. Try researching async functions for sockets. You either need to use async calls or you need to use threads.
Chili
- npissoawsome
- Posts: 114
- Joined: June 8th, 2012, 3:01 pm
Re: Network test
that second website is a god, thank you so muchnpissoawsome wrote:Where did you guys learn network programming? I'm interested in it, but can't find anything helpful
Re: Network test
Yeah that is what i have used so far, just trying to get things working.
Goal is to learn this so good that i can acctually implant it into the game we are starting to do with you chili xD
atm i have made it in alot of voids in the framework but shall now try to divide it into classes that might make it better
can't wait for next lession, keep em comming chili xD
Goal is to learn this so good that i can acctually implant it into the game we are starting to do with you chili xD
atm i have made it in alot of voids in the framework but shall now try to divide it into classes that might make it better
can't wait for next lession, keep em comming chili xD
Re: Network test
I have also found this guide
http://www.codeproject.com/Articles/412 ... plus-and-W
i think it might be usefull but i dunno how to implant it into chilies framework
so far i have tryed to divide it into two different visual projects and tryed to make them found eachother instead of his way there everything is in one project, but so far they don't find eachother so i don't get any connection between them :/
http://www.codeproject.com/Articles/412 ... plus-and-W
i think it might be usefull but i dunno how to implant it into chilies framework
so far i have tryed to divide it into two different visual projects and tryed to make them found eachother instead of his way there everything is in one project, but so far they don't find eachother so i don't get any connection between them :/
Re: Network test
Hey Guys!
Now i am back with some new questions about this amazing network programming... again ;P
I have finally made it so far that i got a client and a server talking with eachother. The big question now is, how do i get the server to get cordinates and reply them to the client, the problem is that i have followed alot and read alot of tutorials. But in all of them they have used the send() function for messages, like "Hello".
messages are great tought, but it's not fun intil i get it to work with cordinates, so i can make two objects move around.
The problem atm is that i have declared the package to an const size, as the send() function requiers this. But how do i then give a new position if the position changes, positions are hardly const right :S
I dunno how i can make an position of a object, into a const char, as the position always changes :S
so my program right now only sends the same number back and forth, and i don't know how to get it to change :/
Now i am back with some new questions about this amazing network programming... again ;P
I have finally made it so far that i got a client and a server talking with eachother. The big question now is, how do i get the server to get cordinates and reply them to the client, the problem is that i have followed alot and read alot of tutorials. But in all of them they have used the send() function for messages, like "Hello".
messages are great tought, but it's not fun intil i get it to work with cordinates, so i can make two objects move around.
The problem atm is that i have declared the package to an const size, as the send() function requiers this. But how do i then give a new position if the position changes, positions are hardly const right :S
I dunno how i can make an position of a object, into a const char, as the position always changes :S
so my program right now only sends the same number back and forth, and i don't know how to get it to change :/
Re: Network test
What I did is divide the "package" into pre-defined bits, coding vise.... So that for example the first 3 characters of the package are the X position, next 3 numbers the Y position. Then when the client gets these values I use string to int function to convert the char string into an int, I think the function was "int x = atoi ( char_x_pos );" where char_x_pos is a char [3] with the first three letters of the package.
ʕ •ᴥ•ʔ
Re: Network test
if its UDP how would you calculate the players ping?, i thought that was only for TCP?
- npissoawsome
- Posts: 114
- Joined: June 8th, 2012, 3:01 pm
Re: Network test
You know you're able to send structs right?LuX wrote:What I did is divide the "package" into pre-defined bits, coding vise.... So that for example the first 3 characters of the package are the X position, next 3 numbers the Y position. Then when the client gets these values I use string to int function to convert the char string into an int, I think the function was "int x = atoi ( char_x_pos );" where char_x_pos is a char [3] with the first three letters of the package.