User Tools

Site Tools


tutorial:side

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:side [2019/05/26 14:51] – [Logical Sides] Made logical sides more about the world state and the replication jamieswhiteshirttutorial:side [2019/06/30 07:40] liach
Line 1: Line 1:
 ====== Side ====== ====== Side ======
-Minecraft uses the [[https://en.wikipedia.org/wiki/Client%E2%80%93server_model|Client-server model]], that is users install the game client and connect to a server to play the game. Fabric allows mods to target either the Minecraft client or the Minecraft server, but also both at the same time. +Minecraft uses the [[https://en.wikipedia.org/wiki/Client-server_model|Client-server model]], that is users install the game client and connect to a server to play the game. Fabric allows mods to target either the Minecraft client or the Minecraft server, but also both at the same time. 
  
 In the past, there used to be a simple division into the client and the server, but with the switch of the single player game mode to an internal dedicated server, this simple model doesn't fit anymore. Thus, we have two dimensions when distinguishing between client and server in Minecraft. These are the physical and logical sides. In the past, there used to be a simple division into the client and the server, but with the switch of the single player game mode to an internal dedicated server, this simple model doesn't fit anymore. Thus, we have two dimensions when distinguishing between client and server in Minecraft. These are the physical and logical sides.
  
-For both types of sides, there are client and server. However, a logical client is not equivalent to a physical client, and a logical server is not equivalent to a physical server either. A logical client is instead **hosted by** a physical client, and a logical server is hosted by either a physical server or a physical client.+For both types of sides, there is a 'clientand a 'server'. However, a logical client is not equivalent to a physical client, and a logical server is not equivalent to a physical server either. A logical client is instead **hosted by** a physical client, and a logical server is hosted by either a physical server or a physical client.
  
 The logical sides are central in the architecture of both distributions of Minecraft. Therefore, an understanding of logical sides is vital for any mod development with Fabric. The logical sides are central in the architecture of both distributions of Minecraft. Therefore, an understanding of logical sides is vital for any mod development with Fabric.
Line 62: Line 62:
  
 ==== Logical Server ==== ==== Logical Server ====
-The logical server is where most of the game logic is going on. Data packs, world updates, block entity and entity ticks, mob AI, game/world saving,  and world generation, happen on the logical server.+The logical server is where most of the game logic is executed. Data packs, world updates, block entity and entity ticks, mob AI, game/world saving,  and world generation, happen on the logical server.
  
 The logical server on the physical client is called the "Integrated Server", while the logical server on the physical server is called the "Dedicated Server" (which is also the name of the physical server itself). The logical server on the physical client is called the "Integrated Server", while the logical server on the physical server is called the "Dedicated Server" (which is also the name of the physical server itself).
  
-The logical server never runs on the thread which went through the entry point of a physical side, even on physical servers. Stillit has its thread, on which it handles its logicIt is singleton that always exists on physical servers; on the physical client, it exists one instance at a time when the player is playing a local saveand a new instance is created every time the player loads a local save+The logical server runs in its own main thread, even on physical servers, and has a few worker threadsThe lifetime of logical server depends on the physical side it is hosted on. On a physical server, a logical server exists for as long as long as the process is running. On a physical client, multiple logical servers may be created, but only one logical server may exist at a time. A new logical server is created when the player loads a local save and closed when the player closes the local save.
- +
-Most universal mods target the logical server so that they can work on physical sides.+
  
 +Most universal mods target the logical server so that they can work both in single player and multi player scenarios.
 ===== Communication===== ===== Communication=====
  
-The only correct way to exchange data between a client and a server are packets. The packets (which [[https://wiki.vg]] documents) are sent between logical clients and logical servers, not physical sides. Mods can add packets to transfer custom information between two logical sides.+The only correct way to exchange data between logical clients and servers by exchanging packets. The packets (as documented on [[https://wiki.vg]]) are sent between logical clients and logical servers, not physical sides. Mods can add packets to transfer custom information between two logical sides. Packets are exchanged in-memory for a logical client connected to its own integrated server, and exchanged over a networking protocol otherwise.
  
 Logical clients send C2S (Client-To-Server) packets to the logical server. Logical clients send C2S (Client-To-Server) packets to the logical server.
 The logical server sends S2C (Server-To-Client) packets the logical clients. The logical server sends S2C (Server-To-Client) packets the logical clients.
-Packets are sent be a write method in a network thread and received by a call to a read method in a network thread.+Packets are sent by a write method in a network thread and received by a call to a read method in a network thread.
  
 For more details on how to handle networking, see [[tutorial:networking|this article]]. For more details on how to handle networking, see [[tutorial:networking|this article]].
tutorial/side.txt · Last modified: 2022/04/13 04:32 by 127.0.0.1