Mode Protocol
-
Mode allows Meta Septopus to run in different environments and perform different tasks. Especially in Gaming Mode, which requires extremely high permissions, we have adopted a method of truncation of data access to ensure security.
-
Use the
modemethod ofFrameworkto switch modes. Call as follows:
const target = { x: x, y: y, world: world, container: dom_id }
const mode = def.MODE_EDIT;
VBW.mode(mode, target, (done) => {
});
Ghost Mode
- In the
Ghost Mode, players can move freely in the 3D world, but cannot purchase or updateBlocks.
Normal Mode
-
In
Normal Mode, players can move freely in the 3D world, purchase Blocks, and update Block content. -
In
Normal Mode, when a player stands on a Block they own, they can enterEdit Modeto edit and update the contents of the Block. -
In
Normal Mode, players cannot interact with content placed in a Block by other players.
Game Mode
- The game mode is to enhance the player's experience. There are two functions that need to be implemented: preloading and trigger support.
const target = { x: x, y: y, world: world, container: dom_id } //block to start game mode
const mode = def.MODE_GAME;
const cfg={
blocks:[ //blocks need to preload
[1982,619], //single block to load
[1983,619,5,5], //area to load, [block_start_x,block_start_y,extend_x,extend_y]
],
init:{ //game setting
sky:{}, //optional, set the sky
weather:{}, //optional, set the weather
start:{ //optional, set the start position of player
block:[1983,620],
position:[],
rotation:[],
},
},
}
VBW.mode(mode, target, (done) => {
});
-
In
Game Mode, all system requests are cut off and the status will not be updated. It only interacts with the setgame API. -
In
Game Mode, support for predefined external APIs is added, which are stored on the chain in plain text. Use the same definition astriggerto call system resources.- The
endmethod must exist to handle the normal end of the game and thegame serveraccepting data. - The
startmethod must exist to start the game and initialize the running environment of thegame server.
- The
const game_setting={
game:"fly",
baseurl:"https://game_API.fun",
methods:[
{
name:"end",
params:[],
response:[
{type:"string",length:12},
],
},
{
name:"start",
params:[],
response:[
{type:"string",length:12},
],
},
{
name:"view",
params:[
{type:"number",limit:[0,255]},
{type:"string",limit:[0,30]},
],
response:[
{key:"data",format:"string"},
],
},
...
],
}
Pre-rendering
- For better results, the baked data can also be loaded at this time.
Network Access Control
-
In
Game Mode, usingregion preloading, after acquiring all resources, the ability to retrieve data is cut off. Only interaction with thegame APIremains. Only when exiting game mode can thedatasourceAPI be used to continue retrieving data. -
This is done for two reasons.
- Game smoothness. When in game mode, since no other blocks are loaded, it will not be affected by data updates, improving performance.
- Security. Since the
datasourceAPI contains contract call methods, security issues can be avoided after disconnecting it in game mode.