Server
What is a Server?
The server is an instance of the game that does all the network management, sending network packets (small portions of data) to client game instances that are connected to that server.
What will be sent to clients and what will remain on the server is on the programmer to decide, thatโs what network programming is.
It guarantees every client game instance is seeing the game game, otherwise it would be analogue as seeing two different games being played in two different PCs.
Code that runs on the server
Logic that will only run on the server game instance, so any information not networked from any clients are unknown to the server, we cannot just network everything, that's a lot of information to send over the network, we are here to manage what should be networked and what should not.
All the code run in the server, will only run on the server. If we were to set a variable on the server and not replicate that logic on the client, that means the client would never know that was changed.
Server Attribute
[Server]
The Server attribute is used when we want to run methods only in the server.
Examples
Last updated