Giter Site home page Giter Site logo

200tigersbloxed / lethalavatars Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 537 KB

A Lethal Company mod that allows you to export Avatars directly from Unity

License: GNU General Public License v3.0

C# 100.00%
bepinex-mod bepinex-plugin lethal-company lethal-company-mod

lethalavatars's Introduction

LethalAvatars

A Lethal Company mod that allows you to export Avatars directly from Unity

banner

To describe this mod very shortly, it allows you to express your creativity and show it off to your friends while playing your most favorite game ever! If you're familiar with the avatar creation process for games like VRChat, ChilloutVR, or Hypernex (shameless plug), you'll be very familiar with this system.

Warning

This mod is in early development and is VERY UNSTABLE!

How to Install the Mod

This mod uses BepInEx v5.4.22.

Fortunately, the mod is simply one dll. No dependencies required! Just drag LethalAvatars.dll to path/to/Lethal Comnpany/BepInEx/plugins folder and done!

Installing an Avatar

All Avatar formats are classified as .lca files (Lethal Company Avatar) and, at heart, are just Unity AssetBundles (again, just like Hypernex. seeing the pattern?) All avatars can be installed by moving the avatar file to path/to/Lethal Company/Avatars folder (if the Avatars folder does not exist, run the game once and it will be created). At runtime, the avatars will be loaded and displayed in your Custom Avatars menu on the home screen.

image

image

Creating an Avatar

The first step to creating an avatar is using the correct Unity version. Lethal Company uses 2022.3.9f1, and you should use this (or at least some other 2022.3.XX build).

Next, import the LethalCompany.SDK.unitypackage file.

Finally, build with the LethalAvatars > Build window.

See the Wiki for more information on how to create an avatar.

Uploading an Avatar

You don't have to! All avatars are synchronized in-game, even if the players don't have the asset!

Warning

This will send your avatar's AssetBundles to other clients, meaning that clients could extract the binary data. You should only play with friends who you trust. Avatars gathered over the network will never save to storage.

Distributing an Avatar

Currently, there is no service for distributing avatars. While you could always upload a mod that injects avatars into the Avatars folder, then upload that to Thunderstore, that is really clunky and disorganized. I would be more than happy to open a channel for distributing Lethal Company avatars in my discord server. If anyone has suggestions for platforms, I am also open for that too!

Building

For you tech-savvy nerds who don't want pre-builts or want to contribute. (no shame, shoutout to all the dorks out there)

  1. Pull the code, open the solution in your preferred IDE, and import NuGet packages
  2. Create a file in the LethalAvatars project called LethalAvatars.csproj.user, and set the text to the following
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <LethalCompanyPath>path/to/Lethal Company</LethalCompanyPath>
    </PropertyGroup>
</Project>
  • Replace path/to/Lethal Company with your Lethal Company directory
  1. Create a file in the LethalAvatars.SDK project called LethalAvatars.SDK.csproj.user, and set the text to the following
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <LethalCompanyPath>path/to/Lethal Company</LethalCompanyPath>
    </PropertyGroup>
</Project>
  • Replace path/to/Lethal Company with your Lethal Company directory
  1. Create a file in the LethalAvatars.SDK.Editor project called LethalAvatars.SDK.Editor.csproj.user and set the text to the following
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <UnityEditorManagedPath>path/to/Unity 2022.3.9f1/Editor/Data/Managed</UnityEditorManagedPath>
  </PropertyGroup>
</Project>
  • Replace path/to/Unity 2022.3.9f1 with your Unity install directory
  1. Reload all the projects and Build

Why is building like this?

LethalAvatars requires dependencies that are not present in Lethal Company. Lethal Company relies on protobuf-net for message serialization/deserialization. This is used because LethalAvatars relies on low-level Unity Netcode APIs, which unfortunately, are barely documented (hours of my life, wasted) for the sole purpose of relaying Avatar data over the network. You can read more information about that process here.

Dependencies are linked using EmbeddedResources and the AppDomain.AssemblyResolve event. Developing in early stages, I found out that when using ILRepack to combine assemblies (such as LethalAvatars.SDK, a core requirement for ALL of LethalAvatars) that when the assembly changed, Unity would not be able to resolve it. This means that every time there was a slight change in the LethalAvatars.SDK assembly, Unity would not be able to resolve the components attached to an Avatar. Resolving assemblies from memory is the exact same as if the assembly were to be loaded by Unity itself, just that a user would not have to manually install the dependency as well. To better understand how libraries are linked together, here's a diagram I drew up.

jhsdfbgsjhdbg

lethalavatars's People

Contributors

200tigersbloxed avatar virtualbrightplayz avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.