Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BepInEx for KSP 2 from SpaceDock #9584

Closed
wants to merge 1 commit into from
Closed

Conversation

netkan-bot
Copy link
Member

This pull request was automatically generated by SpaceDock on behalf of bbepis, to add BepInEx for KSP 2 to CKAN.

Please direct questions about this pull request to bbepis.

Mod details

Key Value
Name BepInEx for KSP 2
Author bbepis
Abstract Modloader for Unity games
License LGPL
Homepage https://github.com/BepInEx/BepInEx
Source code https://github.com/BepInEx/BepInEx

Description

BepInEx for KSP 2

https://github.com/BepInEx/BepInEx

What is BepInEx?

BepInEx is a tool used to allow modding / custom code execution in Unity and other C# based games. As of writing KSP 2 does not support loading arbitrary mods, so the only way to run addons & load assets is through this loader.

Harmony and MonoMod.RuntimeDetour are packaged with this loader, allowing you to modify game code & functions at runtime.

BepInEx uses "plugin" to refer to the equivalent of Addons in KSP.

Additional features as compared to KSP 1 style modding

  • Ability to modify .dll files before they are loaded, which allows for modifications not possible with Harmony.
    
    •   Editing enums, patching static constructors, adding entirely new types to a specific assembly, immune to JIT inlining etc.
      
  • Much earlier code execution meaning that you are able to modify the game (and Unity itself) before it even starts loading
    
  • External console & logging so that you don't have to scour game logs for any info / error output
    
  • Fixes certain issues with Unity operating on platforms other than Windows
    
  • Includes dependency handling to ensure mods that rely on other mods are loaded in the correct order, or not at all if prerequistes are missing
    
  • Has a consistent way of reading / writing / manipulating configuration per plugin
    
  • Contains base libraries (such as Harmony) to prevent conflicts with mods providing their own, differing versions
    

Other features

  • Immune to being uninstalled by game updates; no files are replaced
    
  • Supports Windows, Linux and Mac OSX
    
  • Has dev tools that you can use to assist in plugin development
    
    •    i.e. being able to reload plugins while the game is running, a UI to examine the entire loaded scene etc.
      

Getting started

For Windows:

  • Download the latest version of BepinEx v5 x64 from here 
    
  • Extract the folder such that your game looks like this:
    

You are done!

If you get stuck with the installation process, please refer to the documentation: https://docs.bepinex.dev/articles/user_guide/installation/index.html

For Linux/Unix/OSX:

It is more or less the same process, with some minor differences. Refer to the above documentation

Installing plugins

To install plugins, place them inside of your BepInEx/plugins folder. (This directory might not exist for you; launch the game once to have BepInEx generate its folder structure)

While it's possible to place every .dll file in any place in BepInEx/plugins, it's strongly recommended that you have one folder per mod to make it significantly easier to manage updates and uninstallation.

Creating BepInEx plugins

A guide exists here for writing your first BepInEx plugin: https://docs.bepinex.dev/articles/dev_guide/plugin_tutorial/index.html

As reference here is a pre-made C# project for an example plugin that does two things:

  • Creates an in-game notification when you press F2
    
  • Changes all of the translatable strings in the game to "Chungus" on pressing F3
    

https://files.catbox.moe/6c48ls.zip

This is an automated commit on behalf of bbepis
@HebaruSan
Copy link
Member

HebaruSan commented Feb 25, 2023

To be looked at after KSP-CKAN/CKAN#2863 is addressed.

@HebaruSan HebaruSan closed this Feb 25, 2023
@HebaruSan HebaruSan deleted the add/BepInExforKSP2 branch February 28, 2023 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants