Resolver

Revision as of 12:57, 3 March 2024 by Frank The Farmer (talk | contribs) (Resolved some missing property information)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Preface

The resolver JSON is responsible for assigning a Pokémon species its model, textures, and poser. It is also responsible for assigning aspects to a pokemon to create variants like regional forms. Just about anything related to visuals is linked to the resolver file in some way.

The resolver file was previously known as the asset species file or similar. This was changed to prevent confusion between this file and the species files in the data folder. Because of this, many addons created before Cobblemon version 1.4 are using the species folder to hold resolver files.

Resolver File Breakdown

The resolver controls just about everything regarding a Pokémon's assets. Besides the model, animations, and form assets, it is also where you apply the data for animated and emissive textures!

While you can keep all of a Pokémon's resolver data inside of one file, separating resolver data for different forms or variants can help keep things organized. It will also prevent potential conflicts if another addon creator wants to modify something you have made.

Here is a breakdown of three different types of resolver file.

  • Vulpix: Very common format for resolvers
{
 "species": "cobblemon:vulpix",
 "order": 0,
 "variations": [
   {
     "aspects": [],
     "poser": "cobblemon:vulpix",
     "model": "cobblemon:vulpix.geo",
     "texture": "cobblemon:textures/pokemon/0037_vulpix/vulpix.png",
     "layers": []
   },
   {
     "aspects": [
       "shiny"
     ],
     "texture": "cobblemon:textures/pokemon/0037_vulpix/vulpix_shiny.png"
   }
 ]
}


  • Alolan Vulpix: A second resolver for vulpix to assign its regional form assets
    • Due to its naming scheme, the alolan vulpix resolver loads after the previous vulpix resolver.
    • The Alolan aspect comes from the alolan species feature.
{
 "species": "cobblemon:vulpix",
 "order": 1,
 "variations": [
   {
     "aspects": [
       "alolan"
     ],
     "model": "cobblemon:vulpix_alolan.geo",
     "texture": "cobblemon:textures/pokemon/0037_vulpix/vulpix_alolan.png"
   },
   {
     "aspects": [
       "alolan",
       "shiny"
     ],
     "texture": "cobblemon:textures/pokemon/0037_vulpix/vulpix_alolan_shiny.png"
   }
 ]
}


  • Charizard: Charizard uses both animated and emissive textures!
{
 "species": "cobblemon:charizard",
 "order": 0,
 "variations": [
   {
     "aspects": [],
     "poser": "cobblemon:charizard",
     "model": "cobblemon:charizard.geo",
     "texture": "cobblemon:textures/pokemon/0006_charizard/charizard.png",
     "layers": [
       {
         "name": "flame",
         "texture": {
           "frames": [
             "cobblemon:textures/pokemon/0006_charizard/flame/tail1.png",
             "cobblemon:textures/pokemon/0006_charizard/flame/tail2.png",
             "cobblemon:textures/pokemon/0006_charizard/flame/tail3.png",
             "cobblemon:textures/pokemon/0006_charizard/flame/tail4.png"
           ],
           "fps": 10,
           "loop": true
         },
         "emissive": true
       },
       {
         "name": "glow",
         "texture": "cobblemon:textures/pokemon/0006_charizard/charizard_emissive.png",
         "emissive": true,
         "translucent": true
       }
     ]
   },
   {
     "aspects": [
       "shiny"
     ],
     "texture": "cobblemon:textures/pokemon/0006_charizard/charizard_shiny.png",
     "layers": [
       {
         "name": "glow",
         "texture": "cobblemon:textures/pokemon/0006_charizard/charizard_shiny_emissive.png",
         "emissive": true,
         "translucent": true
       }
     ]
   }
 ]
}


Special Layer Properties And When To Use Them

Cobblemon's layer system can be used for applying special effects to models through textures. You can use it to apply specially made textures that get layered over the model's main texture while assigning the layer certain properties. Only layers can have these special properties, so keep that in mind when creating textures.

Emissive

The emissive property allows the assigned texture to become emissive. Emissive textures are unaffected by light levels and give off the illusion of glowing in the dark. These textures are enhanced when combined with shaders and the species property for dynamic lighting.


Some basic examples of emissives are:

  • Glowing eyes like on Hoothoot or Patrat
  • Light emitting body parts like on the Mareep line or Volbeat
  • Flames of the many different fire types


The emissive property can also be combined with the other two properties for enhanced lighting effects. The most common example of emissives are the flames on fire type Pokémon. These layers are often combining the emissive property with the properties associated with animated textures. This property combination is not limited to making fire, so try and get creative.


Below is an example of Charizard's "glow" texture layer with the emissive property applied.

      {
        "name": "glow",
        "texture": "cobblemon:textures/pokemon/0006_charizard/charizard_shiny_emissive.png",
        "emissive": true,
        "translucent": true
      }


Translucent

The translucent property allows the assigned texture to become translucent based on the opacity value of each pixel. The closer this value is to 0, the more translucent it becomes. This property is mainly used to enhance the emissive layer by adding translucent pixels expanding away from the emissive layer's pixels. This creates the effect of light getting dimmer the further you get from a Pokemon's light source.

Translucency has visual bugs when combined with water in game. This has led to it rarely being used to create translucent body parts. While there are some creative solutions to get around these visual bugs, it is simpler to use inverted cubes instead.

Due to the previously mentioned visual bug, there aren't many examples of translucent layers. Some of the few examples of translucency are:

  • Secondary emissive textures like those found on Charizard or Umbreon.


Below is an example of Charizard's "glow" texture layer with the translucent property applied.

      {
        "name": "glow",
        "texture": "cobblemon:textures/pokemon/0006_charizard/charizard_shiny_emissive.png",
        "emissive": true,
        "translucent": true
      }


Frames, FPS, and Loop

The frames, fps, and loop properties are required in order to create animated textures. Cobblemon's animated textures use frame-by-frame animation, so you will want to use all three of these together.

  • frames is where you will list each frame of the animation. You need to create an array of textures to use.
  • fps is where you will assign how many frames will player per second. Requires a number value.
  • loop is where you will define if the animation will loop or not. Boolean. There's probably no reason you'd want this set to false.


These three properties can be combined with both emissive and translucent to create animated light effects on Pokémon. The most common example of animated textures are the flames on fire Pokémon. Currently, the only other example of animated textures are Elgyem's and Beheeyem's color changing fingers.

Below is an example of Charizard's animated flame texture layer. You can hover over the underlined text to see more details.

       {
         "name": "flame",
         "texture": {
           "frames": [
             "cobblemon:textures/pokemon/0006_charizard/flame/tail1.png",
             "cobblemon:textures/pokemon/0006_charizard/flame/tail2.png",
             "cobblemon:textures/pokemon/0006_charizard/flame/tail3.png",
             "cobblemon:textures/pokemon/0006_charizard/flame/tail4.png"
           ],
           "fps": 10,
           "loop": true
         },
         "emissive": true
       }


Resolver File Examples

When creating your own resolvers, it would be easiest to use resolvers similar to what you need as a template.

Here are some examples from the Gitlab you can reference. You may also want to reference the models of each example in game so you can see the effects that their resolver file create.