Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
VarianceAPI
VarianceAPI allows you to create Variants for CharacterBodies, Variants can have different textures, lights, skills, and more. Now updated for Hallowed Concepts!
| Date uploaded | 8 hours ago |
| Version | 3.0.0 |
| Download link | Nebby-VarianceAPI-3.0.0.zip |
| Downloads | 115 |
| Dependency string | Nebby-VarianceAPI-3.0.0 |
This mod requires the following mods to function
RiskofThunder-R2API_Prefab
API for Prefab creation, networking and duplication
Preferred version: 1.1.1TeamMoonstorm-MoonstormSharedUtils
An API focused with the intention of working in an editor enviroment using ThunderKit, MSU is a modular API system designed for ease of use and simplicity.
Preferred version: 2.6.2Nebby-Mackysoft_SerializeReferenceExtensions
Unofficial Runtime Redistribution of Mackysoft's SerializeReferenceExtensions Package
Preferred version: 2.1.0README
VarianceAPI
VarianceAPI is a library designed to add "Character Variants" to existing Characters in the game.
The original concept can be found here by Rob, the mod's features plus this addon's features merged together to become VarianceAPI.
Want a Lemurian that's twice the size and spits flames like a Flamethrower? Want a golem that fires lasers nonstop? All of this and more are possible with VarianceAPI.

Features
Flexible Development Environment
VarianceAPI has support for developing new Variants either inside the Unity Editor utilizing Thunderkit, or entirely at Runtime.
Support for creating variants entirely at runtime is via the utilization of the CharacterVariantDefBuilder.
While VarianceAPI has MoonstormSharedUtils as a dependency, it is not necessary to interact with it majorly to add variants, it is used mostly to avoid having code duplication between both libraries.
Regardless if you utilize Thunderkit or not, VarianceAPI can be used in your workflow.
Persistent CharacterVariantDefs
CharacterVariantDefs are persistent for a body, once a Body spawns, and has available variants. The VariantSpawnManager will roll CharacterVariantDefs to apply to the body.
Once the CharacterVariantDefs are applied, if the body has a master they'll be stored on the CharacterMasterVariantStorage, and they'll be set in stone until the Master is destroyed.
This allows for Devoted Lemurians to keep the CharacterVariantDefs assigned to them, alongside more interactions with other mods.
Lobby Support
When you create new Variants, they're added to VariantPacks. An end user can afterwards disable or enable your pack at will, similar to ExpansionDefs.

Furthermore, individual variants can be toggled on and off further if enabled in the config file

Powered by Serialize Reference
VarianceAPI 3.0.0 utilizes the SerializeReference attribute to its fullest potential. While VarianceAPI comes bundled with existing implementations of SerializableReferences, you can create your own implementations and use them on your own VariantPacks.
IVariantMasterModifier: Interface for modifying aCharacterMasterwhen the variant is applied. Built in modifiers:UnstableAIModifier: Forces the AI to use it's "Low Health Attacks" regardless of their actual health fractionAlwaysSprintAIModifier: Forces the AI to sprint alwaysAISkillDriverAimVectorModifier: Allows the modification of a specificAISkillDriver's aim vector dampBaseAIDampModifier: Allows the modification of an entire AI's aim vector dampReplaceSkillDrivers: Allows for the complete replacement of aCharacterMaster'sAISkillDrivers
IVariantBodyModifier: Interface for modifying a CharacterBody when the variant is applied. Built in Modifiers:LoadCharacterSoundbank: Interface for loading a Character's Soundbank when the variant is applied
IVariantNameProvider: Interface for modifying a CharacterBody's display name while the variant is applied. Built in Providers:IVariantNameFormatter: Uses a format token to retrieve the variant's nameVariantNamePrefix: Appends a token at the beginning of the character's nameVariantNameSuffix: Appends a token at the end of the character's nameVariantNameOverride: Replaces a character's name
IVariantStatModifier: Interface for creating stat modifications for the CharacterBody while the variant is applied. These stat modifications are driven by R2API's RecalculatestatsAPI. Built in Modifiers:BasicStatModifiers: Reimplementation of VarianceAPI 2.0's stat modifiers
Scripted Variant Spawns
VarianceAPI comes bundled with three different ways to simplify the spawns of monsters, you can utilize these to ensure a Monster being summoned or spawned is a variant or not.
VariantMasterSummon- Wraps an existingMasterSummoninstance and modifies the spawned instance to become a variantVariantDirectorSpawnRequest- Wraps an existingDirectorSpawnRequestinstance and modifies the spawned instance to become a variantVAPIUtils.TransformSpawnedInstanceIntoVariant()- Used to transform any spawned instance into a variant
Console Commands
The following console commands can be used to test your variants in development:
vapi_list_bodies: Lists all the CharacterBodies that have Variantsvapi_list_body_variants: Lists all the CharacterVariantDefs assigned to a specific CharacterBodyvapi_spawn_ai: Summons a CharacterMaster with the specified Variants.vapi_spawn_as: Respawns the sender as the specified CharacterBody with the specified Variants.
Official Variant Packs
(Note: click the icon to open a new tab to the variant pack)
Donations
VarianceAPI is made with no AI assistance and is completely free.
If you wish to support the work I do, consider buying me a Ko-fi, button below.
Special Thanks
- KevinFromHPCustomerService for teaching me how to use Thunderkit way back in the day.
- IDeathHD and Harb, for making DebugToolkit and it's
spawn_aiandspawn_ascommands (used forvapi_spawn_aiandvapi_spawn_ascommands) - IDeathHD and Chinchi for general networking help
- Aaron, Gaforb,
come on and SLAM, EarthZebra and especially TheTimeSweeperly habibifor helping me with networking issues. - Aaron for helping with the creation of the WeightedSelection roll for unique variants
- Dotflare for making the Variance Artifact assets
- PassivePicasso for the development of Thunderkit
- Rob for creating Monster Variants.
- Papa zach for creating the Artifact & Expansion Icons
- Mackysoft for letting me use and redistribute his "SerializeReferenceExtensions" package.
- GrooveSalad for his ExpansionManager code, which was used as a base to create the variant rulebook categories
- MysticalChicken and Zenithrium for feedback regarding tokens
CHANGELOG
'3.0.0' - Long Term Support
- This release marks the first LTS support for VarianceAPI.
- A complete rewrite of the codebase has been done to address issues and improve the health of the project
- There are a lot of changes that are very likely undocumented (given that it was a complete rewrite), but below should be the key points.
- Regardless, VAPI comes with built in documentation using XML, so that should help out :)
General Changes
- Thunderkit is no longer required to make new Variants.
- Added dependency to "Mackysoft's SerializeReferenceExtensions"
- This dependency is used to replace the plethora of ScriptableObjects VAPI required, the amount went from 7 to just 3
- This dependency is required to be installed from the github repository if using thunderkit, otherwise the runtime redistribution marked as VAPI's dependency can be used for code only Variants.
- all classes are marked as sealed, except for the ones that are intended to be inherited from.
- The following ScriptableObjects have been replaced/deleted
VariantDef->CharacterVariantDef(Scriptable Object)VariantTierDef->CharacterVariantTierDef(ScriptableObject)VariantInventory-> (Items and Equipment:VariantInventoryDefintion(C# class)) - (Buffs:VariantBuffStorage(C# class))VariantPackDef->VariantPack(C# class)VariantSizeModifier->floatfield in ```CharacterVariantDef``VariantSpawnCondition->IVariantSpawnCondition(SerializableReference interface)VariantVisuals->CharacterVariantVisualModifier(ScriptableObject)
- Referencing base game assets (such as
EquipmentDef,ItemDef,CharacterBodyis done via R2API's AddressReferencedAssets)
Runtime Changes
CharacterVariantDefsare now persistent on a body- Once the Body rolls the
CharacterVariantDefs, they're stored in theCharacterMasterobject. - Next time the Body spawns, the
CharacterVariantDefsstored in theCharacterMasterobject are used instead of rolling for new ones - Modifications applied to the master are unapplied if the Body's index changes
- Once the Body rolls the
- Added support for creating
CharacterVariantDefs at runtime utilizing theCharacterVariantDefBuilder- Contains chainable methods for defining new character variants
- Added basic cloning support for
CharacterVariantDefs- Creating a Devoted Lemurian variant from an existing Lemurian variant is as simple as calling
VariantCloning.CloneIntoDevotedLemurian
- Creating a Devoted Lemurian variant from an existing Lemurian variant is as simple as calling
Editor Changes
- VariantPacks are no longer ScriptableObjects and instead are C# classes similar to ContentPacks
- There's Wizards for upgrading your old scriptable objects to the new ones:
Tools/VAPI/VariantPack ScriptableObject Migration Wizard: Used to migrate from VAPI 2.0 to VAPI 3.0 Scriptable ObjectsTools/VAPI/Migrate AddressReferencedAsset Catalog Loads to GUID Loads: Used to migrate from referencing items/buffs/equipments/characters from Catalog names to GUIDS.
- Mackysoft's SerializeReferenceExtensions is required to utilize the new interface setups explained on the Runtime Changes section.
