Conversation
|
My only suggestion would be to think about dependencies - how you signal that a mod depends on another mod, how mod loading is ordered about those dependencies, and what would happen when two mods require the same third mod, but in two different versions - as early as possible. |
|
Yeah, dependencies are currently TOTALLY unhandled haha. (I'm pretty sure the game crashes if there are no mods present, so very WIP lol) |
|
ope! yeah, totally understandable to not have accounted for everything yet >.< - I was more suggesting that you might find that proper support for dependencies will probably inform a good chunk of your implementation, so, might be a good idea to code with that at the back of your head. |
|
I have no idea where to even start with that, to be honest 😅 |
|
I'm not sure how to do it specifically in the context of unity/c#, but I can offer some help in the abstract (I'm primarily a web-dev, so I'm out of my depth on specific implementation here, but if this were typescript... >.<) |
I fear C# is the unholy mix of Java and TS... (or the other way around?) |
|
Quite a big update; modded chips can provide functionality: Registry.RegisterChip (
"PASS",
new(CalculateGridSnappedWidth(DrawSettings.GridSize * 8), DrawSettings.GridSize * 3),
new(1, 1, 1),
[ModdedChipCreator.CreatePinDescription("Input", 0)],
[ModdedChipCreator.CreatePinDescription("Output", 1)],
[],
false,
simulationFunction: (inputs, outputs) =>
{
outputs[0].State = inputs[0].State;
}
);
Registry.RegisterChip(
"CONST",
new(CalculateGridSnappedWidth(DrawSettings.GridSize * 8), DrawSettings.GridSize * 3),
new(1, 1, 1),
[],
[ModdedChipCreator.CreatePinDescription("Output", 0)],
[],
false,
simulationFunction: (inputs, outputs) =>
{
outputs[0].State = 1;
}
);I think my next goal is to allow mods to define collections to store their modded chips in :) |
known issue: collections appear to duplicate on reload
|
I think we need the following interfaces available for mods to use:
That's my rough idea what the MOD API should provide. Basically: If you had MOD building a command line the API should allow the MOD to implement a full interface to control everything going on. ¹ Think of a mod that enhances LEDs to provide not just a color, but a set of textures the user could choose from. Such a MOD would need a way to store the selected textures in the save file and retrieve it later on load. Loading such a project should gracefully notify the user about any MODs required for proper handling. |
|
Please manifests and create a JSON Schema for the manifest of your do so one of my biggest gripes w/ terraria’s modding system is the build.txt manifest if you could make a schema based manifest I would love that and an update system integrated through GitHub releases so a mod could have the repo linked and the updater would look for a file formatted like {modIdent}-{version}-{platform}-{arch}.{dynamicObjectExt} |
|
I've created a Trello: That way we can properly decide on what to add (and what's currently being worked on) I've already added some of @BenBE's great suggestions. |
|
Just discovered a pretty big issue - IL2CPP (obviously) doesn't support loading assemblies at runtime. |
terraria uses il2cpp modding is never impossible just share symbols and use normal LoadLibrary with a custom entry point |
|
That would require people to write mods in C++. (And thus require a complete rewrite of the API) |
in this case i would take the loss since we are not super far into the modding process and players who dont mod are just gonna get hit with a performance downgrade if a switch to mono occurs. so i think that the better solution would be to go with a c++ modding api |
|
Just did some research, Terraria doesn't use Unity and therefore doesn't use IL2CPP. Terraria mods are written in C# so I'm not entirely sure what you mean. |
2am brain (idk either) |
(sadly IL2CPP no longer supported)
|
Experimenting with embedding the mono runtime in the game to dynamically load mods... seems excessive haha |
|
I've gotten nowhere on that. Just going to stick with Mono builds for now whilst I add to the API. (unless we want to interpret a totally different language like lua or something 🙃) |
|
Does anyone have any good ideas on how the menu/dialog builder should be implemented? internally it's handled quite differently to chips, collections, displays, etc. haha |
Make it be handled like chips, collections and displays, maybe? |
Chips containing modded subchips will now be "soft" hidden from the library if the mod they depend on is removed. They return when the mod is loaded again. Todo: warning message when this occurs Untested: modded supchips several chips deep
|
I would recommend adding a from mod is the subchips section so an example might be {
"Name":"Skip",
"Namespace": "Modname",
"ID":1854753101,
"Label":null,
"Position":{
"x":-0.14,
"y":-2.25
},
"OutputPinColourInfo":[{"PinColour":0,"PinID":977613743}],
"InternalData":null
}or {
"Name":"Modname::Skip",
"ID":1854753101,
"Label":null,
"Position":{
"x":-0.14,
"y":-2.25
},
"OutputPinColourInfo":[{"PinColour":0,"PinID":977613743}],
"InternalData":null
}this would be important to prevent crashes |
|
@sk337 yep, thats what the last two commits were for |
|
looking at the commit names with that context makes A LOT more sense |
|
some of them have descriptions too 🙃 |
|
made a draft for a manifest schema i would be fine with making any changes you need |
|
Looks great, haven't setup the mod dependency and update system yet though 😅 |


Not very far along in the process, but opening up a draft PR because I'm sure everyone has opinions on how it should work.
(Note: when I say "will", I mean "in the current implementation, they will" 🙃)
Mods will be separate solutions that depend on
DLSModdingAPI,DLS,DLS.Description, andUnityEngine.CoreModule, and will export to.dlsfiles (cosmetic.dllfiles, because why not?)The basic "main" file of a mod will implement
DLSModdingAPI.IMod:And thus can provide functionality when the sim is initialized (such as changing UI or other configurations), and when a project is loaded (such as registering a new builtin chip).
Here is a very basic mod:
Which results in:

Please do pipe up with any suggestions - or how I'm doing this completely wrong - modding (especially) is a community effort!