Skip to main content

Adjunct Overview

  • Adjunct is the main way to extend Septopus functionality. The entire Septopus framework is designed to facilitate the extension of Adjunct. Adjunct use the Septopus Coordinate System.

  • The parsing of Adjunct is also a pure Javascript file, which can be deployed on the chain to realize the full chain of Septopus, including data and programs.

  • Adjunct codes should be referenced as little as possible (even if referenced, they should be packaged as a whole), and should mainly be in a called state to reduce their autonomous behavior and facilitate security review.

  • Adjunct operates on Block Coordinates (A coordinate system), that is, it calculates and processes standard data (std).

  • Different World can be configured to support different Adjunct, thus forming different styles of World.

  • The code sample of Adjunct is as follows, maintaining a clear structure for easy understanding and development.

CategoryFunctionMounting
HookRegister componentADJUNCT.hook
DefinitionComponent configuration, component constantsADJUNCT.def
AnimationBasic standard animation, customize animationADJUNCT.hook.animate()
ConvertionConversion of data of different standardsADJUNCT.transform
Data OperationModifications made to raw dataADJUNCT.attribute
IO MenuOutput standard IO menu, input data verificationADJUNCT.menu
Trigger TaskMethods that can be called after the mechanism is triggeredADJUNCT.task
    const self={
hooks:{
reg:()=>{},
def:(data)=>{},
animate:(meshes,cfg)=>{},
...
},
transform:{
raw_std:(arr,cvt)=>{},
std_3d:(arr,elevation)=>{},
std_active:(arr,elevation,index)=>{},
std_2d:(stds,face,faces)=>{},
...
},
attribute:{
add:(p, raw)=>{},
set:(p, raw, limit)=>{},
remove:(p, raw)=>{},
combine:(p, row)=>{},
revise:(p, row, limit)=>{},
},
menu:{
pop:()=>{},
sidebar:()=>{},
...
},
task:{
router:["hide","show","dance"],
hide:(meshes,cfg)=>{},
show:(meshes,cfg)=>{},
dance:(meshes,cfg)=>{},
...
},
};

const adjunct={
hooks:self.hooks,
transform:self.transform,
attribute:self.attribute,
menu:self.menu,
task:self.task,
}

export default adjunct;

Basic Adjuncts

  • When implementing Septopus functions, there are several basic components that build the basic operating environment.
NameFunctionDetailCode
StopBasic constructure, stop the player's movement, raise the player's standing heightStop Detailbasic_stop.js
TriggerBasic constructure, build the core of the game, realize triggering in various 3D spaces, control the system and adjunctsTrigger Detailbasic_trigger.js
BoxThe simplest adjunct for easy understandingBox Detailbasic_box.js
ModuleImport external model adjunct to enrich the basic components of the contentModule Detailbasic_module.js
  • Complex function Adjuncts are built as foundational components and are specified in the world configuration for easy loading. Extended Ajuncts are primarily used to implement 3D content, transforming Septopus into a rich and diverse virtual world.

Hooks

  • Methods for framework calls, the main functions are as follows.
NameFunctionDetail
regProvide basic information about AdjunctOnly run once, the framework actively calls
initAdjunct data that needs to be mounted on the cacheOnly run once, the framework actively calls
animateanimate is the entry point for animation effectsThe renderer method loaded into the frame synchronization queue will filter out the Adjunct object and then call this method

Basic Parameters

  • Adjuncts are displayed in a virtual 3D world, so the required parameters are size, position and rotation.
NameFormatDetail
size[number,number,number]Adjunct size [x,y,z]
postion[number,number,number]Adjunct position [ox,oy,oz]
rotation[number,number,number]Adjunct rotation [rx,ry,rz]

Edit Functions

  • The editing method is mounted under ADJUNCT.menu and outputs an array that meets the front-end requirements.
    {
pop:()=>{return []},
sidebar:()=>{return []}
}
  • Adjunct editing follows the framework's editing process, accepting standard editing parameters. This works by processing the raw data at runtime and then refreshing the entire block, implementing editing on a block basis.

Data Conversation

  • The data conversion method is mounted under ADJUNCT.transform. It is based on standard data (std) and converted into various types of data, which are processed uniformly by the framework.
MethodFromToMain Functions
ADJUNCT.transform.raw_stdRaw dataStandard dataThe on-chain data is formatted into the data required at runtime for rendering, etc.
ADJUNCT.transform.std_rawStandard dataRaw dataGet the saved data, upload to the chain or copy
ADJUNCT.transform.std_3dStandard data3D Render dataGenerate 3D data of Block Coordinates, mainly for further display
ADJUNCT.transform.std_2dStandard data2D Render dataGenerate 2D data of Block coordinates for drawing 2D maps and displaying different perspectives
ADJUNCT.transform.std_activeStandard data3D Render dataGenerates selected effect data of Adjunct for use in Edit Mode
  • 2D data is constructed based on the rendering data (3d) generated by ADJUNCT.transform.std_3d, supporting the results of observation from different angles.

Animation

  • The entry point of the animation is hook.animate(meshes,cfg).

  • Adjunct can use the system's built-in Standard Animation to achieve animation effects, or combine Standard Animation to achieve more complex animations.

  • Adjuncts can also customize animation methods to manipulate meshes, thereby achieving special animation effects in 3D scenes.

Trigger Task

  • Task is a method called by Trigger and is organized in the following structure. When setting the calling method in Trigger, use index to point to it.
    {
task_b:(target,cfg)=>{},
task_c:(target,cfg)=>{},
task_a:(target,cfg)=>{},
router:["task_a","task_b","task_c"],
}

Resource Loading

  • Adjuncts uses resources stored in IPFS, mainly the following types. Resource is mounted to a specified location when parsing raw, so that the framework can filter and load it.

  • In order to prevent the large amount of data from being parsed and causing lag, the resource loading is done in a frame-by-frame manner.

Common Definition

  • The common definition adopted by Adjunct needs to be published on the chain.

      {
    "INDEX_OF_SIZE": 0,
    "SIZE_X": 0,
    "SIZE_Y": 1,
    "SIZE_Z": 2,
    "INDEX_OF_POSITION": 1,
    "POSITION_X": 0,
    "POSITION_Y": 1,
    "POSITION_Z": 2,
    "INDEX_OF_ROTATION": 2,
    "ROTATION_X": 0,
    "ROTATION_Y": 1,
    "ROTATION_Z": 2,
    "FACE_TOP":0,
    "FACE_BOTTOM":1,
    "FACE_FRONT":2, //from south to north
    "FACE_BACK":3,
    "FACE_LEFT":4,
    "FACE_RIGTH":5,
    "MODE_NORMAL":1, //login player
    "MODE_EDIT":2, //edit mode on your own block
    "MODE_GAME":3, //preload all block data
    "MODE_GHOST":4, //anonymous player, no trig
    "INDEX_OF_RAW_ON_CHAIN_DATA":1, //block raw data index on chain
    "VERSION_DEFAULT":2025, //default version
    "EFFECTS_MOVING":0, //effects.moving
    "EFFECTS_ROTATE":1, //effects.rotate
    "EFFECTS_SCALE":2, //effects.scale
    "EFFECTS_TEXTURE":3, //effects.texture
    "EFFECTS_CUSTOMIZE":4, //effects.customize, by adjunct,
    }