User Tools

Site Tools


ichunkloadingservice

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
ichunkloadingservice [2026/04/26 06:42] – divinerichunkloadingservice [2026/08/15 08:35] (current) – diviner
Line 2: Line 2:
 ===== IChunkLoadingService ===== ===== IChunkLoadingService =====
  
-This service's primary responsibility is to load and unload [[Chunk|Chunks]] and by extension through other services, Scenes, [[EntitySpawn|EntitySpawns]] and serialized [[Entity|Entities]]. It is heavily used during the game initialization process.+This service's primary responsibility is to load and unload [[Chunk|Chunks]] and by extension through other services, Scenes, [[EntitySpawn|EntitySpawns]] and serialized [[IEntity|Entities]]. It is heavily used during the game initialization process.
  
 **Broadcasts Events:** [[ChunkLoadRequestedAsyncTopic]], [[ChunkLoadCompleteAsyncTopic]], [[ChunkUnloadRequestedAsyncTopic]], [[ChunkUnloadCompleteAsyncTopic]] **Broadcasts Events:** [[ChunkLoadRequestedAsyncTopic]], [[ChunkLoadCompleteAsyncTopic]], [[ChunkUnloadRequestedAsyncTopic]], [[ChunkUnloadCompleteAsyncTopic]]
Line 11: Line 11:
  
 ^Method | Task **LoadChunkAdditive**([[Chunk]] chunk, CancellationToken cancellationToken) | ^Method | Task **LoadChunkAdditive**([[Chunk]] chunk, CancellationToken cancellationToken) |
-^Description | Loads specified [[Chunk]] from its default state if not already loaded without unloading current Chunks. |+^Description | Loads specified [[Chunk]] from its default state if not already loaded without unloading current Chunks. The Chunk's Scenes are loaded first, followed by any [[EntitySpawn|EntitySpawns]] associated with those Scenes. Nothing happens if the [[Chunk]] is already loaded. |
  
-^Method | Task **LoadChunkFromSave**([[Chunk]] chunk, [[EntityPacketCollection]] entities, bool containsEncodedPackets, CancellationToken cancellationToken, bool cacheUnloadedChunks = true) | +^Method | Task **LoadChunksFromSave**([[Chunk]][] chunks, [[EntityPacketCollection]][] entities, bool containsEncodedPackets, CancellationToken cancellationToken, bool cacheUnloadedChunks = true) | 
-^Description | Loads specified [[Chunk]] from supplied [[EntityPacketCollection]] while first unloading all already loaded Chunks from the game. If cacheUnloadedChunks is true, the Chunks unloaded will keep a serialized state in memory to be serialized to a save file in the next serialization call. Their state is discarded if the boolean is set to false. Nothing happens if the [[Chunk]] is already loaded. The containsEncodedPackets boolean is meant to instruct how the [[EntityPacketCollection]] deserializes. Packet encoding reduces save file size by storing a packet's type as an integer instead of serializing its Type as a string value, but adding new packets will break the indexing and corrupt the save file. For more robust save files, set encoding to false. An [[EntityPacketCollection]] must deserialize with the same setting it was serialized. |+^Description | Loads specified [[Chunk|Chunks]] from their corresponding supplied [[EntityPacketCollection|EntityPacketCollections]] while first unloading all already loaded Chunks from the game. Chunks which are already loaded are ignored together with their corresponding EntityPacketCollection. If cacheUnloadedChunks is true, the Chunks unloaded will keep a serialized state in memory to be serialized to a save file in the next serialization call. Their state is discarded if the boolean is set to false. The containsEncodedPackets boolean is meant to instruct how the [[EntityPacketCollection|EntityPacketCollections]] deserialize. Packet encoding reduces save file size by storing a packet's type as an integer instead of serializing its Type as a string value, but adding new packets will break the indexing and corrupt the save file. For more robust save files, set encoding to false. An [[EntityPacketCollection]] must deserialize with the same setting it was serialized. |
  
-^Method | Task **LoadChunkFromSaveAdditive**([[Chunk]] chunk, [[EntityPacketCollection]] entities, bool containsEncodedPackets, CancellationToken cancellationToken) | +^Method | Task **LoadChunksFromSaveAdditive**([[Chunk]][] chunks, [[EntityPacketCollection]][] entities, bool containsEncodedPackets, CancellationToken cancellationToken) | 
-^Description | Loads specified [[Chunk]] from supplied [[EntityPacketCollection]] without unloading current Chunks. Nothing happens if the [[Chunk]] is already loaded. The containsEncodedPackets boolean is meant to instruct how the [[EntityPacketCollection]] deserializes. Packet encoding reduces save file size by storing a packet's type as an integer instead of serializing its Type as a string value, but adding new packets will break the indexing and corrupt the save file. For more robust save files, set encoding to false. An [[EntityPacketCollection]] must deserialize with the same setting it was serialized. |+^Description | Loads specified [[Chunk|Chunks]] from their corresponding supplied [[EntityPacketCollection|EntityPacketCollections]] without unloading current Chunks. Chunks which are already loaded are ignored together with their corresponding EntityPacketCollection. The Scenes belonging to all Chunks being loaded are loaded before their serialized Entities are restored. The containsEncodedPackets boolean is meant to instruct how the [[EntityPacketCollection|EntityPacketCollections]] deserialize. Packet encoding reduces save file size by storing a packet's type as an integer instead of serializing its Type as a string value, but adding new packets will break the indexing and corrupt the save file. For more robust save files, set encoding to false. An [[EntityPacketCollection]] must deserialize with the same setting it was serialized. |
  
-^Method | Task **UnloadChunk**([[Chunk]] chunk,  bool includeUnloadableChunks, CancellationToken cancellationToken, bool cacheUnloadedChunks = true) | +^Method | Task **UnloadChunk**([[Chunk]] chunk, bool includeUnloadableChunks, CancellationToken cancellationToken, bool cacheUnloadedChunks = true) | 
-^Description | Unloads specified [[Chunk]] from the game. If cacheUnloadedChunks is true, the Chunk unloaded will keep a serialized state in memory to be serialized to a save file in the next serialization call. The state is discarded if the boolean is set to false. The includeUnloadableChunks boolean is used to override the Chunk's neverUnload setting. Setting the boolean to true will unload the [[Chunk]] even if it's set to never unload. |+^Description | Unloads specified [[Chunk]] from the game. Nothing happens if the Chunk is not currently loaded. If cacheUnloadedChunks is true, the Chunk unloaded will keep a serialized state in memory to be serialized to a save file in the next serialization call. The state is discarded if the boolean is set to false. The includeUnloadableChunks boolean is used to override the Chunk's neverUnload setting. Setting the boolean to true will unload the [[Chunk]] even if it's set to never unload. Entities associated with the Chunk are destroyed before its Scenes are unloaded. |
  
-^Method | Task **UnloadAllChunks**(bool includeUnloadableChunks, CancellationToken cancellationToken, bool cacheUnloadedChunks = true) | +^Method | Task **UnloadAllChunks**(bool includeUnloadableChunks, CancellationToken cancellationToken, bool cacheUnloadedChunks) | 
-^Description | Unloads all loaded Chunks from the game. If cacheUnloadedChunks is true, the Chunks unloaded will keep a serialized state in memory to be serialized to a save file in the next serialization call. The state is discarded if the boolean is set to false. The includeUnloadableChunks boolean is used to override neverUnload setting of the Chunks. Setting the boolean to true will unload all Chunks even if some are set to never unload. |+^Description | Unloads all loaded Chunks from the game. If cacheUnloadedChunks is true, the Chunks unloaded will keep a serialized state in memory to be serialized to a save file in the next serialization call. The state is discarded if the boolean is set to false. The includeUnloadableChunks boolean is used to override the neverUnload setting of the Chunks. Setting the boolean to true will unload all Chunks even if some are set to never unload. |
  
 ^Method | Task **UnloadChunks**(bool includeUnloadableChunks, CancellationToken cancellationToken, bool cacheUnloadedChunks = true, params [[Chunk]][] chunks) | ^Method | Task **UnloadChunks**(bool includeUnloadableChunks, CancellationToken cancellationToken, bool cacheUnloadedChunks = true, params [[Chunk]][] chunks) |
-^Description | Unloads all specified Chunks from the game. If cacheUnloadedChunks is true, the Chunks unloaded will keep a serialized state in memory to be serialized to a save file in the next serialization call. The state is discarded if the boolean is set to false. The includeUnloadableChunks boolean is used to override neverUnload setting of the Chunks. Setting the boolean to true will unload all Chunks even if some are set to never unload. |+^Description | Unloads all specified Chunks from the game. Chunks set to neverUnload are skipped unless includeUnloadableChunks is true. If cacheUnloadedChunks is true, the Chunks unloaded will keep a serialized state in memory to be serialized to a save file in the next serialization call. The state is discarded if the boolean is set to false. The includeUnloadableChunks boolean is used to override the neverUnload setting of the Chunks. Setting the boolean to true will unload all specified Chunks even if some are set to never unload. | 
ichunkloadingservice.1777185747.txt.gz · Last modified: by diviner

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki