You are viewing a potentially older version of this package. View all versions.
Nebby-VarianceAPI-3.0.0 icon

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_Rulebook-1.0.1 icon
RiskofThunder-R2API_Rulebook

API for registering rules to the Rule Catalog

Preferred version: 1.0.1
RiskofThunder-R2API_Prefab-1.1.1 icon
RiskofThunder-R2API_Prefab

API for Prefab creation, networking and duplication

Preferred version: 1.1.1
TeamMoonstorm-MoonstormSharedUtils-2.6.2 icon
TeamMoonstorm-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.2
Nebby-Mackysoft_SerializeReferenceExtensions-2.1.0 icon
Nebby-Mackysoft_SerializeReferenceExtensions

Unofficial Runtime Redistribution of Mackysoft's SerializeReferenceExtensions Package

Preferred version: 2.1.0

README

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.

"VariantShowcase"

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.

PackShowcase

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

VariantSelection

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 a CharacterMaster when the variant is applied. Built in modifiers:
    • UnstableAIModifier: Forces the AI to use it's "Low Health Attacks" regardless of their actual health fraction
    • AlwaysSprintAIModifier: Forces the AI to sprint always
    • AISkillDriverAimVectorModifier: Allows the modification of a specific AISkillDriver's aim vector damp
    • BaseAIDampModifier: Allows the modification of an entire AI's aim vector damp
    • ReplaceSkillDrivers: Allows for the complete replacement of a CharacterMaster's AISkillDrivers
  • 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 name
    • VariantNamePrefix: Appends a token at the beginning of the character's name
    • VariantNameSuffix: Appends a token at the end of the character's name
    • VariantNameOverride: 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 existing MasterSummon instance and modifies the spawned instance to become a variant
  • VariantDirectorSpawnRequest - Wraps an existing DirectorSpawnRequest instance and modifies the spawned instance to become a variant
  • VAPIUtils.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 Variants
  • vapi_list_body_variants: Lists all the CharacterVariantDefs assigned to a specific CharacterBody
  • vapi_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)

Icon/URL Name Description
TO30Icon The Original 30 The Original Thirty Variants developed by Rob, ported and modified to VarianceAPI.
NWIcon Nebby's Wrath 87 Variants spread across Base Game, Survivors of the Void, Seekers of the Storm and Alloyed Collective enemies.

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.

ko-fi

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_ai and spawn_as commands (used for vapi_spawn_ai and vapi_spawn_as commands)
  • IDeathHD and Chinchi for general networking help
  • Aaron, Gaforb, come on and SLAM, EarthZebra and especially TheTimeSweeper ly habibi for 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 -> float field in ```CharacterVariantDef``
    • VariantSpawnCondition -> IVariantSpawnCondition (SerializableReference interface)
    • VariantVisuals -> CharacterVariantVisualModifier (ScriptableObject)
  • Referencing base game assets (such as EquipmentDef, ItemDef, CharacterBody is done via R2API's AddressReferencedAssets)

Runtime Changes

  • CharacterVariantDefs are now persistent on a body
    • Once the Body rolls the CharacterVariantDefs, they're stored in the CharacterMaster object.
    • Next time the Body spawns, the CharacterVariantDefs stored in the CharacterMaster object are used instead of rolling for new ones
    • Modifications applied to the master are unapplied if the Body's index changes
  • Added support for creating CharacterVariantDefs at runtime utilizing the CharacterVariantDefBuilder
    • 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

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 Objects
    • Tools/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.