Roblox Game Development/Game engine
The ROBLOX game engine can be divided into different engines. Each of these engines is charged with accomplishing the tasks related to a particular aspect of the game. These include the physics engine, which handles the natural movement of physical objects. For example, gravity, part collisions and explosions are handled by the physics engine. The rendering engine is tasked with displaying physical objects on the monitors of the players. The network engine has the responsibility to make sure the players playing the game are all up-to-date on what is happening in the game. The Lua engine has to handle events and execute the game code so that the game may be interactive.
Client–server model
[edit | edit source]In order to make it possible for many players to be playing a game together at the same time, ROBLOX hosts game servers, which are instances of the ROBLOX software running on computers owned by ROBLOX. When a player enters a game, his client, the ROBLOX software running on his computer, is either put into communication with a game server already running the game he wants to enter, or is put into communication with a new game server that will be created if there is no game server or if all the available game servers are full (there is a maximum number of players that can join each game server). The client of the player downloads the entire place from the game server. As changes are done in the game, both by the physics engine and by game code, these changes are replicated to all the clients connected to the game. When these changes happen on a player's client (this can happen when the player moves his character and when similar events happen), the changes are replicated to the server and then to all the others clients. This is why all players will see the characters of other players move and why changes done by scripts will be visible by each player. Each instance of ROBLOX software running on a computer is called a peer: all game servers are peers and all clients are peers.
A game server and the clients connected to it together form a network. The networks of ROBLOX game servers are said to operate on a client–server model because of the way the network nodes (the peers) are arranged: the clients communicate to the server and the server communicates to the clients but the clients do not communicate directly with one another. The topology of a network is the way the nodes are arranged in that network.
A distinction is made between game servers and physical servers. Physical servers are physical computers that usually host many game servers. Game servers are the instances of the ROBLOX software running on physical servers that communicate with clients to establish the connection and transmit data. A distinction is also made between something that is local, which is something that is related to a particular client or to all the clients, and something that is related to the server.
Quiz
[edit | edit source]There are some questions you can answer to verify that you have understood the material in this chapter. Note that finding the answer to some of those questions could require having knowledge that is not presented in this chapter. This is normal: the quizzes are part of the learning experience, and they can introduce information that is not available elsewhere in the book.