Difference between revisions of "Koikatu/Modding"

From Hgames Wiki
Jump to: navigation, search
(Added some guides)
(Add How to compile section)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Koikatu}}
 
{{Koikatu}}
  
Most of the up-to-date modding resourced and guides are shared on the [https://universalhentai.com Koikatsu Discord server]. This is also where you can find most of the English speaking modders working on Koikatu plugins and mods.
+
Most of the up-to-date modding resourced and guides are shared on the [https://discord.gg/hevygx6 Koikatsu] or [https://discord.gg/F3bDEFE IllusionSoft] Discord servers. This is also where you can find most of the English speaking modders working on plugins and mods.
  
==Condensed guide on making plugins==
+
If you are having trouble and can't find an answer online (google is your friend) or want to try to make your own plugin/mod, feel free to ask for help in modding channels of these servers. Please at least try searching for solutions yourself before asking, most questions were already asked and answered!
 +
 
 +
This guide applies to Koikatu, Koikatsu Party, EmotionCreators, AI-Syoujyo, AI-Shoujo and other similar UnityEngine games made by Illusion.
 +
 
 +
==How to compile a plugin?==
 +
The best way to learn is to compile an existing plugin and make changes to it. First find the plugin's repository, then simply clone it to your drive and use the free version of Visual Studio 2019 for C# to compile it. Keep in mind that you might need to fix references by pointing at some of your game's files. Check the following links for useful tutorials:
 +
* [https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository How to clone a repository]
 +
* [https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/?view=vs-2019 Getting started with Visual Studio and C#]
 +
* [https://docs.microsoft.com/en-us/visualstudio/ide/troubleshooting-broken-references?view=vs-2019 Fixing references]
 +
 
 +
==Condensed guide on modifying and making new plugins==
 
First of all, environment. You need:
 
First of all, environment. You need:
* Visual studio 2017 or newer, use the free community version
+
* Visual Studio 2017 or newer, use the free community version
 
* KK with BepInEx installed
 
* KK with BepInEx installed
 
* Cheat tools plugin (for the included Runtime Unity Editor, press F12)
 
* Cheat tools plugin (for the included Runtime Unity Editor, press F12)
Line 13: Line 23:
 
===Getting started===
 
===Getting started===
 
* Get to roughly know C# and how it works. There are plenty of tutorials on it.
 
* Get to roughly know C# and how it works. There are plenty of tutorials on it.
* Grab a simple plugin, for example https://github.com/DeathWeasel1337/KK_Plugins/blob/master/KK_ClothingUnlocker/KK_ClothingUnlocker.cs and see how it's constructed. Try to compile it.
+
* Grab a simple plugin, for example https://github.com/ManlyMarco/IllusionTrapMods/tree/master/KK_BecomeTrap and see how it's constructed. Try to compile it.
 
* You need to fix the plugin's references before you can build (point it to dlls from your game install) and build locations (right click on the project in tree view > Preferences > Build).
 
* You need to fix the plugin's references before you can build (point it to dlls from your game install) and build locations (right click on the project in tree view > Preferences > Build).
 
* Use BepInEx.Logger.Log for showing messages in console
 
* Use BepInEx.Logger.Log for showing messages in console
Line 23: Line 33:
 
* https://github.com/pardeike/Harmony/wiki
 
* https://github.com/pardeike/Harmony/wiki
 
Optional
 
Optional
* https://github.com/ManlyMarco/KKAPI/wiki
+
* https://github.com/IllusionMods/IllusionModdingAPI/wiki
* https://github.com/bbepis/BepisPlugins/tree/master/ConfigurationManager#how-to-make-my-mod-compatible
+
* https://github.com/BepInEx/BepInEx.ConfigurationManager
 
* https://help.github.com/en/articles/set-up-git
 
* https://help.github.com/en/articles/set-up-git
 
* https://blogs.msdn.microsoft.com/benjaminperkins/2017/04/04/setting-up-and-using-github-in-visual-studio-2017/
 
* https://blogs.msdn.microsoft.com/benjaminperkins/2017/04/04/setting-up-and-using-github-in-visual-studio-2017/
Line 30: Line 40:
  
 
===Tips===
 
===Tips===
* KK is a Unity3D game and is written in C#, skills you gain here will apply to almost all other Unity games
+
* KK is a Unity3D game and is written in C#, skills you gain here will apply to almost all other Unity games.
* Koikatu_Data\Managed\Assembly-CSharp.dll has most of the game code in it, open in dnSpy to read and research it
+
* Koikatu_Data\Managed\Assembly-CSharp.dll has most of the game code in it, open in dnSpy to read and research it.
 +
* Check source code of other plugins to see how certain things are accomplished. Don't be afraid to post issues or submit PRs to existing repositories, that's a great way to learn!
  
 
==Quick debugging tutorial using dnSpy==
 
==Quick debugging tutorial using dnSpy==
Running the game in debugger makes finding causes of issues and understanding how the game works much easier. To run KK in the debugger included in dnSpy you need the [https://cdn.discordapp.com/attachments/476358846764548137/557572537702154250/BepInEx_Dev.zip following files]. The archive contains mono.dll library modified for debugging and BepInEx patcher that is required for the debugging to work correctly. By using the patcher you can no longer use preloader patches in BepInEx, but they have not been used by any plugins so far as far as I know.
+
Running the game in debugger makes finding causes of issues and understanding how the game works much easier. To run KK in the debugger included in dnSpy you need the modified mono dlls from the dnSpy release post. You can read more here https://github.com/0xd4d/dnSpy/wiki/Debugging-Unity-Games
  
More info:
+
Open dnSpy, drop Koikatu.exe on it, click the newly added .exe, and click Start. It should start running the game and dnSpy should enter debugging mode. You can open assembly-csharp or one of your plugins, place a breakpoint at some line and make the code run in game to test it out. Locals are the variables available in the current scope, Watch contains your expressions (you can put arbitrary C# code in these and it will get executed when you hit enter). It's pretty similar to debugging in VS, just more limited.
* https://github.com/0xd4d/dnSpy/wiki/Debugging-Unity-Games
 
* https://github.com/BepInEx/BepInEx/wiki/dnSpy-Debugging
 
  
To install just extract the files into game directory and run the patcher. Next, open dnSpy, drop Koikatu.exe on it, click the newly added .exe, and click Start. It should start running the game and dnSpy should enter debugging mode. You can open assembly-csharp or one of your plugins, place a breakpoint at some line and make the code run in game to test it out. Locals are the variables available in the current scope, Watch contains your expressions (you can put arbitrary C# code in these and it will get executed when you hit enter). It's pretty similar to debugging in VS, just more limited.
+
When you recompile a plugin that is loaded in dnspy then make sure to go file > reload all. If you changed code where a breakpoint was set, then it might mess up and move the breakpoint to some different spot. You can check where all breakpoints are in the breakpoint window.
  
When you recompile a plugin that is loaded in dnspy then make sure to go file > reload all. If you changed code where a breakpoint was set, then it might mess up and move the breakpoint to some different spot. You can check where all breakpoints are in the breakpoint window.
+
==Adding or modifying items / mod making==
 +
Because of the large scope it's difficult to provide a simple step-by-step guide. A large collection of guides is available here: https://github.com/xm007/Koikatsu-Modding#koikatsu-modding-tutorial
 +
You can ask for assistance on the discord server in the #mod-modelling channel, we'll be happy to help you out!

Latest revision as of 15:17, 3 April 2020

Illusion

all characters are at least 18


Koikatu [edit]

Install Guide

FAQ & Technical Help

Gameplay

Chara Studio

Modding


Most of the up-to-date modding resourced and guides are shared on the Koikatsu or IllusionSoft Discord servers. This is also where you can find most of the English speaking modders working on plugins and mods.

If you are having trouble and can't find an answer online (google is your friend) or want to try to make your own plugin/mod, feel free to ask for help in modding channels of these servers. Please at least try searching for solutions yourself before asking, most questions were already asked and answered!

This guide applies to Koikatu, Koikatsu Party, EmotionCreators, AI-Syoujyo, AI-Shoujo and other similar UnityEngine games made by Illusion.

How to compile a plugin?

The best way to learn is to compile an existing plugin and make changes to it. First find the plugin's repository, then simply clone it to your drive and use the free version of Visual Studio 2019 for C# to compile it. Keep in mind that you might need to fix references by pointing at some of your game's files. Check the following links for useful tutorials:

Condensed guide on modifying and making new plugins

First of all, environment. You need:

  • Visual Studio 2017 or newer, use the free community version
  • KK with BepInEx installed
  • Cheat tools plugin (for the included Runtime Unity Editor, press F12)
  • dnSpy for reading game and other dll source code and debugging of the game (To do debugging with dnSpy you need to set up a few things for it to work * https://github.com/BepInEx/BepInEx/wiki/dnSpy-Debugging * this is optional and you most likely won't need it until you're doing much more advanced stuff)
  • Go to your in-game plugin options and enable bepinex console and all logging levels, including unity logging

Getting started

  • Get to roughly know C# and how it works. There are plenty of tutorials on it.
  • Grab a simple plugin, for example https://github.com/ManlyMarco/IllusionTrapMods/tree/master/KK_BecomeTrap and see how it's constructed. Try to compile it.
  • You need to fix the plugin's references before you can build (point it to dlls from your game install) and build locations (right click on the project in tree view > Preferences > Build).
  • Use BepInEx.Logger.Log for showing messages in console

Things to read

Critical

Optional

Tips

  • KK is a Unity3D game and is written in C#, skills you gain here will apply to almost all other Unity games.
  • Koikatu_Data\Managed\Assembly-CSharp.dll has most of the game code in it, open in dnSpy to read and research it.
  • Check source code of other plugins to see how certain things are accomplished. Don't be afraid to post issues or submit PRs to existing repositories, that's a great way to learn!

Quick debugging tutorial using dnSpy

Running the game in debugger makes finding causes of issues and understanding how the game works much easier. To run KK in the debugger included in dnSpy you need the modified mono dlls from the dnSpy release post. You can read more here https://github.com/0xd4d/dnSpy/wiki/Debugging-Unity-Games

Open dnSpy, drop Koikatu.exe on it, click the newly added .exe, and click Start. It should start running the game and dnSpy should enter debugging mode. You can open assembly-csharp or one of your plugins, place a breakpoint at some line and make the code run in game to test it out. Locals are the variables available in the current scope, Watch contains your expressions (you can put arbitrary C# code in these and it will get executed when you hit enter). It's pretty similar to debugging in VS, just more limited.

When you recompile a plugin that is loaded in dnspy then make sure to go file > reload all. If you changed code where a breakpoint was set, then it might mess up and move the breakpoint to some different spot. You can check where all breakpoints are in the breakpoint window.

Adding or modifying items / mod making

Because of the large scope it's difficult to provide a simple step-by-step guide. A large collection of guides is available here: https://github.com/xm007/Koikatsu-Modding#koikatsu-modding-tutorial You can ask for assistance on the discord server in the #mod-modelling channel, we'll be happy to help you out!