Reference Frame Adjustment

From HEWIKI
Jump to: navigation, search



Contents

Overview

AreaArchitectureUniqueFramesOfReference.gif
AreaArchitectureReferenceAdjustedPosition.gif

In HeroEngine, every area operates in its own unique frame of reference and typically area geometry is positioned "near" the origin for the area's frame of reference. Because each area is its own unique frame of reference, this eliminates the problems large-scale MMOs encounter with the size of their game world. Without a reference frame adjustment, floating point inaccuracies as players move farther from the origin (0,0,0) creep in leading to endless problems with positional accuracy, animations and so forth. With HeroEngine, using the Seamless World technology, there is effectively no limit to the size of the game world.

When users are proxied across area bounds, something must occur so that the character's position appears to be coincident in the linked areas in spite of the different frames of reference. Positions from other servers are be adjusted to be in the current area's frame of reference and at the instant that the client switches areas any locally cached positions must be "rehomed".


Concepts

Usage

Designating Fields For Reference Frame Adjustment

DOMEditorReferenceFrameAdjustment.png

Reference frame adjustment is controlled by replication and a new field level parameter has been added to the schema for field definitions. As of release v1.22, only replicated top-level fields of type Vector3 perform reference adjustment. The offset applied to a reference fame adjusted field is determined at the time a Seamless Area Link is established between one area instance and another.

Using the DOM Editor or CLI, modify the field definition so that its Reference Adjust parameter is set to Yes.


Establishing the Offset for Reference Frame Adjustment

Calculating the offset to perform reference frame adjustment requires that some mechanism that is able to define the point at which the areas are coincident. Using the MMO Foundation Framework's implementation of Seamless Area Links, a link is represented by Transition Topology that exists in both areas.

currentAreaTopologyPosition as vector3                      // position of the transition piece in the current area instance
destinationAreaTopologyPosition as vector3                  // position of the transition piece in the destination area instance
offset as Vector3 = currentAreaTopologyPosition - destinationAreaTopologyPosition

Once the offset has been determined, it can be used during the establishment of a link between the two area instances.

// This is asychronous, a callback is made to _SeamlessLinkEstablished upon completion of the link
$AREA._EstablishSeamlessLink( destinationAreaID, destinationInstanceID, offset )

The Seamless Area Links system stores the position of all transition topology in a prototype and updates it during edit time should the transition topology be repositioned. Using those stored positions, it calculates an offset when it establishes a connection between two area instances.

Get the Reference Frame Offset Between Area Instances

On the client, the external function LookupAreaOffset() provides the offset between the currently active area instance and a specified foreign area instance.

offset as vector3
if LookupAreaOffset(localAreaID, localInstanceID, foreignAreaID, foreignInstanceID, offset)
  // found an offset
.


Application of Offset During Replication Group Rehoming

On the client when it transfers from one frame of reference (Area 1) to another frame of reference (Area 2), all replication groups receive a callback to their _OnReplicationGroupRehomed() method. This callback provides the opportunity to perform specialized logic for client systems to deal with the frame of reference change, for example updating stored positions to account for the new offset.

In the MMO Foundation Framework implementation, the rehoming callback is used to apply offset adjustment to controlled character so they appear to be coincident with their position from the previous area. This adjustment is performed in the _ApplyOffset() method of the HeroEngine_ACCController.

Reference

Script API

// When a client changes areas seamlessly, the OnReplicationGroupRehomed method is called on each replication group's
// primary node on that client.  This is a good opportunity to update any stored positions to the new frame of reference.
// For instance, it calls _ApplyOffset on the ACCC controller.
method _OnReplicationGroupRehomed(oldArea as ID, oldInstance as ID, oldOffset as Vector3, newArea as ID, newInstance as ID, newOffset as Vector3)
 
external function LookupAreaOffset(localArea as ID, localInstance as ID, foreignArea as ID, foreignInstance as ID, offset references Vector3) as Boolean
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox