Table of Contents

Class OwnerBuilder

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Declares the fields of an archetype that only the session controlling the entity may see.

public sealed class OwnerBuilder
Inheritance
OwnerBuilder
Inherited Members

Remarks

A separate section, not a flag on a field. Owner fields have their own change groups and their own bit space, and they travel in SELF; the public record has no way to address them. That is a structural guarantee rather than a filter someone has to remember to apply — one player's credit balance cannot reach another player's client by a mistake in the encoder, because the encoder that writes public records cannot name the field.

The names are public even though the values are not. Every client receives the whole catalog, so an owner field's name and codec are visible to everyone. Owner visibility scopes values, never structure.

Methods

Field<TComponent, TField>(Comp<TComponent>, Expression<Func<TComponent, TField>>, Codec, string, string)

An owner-visible field, sent to the controlling session whenever it changes.

public OwnerBuilder Field<TComponent, TField>(Comp<TComponent> component, Expression<Func<TComponent, TField>> selector, Codec codec, string name = null, string group = null) where TComponent : unmanaged

Parameters

component Comp<TComponent>

The component handle.

selector Expression<Func<TComponent, TField>>

Selects the field — one member access, resolved once.

codec Codec

How the value travels.

name string

The wire name. null takes the field's own name.

group string

The owner change group. null takes DefaultOwnerGroup.

Returns

OwnerBuilder

This builder.

Type Parameters

TComponent

The component holding the field.

TField

The field's type.

Fraction<TComponent, TValue>(Comp<TComponent>, Expression<Func<TComponent, TValue>>, Expression<Func<TComponent, TValue>>, int, string, string)

The ratio of two fields of one component, owner-visible.

public OwnerBuilder Fraction<TComponent, TValue>(Comp<TComponent> component, Expression<Func<TComponent, TValue>> value, Expression<Func<TComponent, TValue>> max, int bits, string name, string group = null) where TComponent : unmanaged

Parameters

component Comp<TComponent>

The component handle.

value Expression<Func<TComponent, TValue>>

Selects the numerator.

max Expression<Func<TComponent, TValue>>

Selects the denominator.

bits int

Width of the ratio: 8, 16, 24 or 32.

name string

The wire name. Required.

group string

The owner change group. null takes DefaultOwnerGroup.

Returns

OwnerBuilder

This builder.

Type Parameters

TComponent

The component holding both fields.

TValue

The two fields' type.