Network test

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Network test

Post by LuX » October 29th, 2012, 2:55 pm

Hi np, I haven't worked on this for a long time now, but at the time and the amount of research I had done, I only knew how to send char arrays. I'm sure there are far better ways of doing the same, but I'm merely explaining how I did it.

Feel free to add any links, as I could only find functions and tutorials to send chars. I'll need to get back on networking sometime. It's pretty interesting to be honest.
ʕ •ᴥ•ʔ

User avatar
npissoawsome
Posts: 114
Joined: June 8th, 2012, 3:01 pm

Re: Network test

Post by npissoawsome » October 30th, 2012, 12:27 am

it's quite simple, here's a quick explanation.

On both the client and the server, you're going to need the same struct, with the same data int it.

Than when you send the data, all you have to do is typecast the struct object to a char* and then make the size of it, the size of the struct. I have some code for it somewhere if you want me to post it

NaturalDemon
Posts: 97
Joined: October 28th, 2012, 8:28 pm

Re: Network test

Post by NaturalDemon » October 30th, 2012, 4:23 am

I have lived a few years in the box of Second life.
made some bots coded in C# using the Lib secondlife or currently after some copyright troubles ... lib OMV(openmeta verse).
(i made some money whit it until George bush decided that Visa card being used for online gambling is wrong and the policy of secondlife was changed.)
you wanna wanna peek into in the stuff
http://lib.openmetaverse.org/wiki/Download
you need the SVN.

the data is actually like XML.
you form a XML string and send it vice versa.

this is very usefull, because you can pack the objectName || objectID, objectPosition, objectRotation objectAnimation, objectSize, objectstate(friend or enemy),objectsound, ect, ect, ect ... some other object flags into a single XML type of string and later decode it easily.
this is ... i thinks ... the only usefull way ... to send vast amounts of nicely structurized data that correspond to the object(inside the game) that sended the message of recieves the data..

you aren't sending one induvidual type of data(like a movement on the X axis) ... from an object in the game that moved.
you send pretty much all the data about the and do a redraw the object on the client screen.

the server can be made by using Python.
the server is needed to find the clients or make the clients find eachter.
the game data peer 2 peer ... you aim for a serverless setup .... like the day of the good old Age of Empires.


so we need knowledge about TCP versus UDP, Threading and a win32 XML class.

libXML 2
http://xmlsoft.org/sources/win32/

Threading
http://msdn.microsoft.com/en-us/library ... 85%29.aspx

maybe we can setup a joint effort in order to make a socket framwork that exsist within the chili framework : ).
Chilli can you setup a SVN server on your webhost in combination with Tortoise.
so everyone is on the same page?

besides ... you don't need 2 computers ... you need VMWARE and a virtual version of windows inside of the virtual box ... voila 2 ip addresses on the same computer.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Network test

Post by chili » October 31st, 2012, 2:47 pm

Yeah, np is right. Remember the first rule of programming: everything is a fucking number. A char is just a byte. A struct with 2 ints and a bool is just 9 bytes (or 12 bytes depending on packing and alignment). You can look at the struct as 2 ints and a bool or you can look at it as 9 chars.
Chili

Lorth
Posts: 139
Joined: July 19th, 2012, 4:12 pm

Re: Network test

Post by Lorth » November 25th, 2012, 10:31 pm

Hey Everyone!

Just needed to share my latest progress.

I have finally made an server and a client, they have 1 ball each to move around and change color on!
and you see both the server and client ball in your own window.

Maby not so interesting, as LuX already made this and posted the .exe here on some earlier page, but feels great that i have made it to work also on my own :D

My next plan is to see if i can get it either into the chili framework so we can make some multiplaying in our games :D
or try to make it a bit more in oop maner and make it easier to understand, maby some optimizing :P

New week new adventures, happy coding!

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: Network test

Post by Asimov » November 25th, 2012, 10:36 pm

Hi Lorth,

Will hopefully be back to C++ soon.

At the moment I am writing some stuff in javascript in Unity. Have to work out how to get a multiplayer game going in Unity at the moment.
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

Lorth
Posts: 139
Joined: July 19th, 2012, 4:12 pm

Re: Network test

Post by Lorth » November 26th, 2012, 10:55 am

Hey Everyone!

I got it to work apart from on my own computor. Made it work on another laptop at home and also made a connection to my brother only 35 miles away from me :D

anyone wanna make a try to get it connected send a msg.

User avatar
thetoddfather
Posts: 338
Joined: October 1st, 2012, 9:53 pm
Location: Canada

Re: Network test

Post by thetoddfather » November 26th, 2012, 7:19 pm

Seems pretty amazing. I'd love to try that out.

Ferbguy
Posts: 51
Joined: August 29th, 2012, 10:54 pm
Location: Georgia

Re: Network test

Post by Ferbguy » November 30th, 2012, 2:28 am

Lux, i found this while jsut diddling around on some of the included files, actually the winsock.h file. but it should be plenty of help, atleast i hope so http://beej.us/guide/bgnet/output/html/ ... index.html

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: Network test

Post by LuX » November 30th, 2012, 8:25 pm

Thanks for sharing the link.

I'm currently working on a high quality pixel buffer rotation and alpha stuff. Kinda like a superior chili framework. Pretty far already, so after that I might try to get some quick online game working.
ʕ •ᴥ•ʔ

Post Reply