▪️2.1 Complex Elements

In the first version of the Metaverse Components, elements were limited to arrays, effectively serving as an enumeration type from which users would select a specific value during the Mint process. This approach, however, proves to be insufficient as Components within the Metaverse often embody a higher degree of complexity and necessitate more advanced data description capabilities for their intricate representation.

To address this, we have introduced an upgraded structure for configuring elements, aimed at supporting a wider array of data types. This enhancement is crafted to facilitate the representation of complex data and to significantly expand the protocol's flexibility and utility.

Enhanced Elements Structure Definition

In V1 version, the elements structure within our protocol is defined as a dictionary, where the keys represent the names of elements, and the values are arrays containing candidate values for those elements. To extend the capability of this structure to support various data types—such as integers, float numbers, and strings—we propose the following advanced schema:

{
  "elements": {
    "Race": {
      "type": "enum",
      "values": ["Human"]
    },
    "Sub Race": {
      "type": "enum",
      "values": ["Warrior"]
    },
    "Gender": {
      "type": "enum",
      "values": ["Male", "Female"]
    },
    "Hair Color": {
      "type": "enum",
      "values": ["Black", "Brown", "Blonde"]
    },
    "Age": {
      "type": "integer",
      "range": [1, 100]
    },
    "Height": {
      "type": "float",
      "range": [1.0, 2.5]
    },
    "Name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 50
    },
    "Clothing": {
      "type": "enum",
      "values": [
        "Battle Armor",
        "Chainmail",
        "Samurai Robe",
        "Leather Armor",
        "Leopard Print Robe",
        "Brocade Battle Dress",
        "Tiger Skin Battle Dress",
        "Phoenix Armor",
        "Wolf Spirit Battle Dress",
        "Python Scale Armor",
        "Kirin Battle Armor",
        "White Fox Fur Battle Dress"
      ]
    },
    "Accessory": {
      "type": "enum",
      "values": [
        "Cloak",
        "Helmet",
        "Headband",
        "Heavy Armor Helmet"
      ]
    }
  }
}

Guides

  • Data Type Specification: For each element, a type field specifies the data type, such as enum for enumerations, integer for whole numbers, float for decimal numbers, and string for textual data.

  • Value Constraints: Depending on the type, additional constraints can be applied:

    • For enum, a list of values represents the permissible options.

    • For integer and float, a range defines the minimum and maximum allowable values.

    • For string, minLength and maxLength establish the bounds for the string's length.

Please note that BRC1024 Version 1 (the first version) is fully compatible with the new Version 2 (V2). In V1, the value of elements is an array, whereas in V2, the new version, the value is a dictionary (to support more complex data types and additional attributes). When processing these data, some compatibility checks need to be performed. One method to achieve compatibility is to check the value type of each element and then process it accordingly based on its type. When encountering an element, first determine whether its value is an array or a dictionary.

  • If it is an array, then process it according to the logic of the old version (i.e., assume all values are candidate values).

  • If it is a dictionary, then process it according to the logic of the new version, extracting and using type information, range, length constraints, and other attributes.

Last updated