Category:Type

Category page
Revision as of 00:18, 14 April 2024 by TheAutopilot (talk | contribs) (added info on generic types)

A type describes a range of possible values. This includes numbers or other primitive types, but also more abstract concepts ranging from text, users, join requests up to just “parts of a world”.

Categorization

Types can be split into different categories. In many situations there is some kind of distinction between “simple” and “complex” types.

The specifics are dependent on the context you are talking about.

ProtoFlux

Execution of ProtoFlux is a local phenomenon that runs on the computer that started it. In fact the ProtoFlux implementation has been designed to be independent of FrooxEngine.[Citation needed]


In summary it stays close to the underlying C# standards. C# differentiates types based on where the value is stored:

Category (ProtoFlux) Category (C#) Description
Value Type Value Type The value is stored directly within the variable/property.
Object Type Reference Type The value exists somewhere in memory. Variables/properties contain a reference to the memory location.
Object types also form a hierarchy where an instance of a sub-type will always be an instance of a super-type. This allows a general concept (i.e. a collider) to be implemented in different ways. (BoxCollider, SphereCollider etc.)

Also see: Enums, a subcategory of value types.

World Model

The world model of Resonite needs to be kept consistent for multiple users. Where a value is stored locally is far less important than how it is communicated across the network.

In effect this means that when dealing with components and their properties one has to differentiate among the following categories:

Category All Types Description
Values Value Types, strings, URIs, Nullable and IEncodable The value will be written into and read from a network message as-is.
References IWorldElement and all its derivatives (e.g. Slot) The referenced object can be uniquely identified by a RefID which will be sent via the network. The receiver will then do a lookup to determine their own instance of that object.
Types Type Types aren't just used in properties. They are also very important internally to inform other users of newly created components. Therefore they are preferrably encoded as a simple number to avoid wasting network traffic. If such a shorthand is not yet available the full type name will be transmitted instead.
As of 2024.4.3.1170 the shorthand is lazily and asynchronously generated by the host. There is one lookup-table per Session.
(Speculation: The requirement of session information may be the reason why this has a separate implementation to values.)
Delegates WorldDelegate Delegates reference a method of a specific object instance. The network message contains the RefID to identify the instance and the name/declaring type of the method.
Be aware that strings, URIs and Nullable are objects in ProtoFlux but values for the world model!
This is especially visible when working with Dynamic Variables.

Generic Types

Generic types are special in that they have type arguments which have to be filled with another type before you can use them. They allow a programmer to write code that can be specialised for a specific use-case without additional implementation. (written once, applied for many types)

They are often used for components that store or process values. Properties and many ProtoFlux nodes are also implemented via generic types.

Type arguments have to be specified in the node browser or component attacher to create a generic node/component.
If you use a generic type as an argument, follow the instructions within the article Complex Types in Components!

Subcategories

This category has the following 2 subcategories, out of 2 total.

E

V

Pages in category "Type"

The following 200 pages are in this category, out of 224 total.

(previous page) (next page)
(previous page) (next page)