Advertisement
Tom_Neverwinter

UE3 client joins DS process

Jun 4th, 2023 (edited)
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. The process you described outlines how a client using the UE3 (Unreal Engine 3) joins a dedicated server (DS). Here is a step-by-step breakdown of the process:
  2.  
  3. Client Requests Game Start: The client sends the game map and related parameters to the ZoneSvr (Zone Server) to request the start of the game.
  4.  
  5. DS Setup: Upon receiving the client's request, ZoneSvr assigns an IP address and port number and builds a command line to start the DS process with the specified map and parameters.
  6.  
  7. DS Initialization: When the DS starts, it calls the UGameEngine::LoadMap function in the UGameEngine::Init process. This function loads the game map and serializes the map data to UWorld* GWorld. It also creates an AGameInfo object by calling UWorld::SetGameInfo, which determines the game mode based on the map name.
  8.  
  9. Network Setup: The DS calls UWorld::Listen to create a UNetDriver* NetDriver and UTcpNetDriver::InitListen to create a socket for TCP communication. At the end of the LoadMap process, a semaphore is sent to notify ZoneSvr, indicating that the DS is ready and providing the IP address and port number for the client.
  10.  
  11. Client Joins DS: After receiving the DS's IP address and port number, the client executes an "open" command with the provided information. This command sets the parameters for the client's connection, such as the player's name, team, and other details.
  12.  
  13. Client Connection: In the game's main loop, the client checks the TravelURL variable of UGameEngine every frame. If the variable is not empty, the client calls UGameEngine::Browse to create a UNetPendingLevel object. This object sets up a connection to the DS by creating a UTcpNetDriver and establishing a UDP socket, UTcpipConnection object, and Control Channel.
  14.  
  15. DS Network Processing: On the DS side, the NetDriver calls UTcpNetDriver::TickDispatch every frame in UWorld::Tick to check for client connections. If a client connection is detected, a new NetConnection (derived from UPlayer) is created and added to the ClientConnections array. The received network packet data is processed, including the creation of a Control Channel and handling the NMT_Hello packet.
  16.  
  17. Loading Client Map: If the client connection is successfully established (bSuccessfullyConnected is true), the DS checks the URL's map and game mode. It then calls UGameEngine::LoadMap to load the client's map.
  18.  
  19. Client Map Loading Outcome:
  20. a. Loading Failure: If the client map fails to load, the DS calls UGameEngine::Browse with the ?failed parameter to close the UNetPendingLevel connection, set GPendingLevel to NULL, and loads a default map (e.g., a lobby map).
  21. b. Loading Success: If the client map loads successfully, the DS transfers the NetDriver, NetConnection, and Control Channel from GPendingLevel to GWorld of the new map. After loading the map, an NMT_JOIN message is sent, and GPendingLevel is set to NULL.
  22.  
  23. Player Initialization: In the SpawnPlayActor function, the server creates the PlayerController object by calling GameInfo.Login. The PlayerController is then associated with the corresponding player by setting the NetPlayerIndex, Role, and `RemoteRole
  24.  
  25. Source:
  26. https://blog.actorsfit.com/a?ID=01250-0966ac06-aa3c-4d9e-b5ef-5ed8baf9f124
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement