Quake source code analysis (draft) .4
(1) part of the network is divided into two parts to receive and send.
(2) to send some data packets are divided into local and remote transmission of data packet transmission in two parts.
(3) local data packet transmission from NET_SendLoopbackPacket () is responsible for.
(4) data packet transmission from remote Sys_SendPacket () is responsible for.
(5) data packet transmission and packet transmission can be divided into single and multi-packet transmission.
(6) NET_SendPacket () can be local or remote does not send more than one packet size of packets. That is, a single packet transmission.
(7) Netchan_Transmit ()
According to the size of the packet transmission choice, if a packet larger than the packet size,
Then call Netchan_TransmitNextFragment () function,
Will need to send the data blocks (MAX_MSGLEN) cut into the size of a number of such (MAX_PACKETLEN - 100) of the packet, and then start NET_SendPacket () to send.
Otherwise, if the packet is less than the size of a packet, then a direct call NET_SendPacket () to send.
The data packet is NET_SendPacket () will first be sent before Netchan_ScramblePacket () encrypt (data upset inside) and then CL_Netchan_Encode () to encode them.
This is the multi-packet transmission.
From the above description can be seen in multi-packet transmission in fact ultimately have to be transformed into a single packet transmission.
(8) to receive packet data packets are divided into local and remote receiver to receive packets.
(9) local data packets received: NET_GetLoopbackPacket ()
(10) to receive packets in different places: Sys_GetPacket ()
(11) when the system receives data packets in different places SE_PACKET events will trigger when the event arrived Com_EventLoop (), the start CL_PacketEvent () to deal with from the client to send packets
Start SV_PacketEvent () server-side processing of data packets sent over.
CL_PacketEvent ()? CL_Netchan_Process ()? Netchan_Process ()
SV_PacketEvent ()? SV_Netchan_Process ()? Netchan_Process ()
For those multi-packet data, by CL_Netchan_Process () or SV_Netchan_Process () to deal with, it will have to wait until all the packets have to take down after the call
Netchan_UnScramblePacket () to decrypt, and then use CL_Netchan_Decode () decoder. Finally, users can read a complete packet.
(12) when the system receives data packets to the local direct start
CL_PacketEvent () or SV_PacketEvent ()
And there is no need to wait for the packet. Because these packets do not enter the network, so
while (NET_GetLoopbackPacket (NS_CLIENT, & adr, & msg))
while (NET_GetLoopbackPacket (NS_SERVER, & adr, & msg))
Above all by cutting the cycle of one-time read out to the full packet.
The use of NET_SendPacket ()
A function of direct transmission of data has NET_OutOfBandPrint ()? NET_SendPacket ()
Note: The NET_OutOfBandPrint () to send out packets, the first four bytes must be FFFFFFFF, or -1.
They will be SV_ConnectionlessPacket () and CL_ConnectionlessPacket () to deal with.
Game Developer Tutorial Articles
- game engine
- Nokia mobile phone-based mobile game development boboto (b)
- World of Warcraft on November 23 will begin selling
- The heroes from Warcraft to devise a mechanism to pry into the idea of object-oriented
- Why Shanghai grand success? (5)
- Bird Cup Software Design Competition awards mobile phone results
- Quake source code analysis (draft) .4
- Talk about interactive online games. .
- Game On (c) - the game's coat
- DirectX Development Review
- Huge one China, not the book readable
- Shaders and effects - 1.3 Variable types
- Shaders and effects - HLSL shader compiler 1.2
- Shaders and effects - the preparation of HLSL shader 1.1
- Shaders and effects - high-level shading language 1.0 Introduction. Doc
- Shaders and effects - (1) Overview
- Directshow RTP multimedia applications on the network adapter support
- Network Robot (3 )---- robot game development tools and development steps
- Advanced shader language (High-Level Shader Language)
- Legend Chronicle
Can't Find What You're Looking For?
Rating: Not yet rated