Game Development Community

need an starting point from which i can figure out how a game's network connection works

by Ahsan Muzaheed · in Torque 3D Beginner · 10/07/2011 (2:03 am) · 3 replies

i need an starting point from which i can figure out how a game connection start and work for multiplayer.can anyone give me some light?

by analysing stock template code,i can figure it out.
but stock template code is not small.and most of all of them are function defination.





About the author

Torque 3D enthusiastic since 2010.Have been working in several T3D projects besides of Unreal Engine 4 and Unity 3D. NEED a hand with your project? SHoot me a mail. http://www.garagegames.com/community/forums /viewthread/138437/


#1
10/07/2011 (2:04 am)
from which class all the network connection begins?
i think from: NetConnection Class (SimObject->SimSet->SimGroup->NetConnection)
am i right?
if yes,then may be it's callback function can be a good starting place?

is there any other class before NetConnection in class hiearcy that does any other network related tasks?


#2
10/07/2011 (1:04 pm)
Greetings!

If you want to see where the raw packets are handled, start with the Net struct defined in platformNet.h. The Net::process() method reads in the data, looks up the source's address and port, and triggers a packet receive event. The Net struct is also used to open a port, performs sendTo(), etc.

Then the NetInterface responds to the packet event in NetInterface::processPacketReceiveEvent(). [This event hook up is done in StandardMainLoop::init()] Within there the given address and port is used to look up the appropriate NetConnection that will handle the packet.

NetInterface also handles the handshaking required to allow a client to connect in the first place. You can poke around the various send and handle methods.

I hope that helps!

- Dave
#3
10/11/2011 (9:00 pm)
sorry for late answer.i did not had net connection.

actually i was asking for a script side point.
and i thinks i have found.
ChooseLevelDlg->ChooseLevelDlgGoBtn's
function ChooseLevelDlgGoBtn::onMouseUp( %this )
and
JoinServerDlg->JS_joinServer.command=JoinServerDlg.join();

but thanks for your answer.it will help me in future.