Replies: 3 comments 1 reply
-
(I'll answer this after I eat dinner, gimme 45-60 mins) |
Beta Was this translation helpful? Give feedback.
-
Nothing wrong with ever asking a question, haha.
Older templates for Reloaded-II actually were much simpler and gave you a class that inherited The reasons here are a bit complicated, so grab tight. Big Reason: Guiding the User & UpgradabilityThe biggest reason has to do with trying to steer new users towards the right direction when starting out. For many people, modding games acts as an introduction to programming. The template was made to avoid certain possible pitfalls.
To help alleviate issues like this, I modified the template over time to give new users the 'bare essentials' out of the box, and to separate the template code as much as possible from the mod code. That way, not only is it easier to assist new people with code, but you can actually upgrade the template by just making a new project with the same name and replacing the files in your project folder. The very thin bit of abstraction also enables those simple upgrades. Outside of that, I figured that if the user is advanced enough, they can simply remove the code they don't want. Why the Template is Part of the Mod PackagePerformance. When you select an item in the launcher, it has to load the main mod DLL as the mods themselves actually contain the logic for:
etc. Loading the DLL involves I/O, and the launcher also has to load the corresponding thumbnail image (256x256 or greater) at the same time. Because the mod list can be navigated using the keyboard and controller, a key requirement there was to ensure that holding up/down did not lag the UI whatsoever. Therefore I couldn't move the template out to another mod as that would cause another (synchronous) DLL load, increasing latency. When scrolling was smooth on my 2014 4790k Stock CPU, I was happy. Note: In Reloaded3 the config will be defined in a UpgradabilityI touched on this earlier, but being able to upgrade the template in place was another factor. Any mod I write is technically 1st party and could be interpreted by someone as an example to follow. If someone wanted to try follow along and see how a mod is built, the entry point should be the same. In the early mods I wrote, small mods would often have their code mixed with the template code (i.e. code in method which implements The process taking around 5 minutes in itself is not a big deal, however for me, when I have around 30-40 code mods (I lost track at this point), that added up to a lot of time. ExtraAt the time when Reloaded was being written, C# was extremely uncommon for modding native games A lot of these things such as |
Beta Was this translation helpful? Give feedback.
-
Reason is explained above. You can throw it in a NuGet if it makes your life easier though.
One of them is a copy of your When you're using ReadyToRun (R2R), your code might end up being built in a subfolder. Note: This doesn't increase memory use except for 8 bytes to store the field. The copy returned is what the loader itself holds and requires for some API calls.
Yeah, unfortunately. The good news is you basically never have to change that boilerplate ever. Generally only reason you ever would need to is to:
The actual boilerplate code handles:
That boilerplate is also not super tied in with the serializer, so you can easily swap out to another serialization method if desired. I went with Reloaded-II has been very aggressively optimized for startup times, so using Json here made sense, since startup size is negligible and mod size is unaffected (no extra library). Note: It is possible to share a library between mods via
It's stated in the template. (Also wow, copy paste error in that file, whoops). It's an error from the original R2 API in 2019; and I can't really remove it because I can't ever break API. Basically your entry point inherits from In practice, this event is redundant as you can either subscribe to Misc Note: It's also possible to execute your own binaries to handle configuring mods. I talked about that a bit here. |
Beta Was this translation helpful? Give feedback.
-
Heya! I've been using Reloaded's libraries in other projects for a while now, but I'm finally trying out RII (and thus the "full" ecosystem). I wanted to ask why the "Template" folder in mods exists - seems like a bit of a weird decision (at least from my perspective). I wanted to ask some of the reasoning behind it, and share my opinions on it.
My main issue is with the config system - scrapping everything else for a simple clean slate is easy enough, but now I need to un-scrap half of it to use the provided config system or write my own. From my understanding, the config system also integrates with the Reloaded launcher, so I'd be losing out from making my own.
Despite this, I'm having a lot of fun using Reloaded - thank you for making it! 💜
Beta Was this translation helpful? Give feedback.
All reactions