In this update3
Full notes
Full Unity-Chan: Desktop Companion update
Read the full published notes in a cleaner layout. The original post stays linked below.
What changed
- Gameplay
- UI and audio
- Performance
- Store
- Server
Unity-Chan: Desktop Companion changes
Warning - this post gets into more technical stuff, focuses more on game's behind the scenes work and mod support structure. I assume the reader has some basic knowledge about how programming works. So if you're not into this stuff it may become complex or really boring! 😅
Last time I mentioned that I'll focus on adding mod support to the game. In this post I'd like to show you the progress that I made and how it looks from the internal architecture side.
At first i looked into how to add modding support to games. And the most popular advice was a bit stressing - the best way to add modding to game is... to design the game with modding support in mind right from the start of the project! 😫 It makes sense - if the game would load all resources from directories, all configs stored in text files then all would be much easier for others to modify and play with.
But since I lack the skills of rewinding time, I decided to look for popular solutions that would let me add mod content without reinventing the wheel.
So, I looked for a package that would at least let me:
Modify game art (graphics, models, sounds)
Add new script behaviour in a controlled way (no need for complex hacking)
And I found it!
About the mod package
After some asset browsing and looking into various solutions I found uMod2 package. After checking out examples and building a basic prototype I found that it has everything I need and even more - the package allows for loading whole mod scenes, so there is a way for me to add support for complete mini games in the future!
But back to the uMod2. It is a package that allows me to export a mod toolset for my game. When creating the toolset, I can choose which assets are moddable, which scripts are exposed for modding, and provides a very convenient way to load and unload modded data, so all heavy-lifting is basically done for me.
The package documentation also provided a very nice architecture on how to expose game interfaces so mods can call game functionalities themselves (i.e. a mod that wants to add new UI button need to get the menu where they want to add it). I created another project-library that has mod interfaces and works as middleman between the game and the mod. I created a diagram to show what I mean.
On the left there is my game, in the middle the Interface project, and on the right an example Mod Project. Solid lines of arrows show which parts of Game or Mod implements it (note that all Providers are implemented by Game, and all Accessors are implemented by Mod - i made this convention so it is more clear)
For Example, I could create The Repeater Mod that makes Unity-chan repeat the same thing. That mod would implement the ITextAiAccessor interface to generate such message, and IModPanelCreator to provide mod settings to be displayed (such as a phrase to be repeated)
uMod2 itself provides quite a lot functionality for mod scripts to use in ModScript and ModScriptBehaviour classes, so if you'd be interested in programming in mods you can check out their User Guide or Script Reference. Of course, since the mod tool is in Unity Engine, all knowledge about the engine is a huge plus.
Mod Integration systems and examples
I added a couple of generic interfaces that most would want to implement either way.
As for now, I added 3 such Interfaces:
IModPanelCreator - A way to add mod settings in phone UI.
ISettingsAccessor - A way to store and access mod settings between gaming sessions
ICreatedOnLoad - Some mods may want to create some gameobjects right after mod initialization, I made this one just for the easy access to it.
I'll provide the examples of 2 first interface uses based on RepeaterMod - a template mod that makes Unity-chan answer with only one chat phrase.
First off, IModPanelCreator was implemented by RepeaterMenu script, let's look into it... Steam post image
It's a very basic script: it loads two assets - A Bar and Panel when the mod is loaded, then gives those objects when Game will call GetSettingsButton() or GetSettingsPanel() to build menus.
And those names in scripts "RepeaterBar" and "RepeaterPanel" are asset names in the mod directory, so the scripts knows which GameObjects to load. We can open those objects and see how they look: Steam post imageSteam post image
After the mod is added, the game will detect the IModPanelCreator Script during mod load and add Bar and Panel to its UI, I played with various bars look to show it can be customized. Steam post image
Then let's go to ISettingsAccessor. I assume mods will often want to store mod settings in some way, so I made a way to do it in a unified way. I prepared a file dedicated to store those settings, and interface to load and save those data. Furthermore, it allows even to load data from other mods, so it will be possible to create some mod dependency that way. ISettingsAccessor is implemented by RepeaterSettings script
In SetProvider method (which is called by the game after the mod is loaded), the mod gets access to mod settings file by using Load and Save methods. In this case, it uses it to check if a setting of"Repeater.Phrase"settings is present in file. If it is - load it, if not - set default value and save it!
The script also has a SaveSettings method, which is used inside the mod to call after the phrase is edited in the mod UI
That's how mod settings file looks like after the settings edit
In Conclusion - how to make a basic mod in the future
Well, I didn't publish the Mod Toolset yet, so you just can't as for now lol 😀 I plan to work on it for a bit more, so more functionalities are available once the game premiere hits. I want to have mod support for at least character model override.
But assuming the game is released, and mod toolset is released
Download Unity engine, download UCDC Mod Toolset
Create empty Unity project
Import UCDC Mod Toolset to project (basically drag-drop it)
Click top bar on Mod Tools -> Create -> New Mod
Enter mod name, click Create Mod
Add mod content - be it scripts, art, sounds etc.
Build mod using Mod Tools -> Build Mod
Copy and paste mod file to Game's mod directory, test it and share! 😀
That's it for now. I'm still in the middle of developing the modding functionalities, but I hope I managed to show you how modding the game will look like.
If something isn't clear or you have questions feel free to ask in the comments!
In the future I plan to add a section for modding on our Discord Server, so if you're interested in modding come join here!
Thanks for reading! JacopoDev
Source
Changelog.gg summarizes and formats this update. How we read updates.
