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/12 12:22] tyra314tutorial:side [2019/05/26 15:13] – [Logical Server] Made things a little easier to understand jamieswhiteshirt
Line 22: Line 22:
 ===== Logical Sides ===== ===== Logical Sides =====
  
-Logical sides are about the actual logic running during the execution.  +Logical sides are about the actual game logic.  
-The client does rendering, sends player inputs to the server, handles resource packsand the server calculates most core logic, handles data packs, keeps the world/game data.+The logical client does rendering, sends player inputs to the server, handles resource packs and partially simulates the game world. The server handles the core game logic, data packs and maintains the true state of the game world.
  
-The logical client and server share some logic classesincluding:<code>+The client maintains a partial replica of the server's worldwith copies of objects such as:<code>
 net.minecraft.world.World net.minecraft.world.World
 net.minecraft.entity.Entity net.minecraft.entity.Entity
 net.minecraft.block.entity.BlockEntity net.minecraft.block.entity.BlockEntity
 </code> </code>
-These shared classes allow logical clients to shadow some common game logic from the logical server for easy rendering(block entities are shadowed to the logical client optionally) +These replicated objects allow clients and servers to perform some common game logic. The client can interact with these objects while the server is responsible for keeping them in sync. Usually, to distinguish objects on the logical clients from the ones on the logical server, access the world of the object and check its 'isClientfield. This can be used to perform authoritative actions on the server such as spawning entities, and to simulate actions on the client. This technique is necessary to avoid desynchronization between the two logical sides.
- +
-Usually, to distinguish the shadowed objects on the logical clients from the real ones on the logical server, vanilla and mod code access the world referenced in these objects and check the state of the isClient field. A calculation is then only down on the logical server so that they do not perform useless calculations on the logical client. This technique avoids desynchronization between the two logical sides and reduces the load on the logical client. +
 ===== Detailed look into all sides ===== ===== Detailed look into all sides =====
  
Line 65: 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=====
  
tutorial/side.txt · Last modified: 2022/04/13 04:32 by 127.0.0.1