Advertisement
Tom_Neverwinter

server process, may be wrong

Jun 4th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. a description of the server-side process in more detail:
  2.  
  3. DS Initialization: The DS process starts by initializing the game engine and loading necessary resources. It sets up the necessary subsystems, such as networking and input.
  4.  
  5. Listening for Client Connections: The DS calls UWorld::Listen to create a network driver (NetDriver) for listening to incoming client connections. The specific network driver used is usually UTcpNetDriver for TCP communication.
  6.  
  7. Accepting Client Connections: The DS continuously checks for incoming client connections by calling UTcpNetDriver::TickDispatch within the main game loop (UWorld::Tick). This function checks if any new client connections have been created and adds them to the ClientConnections array.
  8.  
  9. Handling Network Packets: Once a client connection is established, the DS receives network packets from the client through the corresponding NetConnection. The received packets are processed within the network driver, UTcpNetDriver, and passed to the relevant channels for further handling.
  10.  
  11. Control Channel Creation: Upon receiving the initial network packet (usually NMT_Hello) from the client, the DS checks if the client's NetConnection has a Control Channel associated with it. If not, it calls UNetConnection::CreateChannel to create a Control Channel for reliable communication with the client.
  12.  
  13. Processing Control Messages: The received network packets, including those from the Control Channel, are passed to the UWorld::NotifyControlMessage function for processing. This function handles various control messages sent by the client and performs the necessary actions or updates in the game world.
  14.  
  15. Player Initialization: Once the client connection is fully established, the DS creates a PlayerController object for the player associated with the connection. The PlayerController is responsible for managing the player's actions and interactions within the game. The server sets properties such as NetPlayerIndex, Role, and RemoteRole to synchronize the player's state across the network.
  16.  
  17. Game Logic and Simulation: With all necessary connections established and players initialized, the DS continues to execute the game's logic and simulation. This includes updating the game state, handling player inputs, and maintaining synchronization between the server and clients.
  18.  
  19. Replication and Network Updates: The DS handles replication of relevant game objects and properties to the connected clients. It updates the client's game state based on changes occurring on the server, ensuring that all players are in sync and have an accurate representation of the game world.
  20.  
  21. Continuous Network Communication: Throughout the game session, the DS maintains continuous network communication with the clients. It sends updates, events, and other relevant information to the clients to keep them updated on the game's progress.
  22.  
  23. Game Termination: When the game session ends, the DS cleans up resources, closes connections, and performs any necessary cleanup tasks to gracefully shut down the server process.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement