Client

The Client class manages the overall operation of the client.

It orchestrates the various components required for the game’s operation, from initializing the server to managing the entities to be displayed.

FunctionDescription
runNetworkClientThis function starts the server.
initializeNetworkThis function handles the server initialization.
manageBackgroundThis function simulates the game background being in motion. In reality, it replicates the given image and scrolls it.
manageSoundThis function setup the sound of the game.
processEventsThis is the function containing the loop that handles all game events (mouse clicks, keyboard key presses, etc.).
handleAutoFireThis function handles the auto-fire event when the corresponding key is pressed.
initializeServerThe initializeServer function establishes the network connection with the server (TCP/UDP) and initializes the required resources.
updateGameStateThis function calls the GameEngine and requests it to display all the entities contained in a list.
manageClientThe manageClient function is the main loop of the client. It initializes the game window, the necessary components (sound, network, menus, etc.), and manages the game lifecycle, including rendering, user events, state management (menu, gameplay, victory, defeat), and communication with the server. It runs as long as the window remains open.