PDA

View Full Version : [TEC] You guys are doing it all wrong AKA How to mod a Unity Game


R-T-B
05-31-19, 05:10 PM
Hello all. I'm R-T-B. An old wannabe Silent Hunter 5 modder who grew frustrated with the game and has probably been forgotten. I also am a game dev, and have worked on modding some unity games in the past.


Some terminology. Unity is a game "engine." It's what makes our game run. A lot of games are made in it. So this likely applies beyond just UBOAT, but obviously as I sponsored this game on day 1, I'm interested in modding it!


Benefits of modding a unity game the "right" way:


1.) More resilient to updates of the game itself



2.) Can better coexist with other mods (this technique only replaces the assets in the binary archive that are used).



3.) No need to distribute huge binary archive files like we are doing now. We only distribute what is changed.


Drawbacks (vs JGSME on SH):


1.) No mod list tracking (you need to track what mods and what order they are installed in on your own! Scary, I know, but no way around this, and it's not like what we had before was better).



In short, do it this way, not how you have been doing it up until now, and I think we'll all reap the benefits! :salute:


You will need an open source tool to produce a mod this way. As an example, I'm going to botch up the 13th flotilla logo, and slap a generic clipart deer/buck/stag/whatever in the middle of it. And apply a cheap photoshop filter because my Photoshop skills suck and this helps hide that fact. :D


I won't go too into details of what we do to make the mod, modders know about how to replace textures already I assume. But I will glance over the basics. You need this tool, called UABE, to continue (you can think of this kind of as a "JSGME for Unity games"):



https://github.com/DerPopo/UABE/releases


Grab the latest 32/64-bit build (I went with 64-bit since our game assumes you have 64-bit anyways, but it doesn't matter).


Once you have it, you got a zip archive. Extract it and run the exe tool inside. Open Uboats directory and open ALL the *.assets files in UBOAT_DATA. Do whatever mod work you desire to the files now, and feel free to explore! Hint: Files you can easily work on usually have an export option under "plugins." In my case, for our lame emblem mod (I called it "IronStag" to compensate for... something) I edited the main texture files for the Conning towers and painted a new logo on (using plugins->export to png, edit the png, and then edit->load to replace it when done editing. I use normal multithreading quality).


You can see the work here. The changed files are marked at the end with an asterisk.


https://img.techpowerup.org/190531/1.png


Now, it's time to make our mod!

You do that with the file menu. You can chose to distribute it as an innocent non-executable file (the client will need UABE installed to use the mod then), or as a complete do-it-all exe that handles everything (the client will probably need to trust you in that case.


I'm doing both. First an EXE, though. Select that option in our case:


https://img.techpowerup.org/190531/2.png


Fill out some mod details. As you can see, I like my mod so much I even told you what it does. I suggest you do the same. You can also set a custom and icon and should set the default game directory:


https://img.techpowerup.org/190531/3.png


As a result of your hard work, the installer will look kind of like this:


Mine is much technical, very detail, wow:


https://img.techpowerup.org/190531/4.png


About the only thing your end user needs to know is where UBOAT is installed. It might even figure that out for them if you installed to the same default place, and filled it out for them:


https://img.techpowerup.org/190531/5.png


As you can see, it "patches" the needed files, only replacing what is needed. This enabled mod coexistence and better handling of updates. It's all around a far better system.


https://img.techpowerup.org/190531/6.png

Can I has sticky?



https://img.techpowerup.org/190531/7.png


Demo mod downloads (exe and not-exe) will be posted soon to the mod workshop here at subsim, for you to see the wonder for yourself. Stand by.


https://img.techpowerup.org/190531/untitled977.png
EDIT: The emblem mods I just made:


EXE Version: http://www.subsim.com/radioroom/downloads.php?do=file&id=5483


Safe "who da heck is R-T-B" version. Requires UABE: http://www.subsim.com/radioroom/downloads.php?do=file&id=5484


They should work with any modstack that doesn't touch the uboat skin, and on any version for quite some time. That's the magic.

Sailor Steve
05-31-19, 05:26 PM
Welcome back! While not a modder myself, I'll be curious to see where this goes.

R-T-B
05-31-19, 05:35 PM
I'd like to take credit but this is really just public knowledge made available in a humorous format. Other unity modders would know this but I guess none were here! Anyhow, glad to be of service and thanks for the welcome!

R-T-B
06-01-19, 02:25 AM
I'd like to add, if anyone had a mod they'd like converted to this format, I have the tools to do so and can help, but will naturally need the authors permission. Any mod authors wishing to explicitly grant me the right to do this may post here so I know and can act accordingly.

kapitan_zur_see
06-03-19, 10:15 AM
That's a very nice post! I was wondering how it worked myself not long ago, so it's spot on for me! :Kaleun_Thumbs_Up:

As you seems knowledgeable in Unity (I only knows UE4 myself, and that's more or less only for 3D works in the graphics department), is the structure of having large packed files is an absolute necessity, or even by-product, of working with unity?

Can't you have just every files that are packed not packed the old-school way and put into different folders? This would make navigating through the files and modding so much easier, and most of all, would make mods traceable by allowing JSGME!

I can foresee the inevitable CTDs, but it's going to work a la GTA5 I guess. Mind you, we don't know what will be in the SDK yet, so... I guess it's the good way to work in the meantime :)

R-T-B
06-03-19, 11:06 AM
That's a very nice post! I was wondering how it worked myself not long ago, so it's spot on for me! :Kaleun_Thumbs_Up:

As you seems knowledgeable in Unity (I only knows UE4 myself, and that's more or less only for 3D works in the graphics department), is the structure of having large packed files is an absolute necessity, or even by-product, of working with unity?

Can't you have just every files that are packed not packed the old-school way and put into different folders? This would make navigating through the files and modding so much easier, and most of all, would make mods traceable by allowing JSGME!

I can foresee the inevitable CTDs, but it's going to work a la GTA5 I guess. Mind you, we don't know what will be in the SDK yet, so... I guess it's the good way to work in the meantime :)


The SDK appears already has traces of itself present in the .net dll files. It looks to be very powerful and allows loading external files. I'm not sure of anything of course being it is not finalized... but not allowing external file mods would be quite unusual IMO. So yes, while a basic unity game uses archives, both are possible.

Ragtag
06-04-19, 05:59 AM
The SDK will most likely change everything. It's why we won't make larger projects. At least i won't. The mods i made were merely a test to check out textures and such. It's also why i won't pay that much attention to above post.
Saying we done it the wrong way is stretching it abit. It's just several ways to do it. Both ways has it's pro's and cons. Only way to make a mod really user friendly, when it comes to stacking, is that modders work together and share their assets which we already do.
Grey wolf texture pack is the only mod that doesn't crash with my insignia mods. Well, except for the removal of the smoker.

I also sendt over my U-96 textures over to the modder that made the cammo mod.

When it comes to the download size it's about the same size either way. I've tested this.

R-T-B
06-04-19, 10:48 AM
I meant wrong as in "according to Unity standards and conventions." Both approaches certainly work, and you are right that the SDK will change everything.




[UOTE=Ragtag;2612764]When it comes to the download size it's about the same size either way. I've tested this.[/QUOTE]

That would rapidly change with larger mods, but yes, at the moment it seems the case.


At any rate: The only mods that I am aware of right now worth bringing up to speed are basically the GW one and the insignias... So perhaps not worth worrying about. Shall leave that to you. Until there are more options it's not worth worrying about really and seeing SDK code already present really makes me think we are closer to release of SDK than I initially thought. So perhaps this post may be best ignored, perhaps not. Time will tell, right? ;)

Ragtag
06-04-19, 01:04 PM
SDK is planned to be released sometime this summer so not that long to wait

R-T-B
06-05-19, 12:42 AM
SDK is planned to be released sometime this summer so not that long to wait


Indeed. I learned that only recently but it's certainly the route to aim for, given it is soon.


Still leaving this info up just in case someone wants to learn unity packaging, heh.

YoYo
07-14-19, 09:17 AM
Thank You!

JU_88
07-14-19, 12:45 PM
Thanks for your input RTB and for taking the time to write long tutorials :)
:Kaleun_Salute:

Kipparikalle
10-13-19, 10:06 PM
R-T-B have you found out if it's possible to modify the sounds? I'd be very keen on the possibility of replacing the awful weapon sounds.