Give Page Feedback

Worlds - Overview

Worlds are the most important Components in the Streamable Assets Manager toolkit. They are the physical manifestations of Streamable Grids, taking the Grid's data and combining it with its own data to produce a virtual game world in tangible Scene Space. The configuration of the World also enables the use of the World Designer Tool, which offers powerful editing capabilities for iterating on your World.

In most games a single World will suffice, however you are free to make use of as many Worlds as you wish. You can also create and destroy Worlds at runtime using the robust API.

Breakdown of a World

World's are made up of of one or more World Groupings, with each World Grouping representing a different element of the world (the base terrain/ground meshes could be one element, forest assets another, houses a third, and so on). These elements operate independenly, but combine together to form a complex and enjoyable World for your players.

Each World Grouping is made up of a collection of World Cells, which serve as vessels for Asset Chunks. They are very similar to Streamable Cells except that they are actual C# objects rather than just a concept. They also have position within the Scene Space and hold a ton of data, including the Asset Chunk Set, Cell bounding box within the scene, the current LOD in use, and neighboring World Cells. In reality, this is an important class, so if you'd like to know more you can take a look at the World Cell Section within the Secondary Non Components Chapter.

Tell Me More About World Cells

Requests Processor

Worlds make decisions about which World Cells need to be loaded or unloaded, and which LOD Assets need to be used by the World Cells, by tracking users. A user is simply any entity that requires a specific set of LOD Assets for a World Cell on a particular World Grouping to be loaded.

User requests come in the form of Add Requests and Remove Requests (Remove Requests must correspond to previous Add Requests!). These requests can come from external sources such as Active Grids, or as a consequence of loading and unloading World Regions. Whatever the source, all requests are tallied by the World, which allows competing requests to cancel each other out. If the final tally does not result in all add/remove requests cancelling each other out, a World Update is initiated. This results in the following possible changes to World Cells:

1) If a World Cell is not currently loaded and it has user additions, the World Cell is loaded using the highest quality LOD Assets that have users. The World Cell has a mechanism for tracking the number of users for each of it's LODs. This mechanism is updated to reflect the initial number of users for each LOD.

2) If a World Cell is already loaded, its internal tracking mechanism is updated to reflect the addition or subtraction of users for each LOD. Then, one of the following occurs:

a) If the World Cell gains users for a higher quality LOD than is currently in use, the World Cell is transitioned to use the highest quality LOD assets.

b) If the World Cell's user count for the current LOD in use reaches 0, but it has users of a lower quality LOD, it transitions to use the next highest quality LOD assets.

c) If the World Cell's user count for all LODs reaches 0, the World Cell is unloaded.

There are two very important things to note here:

1) The highest quality LOD that has users is always used for any given World Cell, regardless of the number of users for that LOD. For example, if a World Cell has 6 users for LOD 3 and only 1 user for LOD 1, LOD 1 will still be used.

This is intended to ensure that users in need of higher quality assets always have access to them, as it's assumed that it would be a greater detriment to serve lower quality assets to a user in need of higher quality ones, rather than serving higher quality assets to users in need of lower quality ones.

2) When a World Cell transitions from using one set of LOD Assets to another, the World treats it as if an entirely new World Cell (using the new LOD assets) needs to be loaded, and the old World Cell (using the old LOD assets) needs to be unloaded. These World Cells are processed in the same way as other Cells that are about to be unloaded or loaded (but not due to an LOD transition).

Because the actual physical World Cell object changes, any references you have to the old World Cell object will become invalid. You should update these references using a World Grouping Listener in such cases.

Learn About World Grouping Listeners

Component Linker and Driver

Worlds make linking secondary components like Chunk Managers and Chunk Streamers to specific World Groupings and/or LODs easier. In addition, any component linked to any field on the World has its execution driven by the World. This allows for coroutine like method implementations capable of running logic over multiple frames, but driven by a single StartCoroutine call which reduces garbage generation.

The linking behavior also makes is easy for Worlds to be pre-configured as prototypes, which is necessary for creating Worlds at runtime that can persist between game saves.

Anatomy of a World Update

It may interest you to know how a World Update Cycle is carried out. Note that this is just a general overview. There are numerous secondary operations performed that are not accounted for in this diagram (such as World Grouping Listener Notifications, World Cell Visual Transition Controllers being executed, and so on).

World Update Cycle Diagram