#Space Warp
1 messages · Page 8 of 1
@wicked wyvern Even better looking
awesome!
Thats sick!
xddd wtf did you type as an example
If itd work in the other use case I need it to, it would be
Ohhh CustomPropertyDrawer
Ffs why is unity stuff hard to find
Something for testing purposes
uhhhuh
Unity uses a yaml format for components?
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 967700971, guid: 06dd3d5416bf43ea368cc39ff96e6d5a, type: 3}
m_Name: I2Languages
m_EditorClassIdentifier:
mSource:
UserAgreesToHaveItOnTheScene: 0
UserAgreesToHaveItInsideThePluginsFolder: 0
GoogleLiveSyncIsUptoDate: 1
mTerms:
- Term: Parts/Title/some_part
TermType: 0
Languages:
- This
Flags:
Languages_Touch: []
- Term: Parts/Subtitle/some_part
TermType: 0
Languages:
- is
Flags:
Languages_Touch: []
- Term: Parts/Manufacturer/some_part
TermType: 0
Languages:
- a
Flags:
Languages_Touch: []
- Term: Parts/Description/some_part
TermType: 0
Languages:
- part
Flags:
Languages_Touch: []
CaseInsensitiveTerms: 0
OnMissingTranslation: 1
mTerm_AppName:
mLanguages:
- Name: English
Code: ENG
Flags: 0
IgnoreDeviceLanguage: 0
_AllowUnloadingLanguages: 0
Google_WebServiceURL:
Google_SpreadsheetKey:
Google_SpreadsheetName:
Google_LastUpdatedVersion:
GoogleUpdateFrequency: 3
GoogleInEditorCheckFrequency: 2
GoogleUpdateSynchronization: 1
GoogleUpdateDelay: 0
Assets: []
Honestly might be worth having mods be able to register their own loaders for space warp
@wicked wyvern @mossy kraken should I create a repository on the github for the "sdk"
I'm all for it 👍
Go for it!
@sacred jasper should i change public methods on ColorsPatch to internal?
and leave just the API as public?
theres no methods that change critical information but still
Go for it
So, I think I have to programatically create the mod list UI for space warp but nothing else
I.E. w/ UITK
Why is that?
Actually yeah, nvm
SpaceWarp/ModList/Header,Text,,spacewarp.modlist,spacewarp.modlist
This one i kept the same because else it owuld be, spacewarp.listademods
Yep that makes sense not to translate
idk it seems to extensive, most people know what a mod and a list is so 
translation pr done
just gotta test colors with the changes
Just wait until I start doing translations in an addressables bundle
/hj
Shit I can't actually do much space warp UI work until tuesday or late tomorrow
want it ready for 1.1.0?
Yeah
tbf we can wait till wednsday to release 1.1.0
i dont see why not
i have wednsday never knew how to write that shitty word
Addressables really do be breaking my unity projects tho
as it breaks TKs addressables browser
btw, a patches Init(MethodBase) is called as soons has Harmony.CreateAndPatchAll right?
kinda abbreviated this a lot but yeah
I'm having a hard time understanding what you just said
ok wiat
private static bool Init(MethodBase original)
{
if (original is null)
{
return true;
}
_partHash = new Dictionary<string, Texture[]>();
_propertyIds = new[]
{
Shader.PropertyToID("_MainTex"),
Shader.PropertyToID("_MetallicGlossMap"),
Shader.PropertyToID("_BumpMap"),
Shader.PropertyToID("_OcclusionMap"),
Shader.PropertyToID("_EmissionMap"),
Shader.PropertyToID("_PaintMaskGlossMap")
};
_ksp2Opaque = Shader.Find(KSP2_OPAQUE_PATH);
_ksp2Transparent = Shader.Find(KSP2_TRANSPARENT_PATH);
_unityStandard = Shader.Find(UNITY_STANDARD);
Logger = BepInEx.Logging.Logger.CreateLogSource(displayName);
return true; ///TODO: add config to enable/disable this patch, if disabled return false.
}```
this method, its quite essential for the whole ColorsPatch
on SORRY i had to call Init, even tho its called when the patch is created
i wonder if the same issue will happen on SpaceWarp
as far as ive tested no, but you never know
quick fix would be to call init on SpaceWarpManager
btw Normals looking good, will pr the colors patch too
ignore the misspainted area lmao
I mean yeah, just call init somewhere in SWs load process
Check your remote?
no luck, hmm let me recreate the branch maybe
Gods, making an editor script for parts is going to be fun :3
i imagine lmao
I have to figure out how to convert between the json and PartCore data
And then add tools to get the JSON from PartCore data
Then add custom editors for every module
did this fucker create a branch named ColorsPatch
isnt it a direct conversion?
Yes, but I have to write a script to do it, so you don't have to do it twice
then add editor gizmos cuz y'know
Technically it sounds like it shouldn't be too difficult since the JSON contains just the serialized objects
also
whoever has all 6 textures on the parts gets this message
if (count == 6)
LogMessage($"\t\tWoW Much Textures!");
For the part modules at least
"Come to Brazil" is a good one lol
Cool I can't just do this
if (!GUILayout.Button("Save Part JSON")) return;
var core = (serializedObject.targetObject as CorePartData)?.Core;
if (core == null) return;
var json = IOProvider.ToJson(core);
var t = new TextAsset(json);
AssetDatabase.CreateAsset(t, $"Assets/{core.data.partName}.json");
Unless
whens what day?
KSP2 literally doing reflection to load unity converters lmao
private static List<JsonConverter> CreateDefaultConverters() => (List<JsonConverter>) Assembly.Load("Newtonsoft.Json.UnityConverters").GetType("Newtonsoft.Json.UnityConverters.UnityConverterInitializer").GetMethod("CreateConverters", BindingFlags.Static | BindingFlags.NonPublic).Invoke((object) null, new object[1]
{
(object) ScriptableObject.CreateInstance<UnityConvertersConfig>()
});
Why isn't it working for me though
Almost got CorePartData -> JSON conversion working
Gods this is too much of a pain
I'm not working on this just yet
you should vc
Nah, I'm headed to bed
even better idea
Will it include modules too?
Thats what I need to make work
Is it also a direct conversion? or nah?
what is missing?
oh i see, the types are missing
Then afterwards I can get to work on editor gizmos for stuff
hmm i wonder, cant you just do GetType()?
Such that you can see COM in the editor and such
Possibly, I need to write a custom converter I suppose
i think its still a direct conversion
is just that u need to add the class reference before
Ie:
{
"Name": "Data_DeployableControlSurface",
"ModuleType": "SORRY.Modules.Module_DeployableControlSurface, SORRY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"DataType": "SORRY.Modules.Data_DeployableControlSurface, SORRY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"Data": null,
"DataObject": {
"$type": "SORRY.Modules.Data_DeployableControlSurface, SORRY",
"IsDeployed": {
"ContextKey": "IsDeployed",
"storedValue": false
},
"ModuleType": "SORRY.Modules.Module_DeployableControlSurface, SORRY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"DataType": "SORRY.Modules.Data_DeployableControlSurface, SORRY, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
"IsActiveInStagingProp": {
"ContextKey": null,
"storedValue": false
}
}
}
Version can be 0.0.0.0
And then its a direct conversion of all the public and private[SerializeField] fields
now idk how you will get the ModuleType and DataType
also how you will get the Assembly name...
oh ok
hmm tbh, i think that you could just have the Part Core Data editing for now
since the line # is always the same
Yes, but like if I could automatically detect modules and such, I could build up the part data completely programatically
I have an idea too
go for it! :D
Gods, I wish I had a debugger in the unity editor though
i do think theres one
you can just debug it with visual code iirc
at least for OnInspector() works
https://answers.unity.com/questions/1233717/how-to-attach-the-debugger-to-an-editor-script.html seems like it should be possible to attach a debugger to Unity itself the same way you can attach to a player
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
yeah exactly
Cool, then I can actually see if what I want to set exists
But honestly I might just auto detect modules in any case
@sacred jasper this would cause SpaceWarp to not load at all right?
[Error : BepInEx] Could not load [Space Warp 1.0.1] because it has missing dependencies: com.bepis.bepinex.configurationmanager (v17.1 or newer)
yep, Configuration Manager is a dependency
ok, so the person on the forum has a botched install
possibly they could have been trying to delete all mods to figure out which one is causing errors or something to that effect, and deleted everything in the plugins folder except for SpaceWarp
he said he "Removed all other mods"
probably thought that it was one of the mods
it reallly should be on another folder tho
also SpaceWarp should be on BepInEx folder imo but idk if thats possible
well it's a BepInEx plugin like any other
no its not 🙄
it is though?
SpaceWarp is better than the other plugins
it's just that SW has a dependency on it
we'd have to write yet another preload patcher for BepInEx to allow loading SW + CM from a different folder
and it'd just make things more messy in my opinion
you install library plugins into BepInEx/plugins like everything else
and SpaceWarp is just that - a library plugin
yeah i mean as long as players dont delete the configuration manager should be ok
its just like deleting the Squad folder on KSP1
well, except BIE mods will still work without SW and CM
so it's just an optional plugin, not like deleting the actual stock game's content
but mods dependent on SW wont obivously
I'd compare it more so to deleting ModuleManager from KSP1
you could have mods that work without it, and the game will still run, but most mods depend on it
@sacred jasper want me to get on some UITK SpaceWarp work?
I know you did some work on the modlist already
Go for it
I barely did anything tbh
Just mocked up what it would look like somewhat
we still haven't got it completely down (the light colors), but at least we can get started since the feature is there
I'm still also thinking through the API for the UI lib
for now I'll just probably keep it very simple and just abstract this portion of the code into a static method or something like that
So what I'm looking for doesn't exist, meaning I'm going to have to serialize it myself
you can just create a new() and serialize that @sacred jasper
imagine, at the end of part core data
button with new module
dropdown with modules
No, no I know what I am doing
@gilded kettle getting closer
great
now just serialize the datas
they are already serializable so it should be easy
and i think its a direct conversion too
this will be so helpful tho specially for attachment nodes and CoM,P,D,B,R
Oops I crashed unity
Meaning I have to do the fun thing of reimporting
fuck, I didn't have the scene saved so now I have to reset up the part
Great i cant fucking debug ksp2 for some reason
i will never fix the gridfin i feel
when i attatch dnpsy it crashes
have you put it into debug mode?
debugging from Rider works for me fine, so it should from dnySpy, too
Dakota is going to see my editor scripts at some point and hire me on the spot /j

they gotta have some sort of a better workflow for creating parts and stuff, I wish they'd release at least some parts of it for modding at some point
@gilded kettle I got the part json from the core part data
hmm
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (!GUILayout.Button("Save Part JSON")) return;
if (!_initialized) Initialize();
var core = (serializedObject.targetObject as CorePartData)?.Core!;
var targetGO = (serializedObject.targetObject as CorePartData).gameObject;
if (core == null) return;
// Clear out the serialized part modules and reserialize them
core.data.serializedPartModules.Clear();
foreach (var child in targetGO.GetComponents<PartBehaviourModule>())
{
child.GetType().GetMethod("AddDataModules", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(child, new object[] {});
core.data.serializedPartModules.Add(new SerializedPartModule(child,false));
}
var json = IOProvider.ToJson(core);
File.WriteAllText($"{Application.dataPath}/{core.data.partName}.json", json);
AssetDatabase.Refresh();
EditorUtility.DisplayDialog("Part Exported", $"Json is at: {Application.dataPath}/{core.data.partName}.json", "ok");
}
ur missing the context keys
context keys?
"IndependentThrottlePercentage": {
"ContextKey": null,
"storedValue": 0.0
},```
its a parameter from ModuleProperty
should be easy to get
its basically the same as the name of the property
they are important I presume?
you dont even set it when creating a moduleProperty
[LocalizedField("SORRY/DCS/DEBUG/IsDeployed")]
[KSPState(CopyToSymmetrySet = true)]
[FormerlySerializedAs("isDeployed")]
[Tooltip("Current Control Surface State")]
public ModuleProperty<bool> IsDeployed = new ModuleProperty<bool>(false, true);
i mean idek why they exist but yeah they are
its the same as the name of the property
so if you just copy it over it should be fine
"IsDeployed": {
"ContextKey": "IsDeployed",
"storedValue": false
},
see? the same
I see where it is set, I'm just assuming its never called cuz serialization
also
"Generates": [],
"Contains": []
This probably wont cause isses, but on Stock parts its passed as null iirc
from gridfinM.json
"resourceSummary": {
"Consumes": null,
"Generates": null,
"Contains": null
},
It'll be fine
yeah probably, just pointing it out in case an error appears
contextkey is how you identify the moduleProperties in game tho
I'm having the conversion mostly be automatically done in the same way it reads it so
Again I can see where it is set
i just wonder if it will read as a List with no entries or as a null object
cuz if it reads as a list it might cause issues cause it might search for things inside it
but thats up for testing tbh
Fixed context keys
foreach (var data in child.DataModules.Values)
{
data.GetType().GetMethod("RebuildDataContext", BindingFlags.Instance | BindingFlags.NonPublic)
?.Invoke(data, new object[] { });
}
Had to add that nested into the foreach loop
can i try this on a part? to see if it loads?
Sure lemme just build a unity package rq for it
i was gonna try with that json xD but sure!
Its literally the xenon dawn engine
I was just using it as a test
The converter doubled up on these interesting
does the same in the game so
oh no
thats like that in the game
it worked btw
but yeah, the non capitalized is the private field
and the capitalized is the public field that can be changed depending on size, rotation etc
hell yeah
I literally just did the reverse of what KSP does, reading it
A direct conversion if you set everything up
CoM and attachment nodes shouldnt be hard
Shouldn't if I can figure out editor gizmos
u can just let the player set a transform to be them and then just read the position
DrawGizmos doesnt work?
OnDrawGizmos()
you also have OnSelectedDrawGizmos() but idk if it will work for a editor script
Gizmos are for monobehaviours
Hmm
public class MyScriptGizmoDrawer
{
[DrawGizmo(GizmoType.Selected | GizmoType.Active)]
static void DrawGizmoForMyScript(MyScript scr, GizmoType gizmoType)
{
Vector3 position = scr.transform.position;
if (Vector3.Distance(position, Camera.current.transform.position) > 10f)
Gizmos.DrawIcon(position, "MyScript Gizmo.tiff");
}
}
should work
u could get the yellow and black CoM icon for that then
with the DrawIcon
Oh handles are kinda what I want actually
Handles and gizmos together would help
should be doable? MAYBEEE
unity editor editing is such a mess
#1088816954426527775 its ur fault
huh?
To quote me
It shan't be too hard
I'll do handles at a later date, gizmos should be fine for now
just to view the CoM and everything
@gilded kettle Center of mass and center of lift gizmos
And an attempt at CoT
Gonna remake it likely
If only I had an actual model to test it on
Might remove the thrust viewer though for now
And basic drag cube visualization
Any progress on this?
had to do some irl work first but now I'm working on cleaning up the UITK library and adding some of the API methods
Ooo fun I just found a better way to render drag cubes I think
(nope)
the wireframe cube?
might be better actually
its a 50% transparent cube
the wireframe cube is very good at those things
its used all over unity for bounds
but transparent cube is also verygood since you can see when a mesh is going out of bounds
@sacred jasper are the gizmos in yet?
yes
hmm i dont see them...
should be at 0,0,0
no errors besides these
i think im missing the icon
just moved one of them and that icon flew around
also custom modules dont work, but this is not critical since if the person made their own module they should know how ot create the json
{
"Name": "PartComponentModule_DeployableControlSurface",
"ComponentType": "SORRY.Modules.PartComponentModule_DeployableControlSurface, SORRY, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null",
"BehaviourType": "SORRY.Modules.Module_DeployableControlSurface, SORRY, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null",
"ModuleData": []
},```
wait let me test something, might actually be a problem with inherited classes
nop the problem is with custom modules
Do you have the"AddDataModules" function defined
yup, but the body is not the same as the stock ones
protected override void AddDataModules()
{
base.AddDataModules();
this.DataModules.TryAddUnique<Data_Engine>(this.dataEngine, out this.dataEngine);
}
Should look something like this
It's the only way to have that module data in there basically
that doesnt work on custom modules, it throws a null reference on this.dataEnigne
Thats a field you set
even if i create it before
i'll show u how it looks
same happened to Data_Hinge on #1088816954426527775
Alright, what does the function look like for you?
public override void AddDataModules()
{
base.AddDataModules();
if (this.DataModules.TryGetByType<Data_DeployableControlSurface>(out this.dataDeployableControlSurface))
{
return;
}
this.dataDeployableControlSurface = new Data_DeployableControlSurface();
this.DataModules.TryAddUnique<Data_DeployableControlSurface>(this.dataDeployableControlSurface, out this.dataDeployableControlSurface);
}
DataModules usually already has the module
actually it always has the module
the last bit is only for safety
either way just the last bit still throws a null reference iirc
Not in how I'm doing it won't have
when the json is compiled, it creates the dataModule and stores it in DataModules
hmm true
well hmm
idk? i'll try to make the AddDataModules as default and see if it works
addData should already be made
or dataDeployableControlSurface
ohh I see whats happening
basically do this
this.dataDeployableControlSurface ??= new Data_DeployableControlSurface();
this.DataModules.TryAddUnique<Data_DeployableControlSurface>(this.dataDeployableControlSurface, out this.dataDeployableControlSurface);
@gilded kettle try that
Oh that might actually be it wtf totally forgot about them
i hate that BepInEx doenst give you the exception that made it stop....
this person cant load my mod and all i have to work is this
https://mega.nz/file/ciIwxCba#K60YffsO2v8iHRo11u80x8pSMFzfyxpDjCyryTVZtHw
actually, the mod doenst appear on the logs at all, can it be that the dll got deleted? happened to Sticks too
Did this work @gilded kettle
oh sorry was trying to make my part load
let me test
had to reimport KSP2 and now it says Multi-Object editing is not supported
@sacred jasper still nop :(
Odd?
{
"Name": "PartComponentModule_DeployableControlSurface",
"ComponentType": "SORRY.Modules.PartComponentModule_DeployableControlSurface, sorry, Version=0.2.3.0, Culture=neutral, PublicKeyToken=null",
"BehaviourType": "SORRY.Modules.Module_DeployableControlSurface, sorry, Version=0.2.3.0, Culture=neutral, PublicKeyToken=null",
"ModuleData": []
},
you can try with the dll to debug it
Can you send me the full script
Try seeing if adding [ExecuteInEditMode] to your module works
will do as soon as i reimport KSP for the 10th time
That is so f-ing annoying that that has to be done
nope no luck
maybe when creating the monobehaviour
it should create the data as well
but it isnt
which is wierd because the stock modules dont either
but in game that works
super odd
How do you have the part set up in the editor
like can you screenshot the inspector
can you foldout datactrlsurface in the module_ctrl_surface
Actually wait I have the scripts I can debug this after lunch
Well it obviously exists
data deplyable just has a Request handle label
Alright, time to do debugging in the unity editor after lunch
lmao good luck, anything u need im here!
@gilded kettle do you have the partcomponent script?
yup
can you send it to me
Oh yeah munix, speaking of UI, I'm trying to figure out how to hook mod config into the settings menu
about this, do you mean basically replicating the Configuration Manager but within like a custom tab of the in-game Settings menu?
are u trying to test the json already? :O
That would be so much better
also it would be good if we could separate per mod, just like KSP1
a good way to achieve this without cluttering the native Settings menu could be to have like a toggle somewhere at the top of the tab list in the Settings menu that would switch between game settings and mod settings
Oh gods, testing your script in the editor, I have to change access modifiers and such because Space Warp template publicizes KSP2
And TK does not
maybe something like this?
Did you just add that?
just Photoshop haha
Yeah specifically like that
@gilded kettle when I converted the script to use a non publicized version of KSP2s assemblies ... it worked first try??
using System;
using System.Reflection;
using I2.Loc;
using KSP.IO;
using KSP.Modules;
using UnityEngine;
namespace SORRY.Modules
{
[DisallowMultipleComponent]
public class Module_DeployableControlSurface : Module_ControlSurface
{
private static readonly FieldInfo DragField =
typeof(Module_ControlSurface).GetField("dataDrag", BindingFlags.Instance | BindingFlags.NonPublic);
private Data_Drag _dataDrag => (Data_Drag)DragField.GetValue(this);
public override Type PartComponentModuleType => typeof(PartComponentModule_DeployableControlSurface);
protected override void OnInitialize()
{
base.OnInitialize();
AddActionGroupAction(SetControlSurfaceActiveState, KSP.Sim.KSPActionGroup.Brakes, "Toggle Control Surface", dataDeployableControlSurface.IsDeployed);
AddActionGroupAction(SetControlSurfaceActiveStateOn, KSP.Sim.KSPActionGroup.None, "Activate Control Surface");
AddActionGroupAction(SetControlSurfaceActiveStateOff, KSP.Sim.KSPActionGroup.None, "Deactivate Control Surface");
UpdatePAMControlVisibility();
}
protected override void AddDataModules()
{
base.AddDataModules();
dataDeployableControlSurface ??= new Data_DeployableControlSurface();
DataModules.TryAddUnique(dataDeployableControlSurface, out dataDeployableControlSurface);
}
protected override void CtrlSurfaceUpdate(Vector3 vel, float deltaTime)
{
if (dataDeployableControlSurface.IsDeployed.GetValue())
{
base.CtrlSurfaceUpdate(vel, deltaTime);
}
}
private void SetDragCubes(bool deployed)
{
_dataDrag.SetCubeWeight("Deployed", deployed ? 1f : 0f);
_dataDrag.SetCubeWeight("Retracted", deployed ? 0f : 1f);
}
public override string GetModuleDisplayName()
{
return LocalizationManager.GetTranslation("PartModules/ControlSurface/Name", true, 0, true, false, null, null, true);
}
private void SetControlSurfaceActiveState(bool newState)
{
animator.SetBool("Deployed", newState);
dataDeployableControlSurface.IsDeployed.SetValue(newState);
SetDragCubes(newState);
}
private void SetControlSurfaceActiveStateOn()
{
SetControlSurfaceActiveState(true);
}
private void SetControlSurfaceActiveStateOff()
{
SetControlSurfaceActiveState(false);
}
protected override void UpdatePAMControlVisibility()
{
base.UpdatePAMControlVisibility();
dataDeployableControlSurface.SetLabel(dataDeployableControlSurface.IsDeployed, "Debug/IsDeployed");
}
public Animator animator;
[SerializeField]
protected Data_DeployableControlSurface dataDeployableControlSurface = new Data_DeployableControlSurface();
}
}
(Storing this here for testing purposes)
Gods I have to import the entirety of BIE and SW
Okay so why the fuck does the imported version not work
@sacred jasper finished the first API version, in the end I added more than I was planning at first, but it should now be good enough (with minor additions) for some time (#1085537097714245662 message)
I'll get started on the actual SpaceWarp UI tomorrow
1.1.0 is set to release tomorrow right?
Not sure if 1.1.0 is ready to be released. Depends on the scope for the update.
I'm not sure if cheese wants to wait for the UI or not
because that will most likely take a couple of days
its mostly cuz i was gonna start working on the custom shader settings importer
You can just start work on it, fork it and build it and create a branch for it in your mods repo
We usually release at the end of the week. Often Sundays
With 2 ish weeks between each minor release
I just created a custom importer API for space warp lol
Allows you to define your own addressables importers and assets/whatever importers for all mods to use
And I made space warp use it
nice
UITK could technically then use it to parse mods' .uxml and .uss files into assets, I assume
It'd technically have to be a separate mod than UITK as it depends on Space Warp, but yes
oh yeah true
We can wait
Carnasa isn't making a mod showcase this week so we don't need to target that :p /hj
I love lambdas, functional programming is kinda based
Even if Im capturing state in lambdas
The asset loading API I made makes extensive use of lambdas
is my formulation of the question ok? or needs something more? https://discord.com/channels/1078696971088433153/1090394325432684635
It's good enough for me to work with
A totally different question - would you mind if I hosted a SpaceWarp named Nuget server? While many things can be uploaded on nuget.org, I'd like to have something similar to the BepInEx Nuget server, where we could have all the KSP2 modding related packages including the publicized UITK package (like BIE Nuget hosts publicized UnityEngine.Modules - but just the default ones)
Alternatively if not under the SpaceWarp name, can totally just make it something generic about KSP2 modding, but would still like your opinion on it
Honestly sounds like a good idea
I made a free account on cloud.oracle.com which will allow me to host a Docker container with the same Nuget server implementation that BIE is using
Cheese, how is part tools going? I can take a look at the code on github if you are still having problems with custom modules.
and would just need to purchase a domain to get this set up
Currently debugging custom modules with SORRY.dll
It works with converted editor scripts but not dlls as I said
which shouldn't be too much of a hassle at like 7-12€/year for something like .org or .dev
OHHH @gilded kettle I JUST REALIZED THE ISSUE WITH DLLs
I bind to a non public method
but they are built against publicized dlls
Nah bro you good
Gods I am failing at C# today
Anyways @gilded kettle
I got it to serialize correctly c:
Up[load to github immedietly, I beg of you
Ohh,
the github repo doesn't have the gizmos
but its fine
why is the source code in a completely different format than it is on my machine?
ohh I didn't push lol
but the package is correct
OHHH WTF
that makes a lot of chance lmao
how do i change it?
like in my dll
don't
It'll work with your dll now
This fix was like 2 extra lines of code on my end
Reflection in the unity editor be fun
@sacred jasper http://130.61.239.77/
getting there
it took ages, since the free-only tier on Oracle Cloud only has ARM64 VMs, so I had to mess around with some Docker stuff to get .NET and ASP working correctly, but I've got it now
Oh shit you actually got spacewarp.org
yep, got that + ssl certificates for two years for $30
not a bad deal
which means SpaceWarp better last at least two years 😛

Side note
I was looking at uploading packages and noticed powershell
You can call C# functions w/in an assembly from powershell
huh that's cool
$code = @"
using System;
namespace HelloWorld
{
public class Program
{
public static void Main(){
Console.WriteLine("Hello world!");
}
}
}
"@
Add-Type -TypeDefinition $code -Language CSharp
iex "[HelloWorld.Program]::Main()"
This is a valid powershell script

Add-Type makes me feel as if Powershell is just a .NET repl
honestly it's probably not too far from that
Wait are powershell scripts fucking jit compiled into CIL???
PowerShell V3 and later compile the parse tree (the AST) to a LINQ expression tree, which is then compiled to a bytecode, which is then interpreted.
Unfortunately you cant compile it to an assembly
Also valid powershell
class Device {
[string]$Brand
[string]$Model
[string]$VendorSku
[string]ToString(){
return ("{0}|{1}|{2}" -f $this.Brand, $this.Model, $this.VendorSku)
}
}
class Rack {
[int]$Slots = 8
[string]$Brand
[string]$Model
[string]$VendorSku
[string]$AssetId
[Device[]]$Devices = [Device[]]::new($this.Slots)
[void] AddDevice([Device]$dev, [int]$slot){
## Add argument validation logic here
$this.Devices[$slot] = $dev
}
[void]RemoveDevice([int]$slot){
## Add argument validation logic here
$this.Devices[$slot] = $null
}
[int[]] GetAvailableSlots(){
[int]$i = 0
return @($this.Devices.foreach{ if($_ -eq $null){$i}; $i++})
}
}
$rack = [Rack]::new()
$device = [Device]::new()
$device.Brand = "Fabrikam, Inc."
$device.Model = "Fbk5040"
$device.VendorSku = "5072641000"
$rack.AddDevice($device, 2)
$rack
$rack.GetAvailableSlots()
Just a casual object oriented shell
class Device {
[string]$Brand
[string]$Model
[string]$VendorSku
Device(
[string]$b,
[string]$m,
[string]$vsk
){
$this.Brand = $b
$this.Model = $m
$this.VendorSku = $vsk
}
}
[Device]$device = [Device]::new(
"Fabrikam, Inc.",
"Fbk5040",
"5072641000"
)
$device
W/ constructors
And static methods
class Device {
[string]$Brand
[string]$Model
}
class Rack {
hidden [int] $Slots = 8
static [Rack[]]$InstalledRacks = @()
[string]$Brand
[string]$Model
[string]$AssetId
[Device[]]$Devices = [Device[]]::new($this.Slots)
Rack ([string]$b, [string]$m, [string]$id, [int]$capacity){
## argument validation here
$this.Brand = $b
$this.Model = $m
$this.AssetId = $id
$this.Slots = $capacity
## reset rack size to new capacity
$this.Devices = [Device[]]::new($this.Slots)
## add rack to installed racks
[Rack]::InstalledRacks += $this
}
static [void]PowerOffRacks(){
foreach ($rack in [Rack]::InstalledRacks) {
Write-Warning ("Turning off rack: " + ($rack.AssetId))
}
}
}
And inheritance
Class Derived : Base {...}
its literally called a .NET consumer language
you can't use it to make DLLs
but it can consume anything from .NET
Interesting
I only learned of this stuff about it like 3 days ago
u mind if i make a mods.spacewarp.org? for a listing of sw mods, basically the same as a spreadsheet
Would be awesome
alright, after fighting with the certificates for some time, I finally realized I'm just dumb and the certificate I have is a single-domain cert, not a wildcard one
BaGet
so at least now I know that's working
ideally I'll change that to have a path like spacewarp.org/nuget, at least
and the above comment ties into this, we can't have subdomains if we want https
would it be ok to create an extension of BaseSpaceWarpPlugin for part mods?
that way i could integrate the part declaration and make it the same for all
for now its only on the mods Plugin class, each person would have to add the CM config to it
CM Config?
basically this
var configValue = Config.Bind<string>("Parts", "partNames", string.Empty, "Add your parts name here (part1, part2, part3, ...)");
if (Config.TryGetEntry<string>("Parts", "partNames", out var entry))
{
if (!entry.Value.IsNullOrWhiteSpace())
{
string[] parts = entry.Value.Split(',').Select(a => a.Trim()).ToArray();
if (parts is not null && parts.Length > 0)
Colors.DeclareParts(MyPluginInfo.PLUGIN_GUID, parts);
}
else
Logger.LogWarning("No parts were declared");
}
with the inherited BaseSpaceWarpPlugin i could add this and a couple more useful methods like GetAllParts
this could also be in the baseplugin tho
Just to make sure - you know these settings are meant to be user settings and as such they can change them at any time through the Mods menu in-game, right?
yup!
but since we have no easy way of telling what mods adds what parts
they are all loaded the same unfortunately
either the cm config or a .json under the mods folder
or hardcode it which isnt optimal imo
I mean you could do almost the same thing, just with a custom file instead of the user config
so that they can't accidentally mess it up
yeah ik, im not against that
but currently spacewarp doenst read .jsons and .txts
it would be better to not add a new IO
well it's just a matter of File.ReadAllText("filepath")
I don't think you need an abstraction for that
hmm
my thing is more to make all part mods have the same structure
cuz like that a modder could have their parts elsewhere and read them there
tbh i think im overthinking, maybe hardcoding it wouldnt be bad
parts dont change that frequently (unless ur testing)
I still don't think I understand
its basically a way to know what parts are from what mods
instead of the part names being in BepInEx/config/<mod_id>.cfg , they would be for example in BepInEx/plugins/<mod_id>/parts.txt or whatever you choose
yeah that seems good! but would be nice to be in either BaseSpaceWarpPlugin or smiliar
Yeah I'm not against having a subclass like BasePartSpaceWarpPlugin or something
(of course that's just my opinions, cheese could have a different one)
but i undestand the separation
@sacred jasper thoughts on a BasePartsSpaceWarpPlugin class for part mods?
you could technically just add a virtual method like public virtual string[] GetDeclaredParts => new string[]{};
which mods that want to declare parts would have to override
true
You could just add a loading step that loads part names from a file
the class would also be for part mods only methods and extensions
like ie: disabling a part or changing settings for a part etc etc
At this point it circles back around to the module manager esque thing we were discussing
well true
either way i think that the virtual string[] GetDeclaredParts is a good addition to BaseSpaceWarpPlugin
Wont this break backwards compatibility?
for part mods or in general?
for part mods yeah, but theres only 2 for now so its no biggie
in general, no? i think?
It shouldn't, I think? If a mod doesn't override it, the default SW implementation will be used, which would just return an empty array
Test it?
it should work the same way as these, you also don't have to override all/any of them
but testing it is a good idea anyway
@gilded kettle you can use the new loading API to define a loader for part names as well if we don't/can't override that
/// <summary>
/// Registers a per mod loading action
/// </summary>
/// <param name="name">The name of the action</param>
/// <param name="action">The action</param>
public static void AddModLoadingAction(string name, Action<BaseSpaceWarpPlugin> action)
{
LoadingActionGenerators.Add(p => new ModLoadingAction(name,action,p));
}
This API call being the one you want to use
oh great actually i think that would be better
also thats amazing, i can put Colors Texture loading per mod on that
also TUX configs
damn that will be so useful
but still i think the override is important so that mods can get other mods part names etc
ie: Remote Tech 2 adding their own component to any part that is an antenna
but again, circling back to MM
Yeah that's still something we need to investigate
How to do a module manager esque system
I mean, we could start by writing a bespoke parser for KSP1s module manager syntax and change it
@PART[*] /// This means any and all parts
{
%MODULE[HitpointTracker] // this means add update or modify, in this case add a hitpoint tracker module
{
ArmorThickness = 120 //// this section will be specific to whatever you are doing or the module you want to fit
maxHitPoints = 8000
ExplodeMode = Never
}
}
Or we could go another route
I think we should use JSON from the start tbh
ideally we'd cache any mod configuration .json files + applied patches (could use https://jsonpatch.com/ format for that at least in the beginning until we have something more powerful) into a bundle-like format when changes are detected
[
{
"match": "*",
"actions": [
{
"type": "add_module",
"module_name": "HitpointTracker", // This could be done better, maybe a fully qualified path
"module": {
"ArmorThickness": 120,
"maxHitPoints": 8000,
"ExplodeMode": "Never"
}
}
]
}
]
So something like that?
I know that @late condor linked a .NET library for creating/modifying Unity asset bundles
not sure how well it works
thanks 👍
It depends on what you mean by how well it works
Patching the JSON is a nonstarter I think?
Its also encoded in the prefab
It works quite well imo, but its not the easiest to use for a lot of reasons
If this is in reference to patching assets files, or addressable bundles files, that doesn't really seem like a good way to go
"module_name" maybe could be like the parts references
not really patching existing ones, more so creating a custom cache bundle
Class full name, assembly name, version, publicize etc
Oh you mean the whole thing I was talking about a while ago about packing loose assets into a bundle to improve loading?
Yeah, you can certainly do it with AssetsTools.net, I wouldt really suggest it though unless you're interested in taking on a challenging and time consuming project
As I said this seems like a nonstarter
well to be fair anything even similar to module manager is basically near impossible with the way assets work in this game
You'd have to somehow extract all JSON files from all asset bundles, addressable or not, apply the mods' patches, save them all into a custom bundle, and then somehow patch the game to read all JSON from that instead of the actual bundles
The last part is the easiest actually
We can just call readandupgradepart on all parts
isnt it easier to do a prefix on the loadFlow, check if its the part and if it is modify?
well I was talking about a more general approach, not just parts, since Module Manager doesn't just deal with parts
This is the function I'm talking about
I'm talking about a parts system for now, but yeah
but I guess it could be doable for just parts in the beginning
would this affect all instances or just this one?
havent played with that yet
Is partcore duplicated?
it looks like it from the method
seems like it gets the said part, upgrades an instance of partcore and returns the upgraded instance
but again idk cuz havent checked it yet
might want to bring @sweet raft into the conversation since they said they wrote the first versions of Module Manager for KSP 1, and had some ideas for the successor
(when they're online that is)
Prob good to hear what Hephaistos has to say indeed
Hallooo
Yeah, you def want to be able to at LEAST patch all addressable json files
Parts, physics, game settings, etc
Also, 2 things that would have made mm much less of a nightmare in the beginning
- a full scripting language (may as well use javascript / node.js)
- live inject-and-reload hooks
So ideally, the new jsonmanager should be able to be called live, with an API that exposes "patch and reload" requests to other mods, and with a UI in the game settings menu that lets you select/deselect each patch thats been applied, change the application order, and force a flush/reload.
The current preferences for which patches to apply and which to suppress can itself be saved as a .json preferences file
Did all that make sense?
Actually, Lua might be a good idea to use Lua so we don't need another scripting language interpreter
Is json lua-native?
No but we can provide a moonsharp function for loading it
My reason for prefering js is that json is native to js
Which means that the patch nodes and patch scripts can exist in the same file without context switching
And "how to address" syntax is already handled natively
Also, there are several javascript interpreters for Lua, and even more for C#
Aha, looks like unity.jslib is the right path
@wicked wyvern thoughts on loading another scripting language interpreter into KSP2?
I mean I'm not against it, especially if it's just mostly used on startup
Depends on the performance I guess?
We want loading to stay as fast as possible, and not turn the game into another KSP1 half-hour-loading-times nightmare
I'm on a train again so I'm here but the connection will be shaky
Maybe I'm misunderstanding something here, but if the objective is to modify the contents of part json files, and all part jsons are in addressable bundles and have their own address.
Whats stopping you from just overriding the address per IGs instructions, and then computing the modified part json and saving the result to a folder to loading from in the future to avoid unnecessary computation?
Well what Module Manager does is not just replace the part definition (or many other things than that), you can specify for example that for part X, you want its module Y's property Z to be set to 10x its original value
That had no bearing on my point really
When you're replacing a ResourceLocator you can replace it with a custom implementation of IResourceLocation, which can handle the processing of multiple data files however is needed to compute the final result that you save for future use
You're "simply replacing the part json" in the end, but its that layer that handles all the computation of the complex part modification
you don't need, and I'd go as far as to argue, you don't want, to modify the sources of any of the json, only intercept and replace the final result
and as far as saving those results and speeding up loading, you can just zip them in a zero compression zip so that you remove all IO overhead feasible
I'm not sure its as simple as replacing the json, but hmm
That feels like a caching implementation decision
if other things need to be intercepted, it will just be more things to intercept
Im talking about base features
i'm talking about the entire stack
from reading multiple json files that modify a base json file to providing the final json result
The main lesson for MM was that there are a minimum number of features required to service mods, and if you dont bundle them all in a coherent package, you get a nightmare later
I'm still unsure about how the loading of the game's json that is to be patched would work
Im gonna be a bulldog about that
you load the addressable json file using addressables, apply all json modifications, return the modified result via the locator
Like, let me say this more simply: architecture is AT LEAST 20x more important than implementation, here. Probably more like 100x to 1000x
if architecture is more important, then adding scripting languages that split up the user base is a bad choice
So I want us to stay laser focused on architecture, and then worry about implementation only when architecture is rock solid and feature complete
Disagree, and feels like a weird distinction
I feel a little flustered, so Im not sure I can convey all of my experience adequately
So basically we'd use the default locator in the patching process, then register a custom one which has the addresses replaced with the modified files, and that will have precedence when the game tries to load them?
If I'm an expert in C# and know nothing of LUA, then having both means that some people will know C# and some will know LUA, and everyone will have a different view on things because implementations will not be 100% equal due to fundamental language differences
But maintaining mm was a nightmare for all these reasons
if everyone is working from the same basis, everyone learns the same knowledge and workflow
but this is irrelevant, adding languages isn't important at all right now
I dont know if anyone here knows what the other person is arguing about
I mean we can just have people write the patches in C# and compile them with Roslyn at runtime lol
But it sounds a bit contrived for working with JSON
HOLD. UP. I need to understand smth and I need Twiner to help me
Then we can get back to this.
Sure, y'all have fun with this lol, I'll get back to the UI
So, I just fired up LUA and learned it this morning, so I could understand better the decision weights
You seem to be suggesting that not knowing a specific language is a kind of impedement?
Is that accurate?
well it is, but thats not what I meant no
What did you mean then? Im very confused.
Like, MM @cfg was literally its own language, its a domain specific language but still
As of Sarbian its turing complete
And ppl learned that immediately
(its not SUPPOSED to be turing complete so pls dont have ppl mess w it too hard, constructing a loop would be impolite)
if you're an experienced programmer then the language is fairly irrelevant other than when languages do stupid shit like start array indexes at 1 which most languages don't do.
However that doesn't matter because most modders are not experienced programmers and so they will have to learn whatever tool they have to use to get the job done.
If there are more tools, there are more things people have to learn and there is cross talk with using different languages to accomplish goals.
Doing something custom from the outset is a generally bad idea because data transformation tools that are well developed, well documented and sort of easy to use.
Re: How Standard Proliferate.
But my comments about the architecture of the system has nothing to do at all with programming languages, or data transformation langauges, just the architecture of how you would set up the scaffolding you need before you can even look at those aspects
If you want to avoid domain specific tools for the actual data transformation, then use something like XSLT which is well documented and very powerful
Right so. In my intuition, and maybe this is a weird way to look at it, if we have json we already have js, we are just pretending we dont
this looks like a pretty complex discussion, can we move it here please? https://discord.com/channels/1078696971088433153/1090679389143973898
it only makes sense to have its own Projects thread
I see json, I immediately assume I can address it dynamically using js syntax
I know thats wrong in point of fact but it being wrong usually bugs me enough to import a js interpreter
Ok, lets move
? wdym
yes u can xd
i have it
on every single website
Their https cert doesnt allow it.
um guys
I'm trying to get the dumb certbot from Let's Encrypt working on Oracle Cloud
it's pain
just use mine 
that has nothing to do with this, we're talking about certificates
lol
but the DNS records are set on the the OC
i’m confused
you can’t use lets encrypt?
and again, that doesn’t matter because i would host the subdomain
just route it to mine through the dns record
you know you can have multiple
sure, then just give me an IP and I'll set the record
:D
better not be downloading any viruses 😛
lol
alright
nginx for the win
http://mods.spacewarp.org/ this is the address you wanted right?
yessir
alright
@wicked wyvern i just realized something, should I add an addressables resource locator for Space Warps asset manager, I dont see how useful it would be but
as in not registering catalogs in the default one but in a custom one?
Ehh, ill explain later
lmao sorry if I'm too dumb to get it
I mean just implement a resource locator that looks into the AssetManagers assets
Well, the same as the path in the assetmanager
sure, why not I guess
So @wicked wyvern you've been working on the UI, how does it look if you have any previews?
honestly I haven't even started, I went from wanting to make that Nuget package for the UI Toolkit .dlls to figuring out the custom Nuget server to now figuring out certificates
but I'll just get started on it now, nothing prevents us from using the Nuget server without HTTPS I guess, and I'll hopefully figure it out later
I was trying to set up the Let's Encrypt certbot for automatic free certificate request and renewal on the Oracle Cloud but any way I approached it I just got to errors to which I couldn't find any solutions online
also @sacred jasper we are making a mods.spacewarp.org for a kinda showcase of the best mods
something like that
might make it the landing page
with an "about" section
The landing page should be about spacewarp itself
definitely
I mean it could all be on the main domain
with the mod showcase below or on another page
thats the point of subdomains ^
after much pain and many tears, finally the nuget server is running with SSL lol
BaGet
thanks to some help from @timber cedar
np ^
the first actual package, and the whole reason I did this whole thing, to be able to override dlls from the BIE nuget package UnityEngine.Modules
and it is indeed working
now I can finally build Ksp2Uitk with 0 .dll references, just all nuget
and that means I can finally get to the UI lol
Hell yeah
We should upload spacewarp to this site
I don't know if I have permission to upload there
just download it off of microsofts nuget service
true
damn dotpeek is somewhat good
yeah you can't
only methods can be patched (including property getters and setters)
you'd have to make your own enum and patch all the methods where it's used
fuck, then adding extra Size labels might be harder than i though
@timber cedar DM'd me asking for the Blender file I used to make the logo, they're not on right now, so here it is for anyone else who wants/needs it:
stop on by if you need anything...
https://discord.com/channels/1078696971088433153/1079828050688086076
@sacred jasper is there any doc on the language used in the SpaceWarpDocs?
rst, readthedocs can hel
I've planned the Custom Parts per module tutorial, but idk what i can do with that language
ok
you probably don't need to
they're just numbers, you can just cast an int to the enum type and it'll act like that enum
i needed to change the Size enum that they have (X,M,L)
wait so lets say they have 1,4,8,16 set up
if i cast 2 it will still be valid?
yes
my understanding was that enums ONLY had the numbers set to them
ok
and ie if i get the name 2
will i get the number as a string?
yeah
ok greak ig i can do something about it then huh
you just have to patch where it's used to fix that
you don't actually need to swap out the entire enum
also theres the json parser, in the config they put XS in the enum field, i wonder if i puto 2 it will get converted
or you can be cursed and patch the methods on the Enum class
should be
Great then i'll make a Size "Injector" :D thx
@sacred jasper im remaking the logo
what should the bottom text be instead of "A KSP Modloader"
(better channel)
A KSP2 Modding API
ok ^
Actually its not doable, at least not between them since they’re all from 0-8, so only bigger sizes would be added
Damn
are they sorted by their value or something?
Yup, by enum value
you can force them to be sorted some other way
It shouldn't be hard to add, where should I do it? I haven't actually used SpaceWarp before.
@sacred jasper
add the backend under patching and an API in loading/SaveLoading.cs
Oh and @fierce compass make sure you are on the 1.1.0 branch
My IDE really doesn't like that project. Do you need VS '22 or something?
Yes
rider.
rider
rider
Rider is superior for sure, but it's also like $20 a month which not everyone will want to pay
oh i get it for free
I mean yeah, if you can get the student license, that's great
but can't use it for commercial purposes then, and since I use the JetBrains IDEs for work, I just have a full paid license
same :>
The thing with spacewarps game loading system @fierce compass is that it uses functional things when generating actions and such
Literally functions that take mods and return actions is the main one
but thats likely not as necessary for save loading
Loading.AddAssetLoadingAction("bundles","loading asset bundles",AssetBundleLoadingAction,"bundle");
Loading.AddAssetLoadingAction("images","loading images",ImageLoadingAction);
But like these 2 would be hard to do without per mod stuff
#🔴mod-dev message
We could make an API for fetching all the mod infos, right?
So that one mod can read what others are loaded
I was really just suggesting having PatchInitializationsIL use the new API instead of doing IL editing
(Re: Game loading)
Sure
How are we looking on 1.1.0 planned features
Struggling a bit with the UI right now, in Unity Builder it's looking just fine, but when I put it into the game, the KSP theme doesn't get applied
Just write a script that adds a stylesheet to it
Ive done it in unity
well it should be working, since to each new UIDocument I always assign PanelSettings which have the default theme set to KerbalUI
and I'm also getting a million of those in Unity and no idea what they're supposed to mean, I was designing the UI just in the Builder so it's not like I accidentally messed up something in the UXML/USS itself
I'll just try to port over as much of the code as I can to a new project and hope that helps
@sacred jasper did a pr for some defaults that have to set else parts will look off
lol the issue was that apparently sometimes the UI Builder just sets length values to "NaNpx" instead of the number you input

fun
getting rid of all of them fixed most of the issues
ohh?
Alright so we are gonna release 1.1.0 today
All good on my part
@wicked wyvern
working on the UI but not sure I can get it done today
will try my best
I have been pretty busy with work
sorry about that
I can release it without UITK for this release if its not possible
yeah it might be for the best, even if I do get it working today, it would still be better to test it for a while first
#200 for 1.1.0, nice 😆
Oh I didn't even notice that
Space Warp V1.1.0
Changes
- Added mod state toggling back to UI
- Added API for color patching for modded parts
- Added loading API for mods to define their own game and save loading states
- Added localization to space warp, supports English and Brazillian portuguese for now
Upcoming Plans
- UITK integration into space warps windows for better looking UI
I think that's how I am going to describe the release in the release
wait actually that reminds me
Fixed typo in brazilian
did the version comparison thing get fixed?
Good 😠
It should've
good, I just didn't remember if anyone made a commit for it, I just know I tested my code locally
It works for me
yep I see your commit for it
guess that could also be mentioned in the changelog, since some people were asking why their mods are in red
awesome
Whoo now I can take a break :)
Actually its 2 ls in brazillian
Then I was correct
Yup lmao sorry
And the spellchecker lied to me
Brazil is with 1 so
yep
But for languague is different i think
Im so confused wtf
When did they change??
Mandela effect much
😆
@sacred jasper #🔸mod-loader-discussion message
Odd
I should've expected that tbh...
I think with things like this + the needed 1.0.1 hotfix with last release, it might not be a bad idea to start always making a pre-release like a day or two earlier for modders to test, and implement any needed last-minute changes before release
This isn't something we can easily fix w/o having to do manual centering
@wicked wyvern or @gilded kettle could either of you try to replicate the sound issue?
Odd it seems like something I should've noticed when testing
yeah I thought the same, but then I have the music muted and I mostly just tested UI stuff on the Main Menu screen lately without going in-game
so I might have missed it
We don't even do anything with sound
Maybe there is a bug in the loading patching
I can't really look into it atm
As I am about to be busy for the rest of the day
I'll try one thing rq though
It wasn't what I thought
Its not the loading patch
so what can it be
I don't have the time to git bisect it right now as I said
I'll try to have a look
but yeah, can confirm that 1.0.1 sound works and 1.1 doesn't
tried with both
Okay, so it is somehow my fault
df97bf6882ce09e4e9a6af6d928df233efd13d77 is the first bad commit
commit df97bf6882ce09e4e9a6af6d928df233efd13d77
Author: Lexi <[email protected]>
Date: Tue Mar 28 12:44:52 2023 -0400
Added an API for defining mod loading actions
SpaceWarp/API/Loading/Loading.cs | 119 +++++++++++++++++++++
SpaceWarp/Patching/BootstrapPatch.cs | 13 ++-
.../Patching/LoadingActions/AddressableAction.cs | 41 +++++++
.../LoadAddressablesLocalizationsAction.cs | 49 ---------
.../Patching/LoadingActions/LoadAssetAction.cs | 110 -------------------
.../Patching/LoadingActions/ModLoadingAction.cs | 33 ++++++
SpaceWarp/SpaceWarpManager.cs | 70 +++++++++++-
SpaceWarp/SpaceWarpPlugin.cs | 4 +-
8 files changed, 275 insertions(+), 164 deletions(-)
create mode 100644 SpaceWarp/API/Loading/Loading.cs
create mode 100644 SpaceWarp/Patching/LoadingActions/AddressableAction.cs
delete mode 100644 SpaceWarp/Patching/LoadingActions/LoadAddressablesLocalizationsAction.cs
delete mode 100644 SpaceWarp/Patching/LoadingActions/LoadAssetAction.cs
create mode 100644 SpaceWarp/Patching/LoadingActions/ModLoadingAction.cs
Wait do I cause a null thing somewhere in the fucking thing
[LOG 19:11:42.800] WwiseUnity: Wwise(R) SDK Version 2021.1.10 Build 7883.
[LOG 19:11:42.804] WwiseUnity: Setting Plugin DLL path to: C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program 2/KSP2_x64_Data\Plugins\x86_64
[LOG 19:11:42.817] WwiseUnity: Sound engine initialized successfully.
[LOG 19:11:42.930] Modlog : Unable to locate the mods directory!
[LOG 19:11:43.249] [Graphics] Screen Resolution set to (0, 1)
[LOG 19:11:43.261] [System] Initializing Game Instance completed in 0.5734s.
[LOG 19:11:43.593] [Audio] [AkLanguageBankReloader] Current WWise Language is : English
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager about to set audio settings!
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetMasterVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetMusicVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetSFXVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetVoiceVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetKerbalCommVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetAmbienceVolume 100
[LOG 19:11:43.644] [Audio] [AudioSettings] KSPEventAudioManager SetUIVolume 100
[LOG 19:11:43.644] [Debug] [AudioSettings] KSPEventAudioManager audio settings set!
Thats the only mention of sound/audio
But @wicked wyvern as I said I gtg
that should be enough to see what went wrong though
got it
At least you know the commit
I read through the diff a couple of times and saw absolutely nothing suspicious
Try changing things?
for some reason I was assuming that there wasn't more to this in the logs but now I checked for myself and see this:
[LOG 21:26:52.588] WwiseUnity: Wwise(R) SDK Version 2021.1.10 Build 7883.
[WRN 21:26:52.590] WwiseUnity: Platform specific settings cannot be found for <Windows>. Using global settings.
[EXC 21:26:52.598] NullReferenceException: Object reference not set to an instance of an object
AkCommonPlatformSettings.get_AkInitializationSettings () (at <e43ddaa261164e408c576121c269cf5b>:0)
AkWwiseInitializationSettings.InitializeSoundEngine () (at <e43ddaa261164e408c576121c269cf5b>:0)
AkSoundEngineController.Init (AkInitializer akInitializer) (at <034701ab4b354a619603fe6d965e8c00>:0)
AkInitializer.OnEnable () (at <034701ab4b354a619603fe6d965e8c00>:0)
UnityEngine.Object:Instantiate(KSPAudioInitializer, Transform)
KSP.Game.GameInstance:InitializeDependencies(String&)
KSP.Game.StartupFlow.InitializeGameInstanceFlowAction:DoAction(Action, Action`1)
KSP.Game.Flow.FlowAction:Do(Action`1, Action`2)
KSP.Game.Flow.SequentialFlow:NextFlowAction()
KSP.Game.Flow.SequentialFlow:Update()
[LOG 21:26:52.684] Modlog : Unable to locate the mods directory!
[LOG 21:26:53.099] [Graphics] Screen Resolution set to (0, 1)
[LOG 21:26:53.111] [System] Initializing Game Instance completed in 0,7032s.
[ERR 21:26:53.137] [Audio] [Audio] SetAudioListeningMode failed to set audio listening mode to Normal
UnityEngine.Debug:LogError (object)
KSP.Logging.KspLog:Error (KSP.Logging.LogFilter,object)
KSP.Logging.GlobalLog:Error (KSP.Logging.LogFilter,object)
KSP.Audio.KSPAudioEventManager:SetAudioListeningMode (KSP.UI.AudioSettingsMenuManager/AudioListeningModeEnum)
KSP.Audio.KSPAudioInitializer:Initialize ()
KSP.Audio.KSPAudioInitializer:Start ()
Odd
I did a search in notepad for Audio
So we somehow break the InitializeGameInstanceFlowAction?
But it's weird since SpaceWarp doesn't touch that
specifically this is the method where it goes wrong
the platform settings should be found but aren't
i tried to answer but had no internet......
have you figured it out?
not yet
was this updated?
in 1.1.0?
nope, nothing even close to audio
something must have broken the loading of the assets that this needs
like the prefab
im thinking that the KSP0.1.1 broke something, shouldnt be on our end then
tried reverting the mod asset loader made by cheese?
yeah that's the commit where it broke
we know that
but not exactly what is causing it
im guessing a prefix thats not returning the original method?
let me check his commit
didn't see anything like that
do we know which asset isnt being loaded?
it might not even be an issue with an asset, I was just guessing (although I can't imagine what else the commit could have broken)
im guessing this
{
flow.AddAction(new LoadAddressablesAction(plugin));
flow.AddAction(new LoadLocalizationAction(plugin));
flow.AddAction(new LoadAssetAction(plugin));
foreach (var action in Loading.LoadingActionGenerators)
{
flow.AddAction(action(plugin));
}
}
flow.AddAction(new LoadAddressablesLocalizationsAction());
// flow.AddAction(new LoadAddressablesLocalizationsAction());
foreach (var action in Loading.GeneralLoadingActions)
{
flow.AddAction(action);
}
foreach (var plugin in SpaceWarpManager.SpaceWarpPlugins)
{
flow.AddAction(new InitializeModAction(plugin));
somewhere here there's a NullReferenceException
we're loading something before the plugins
what a fucking mess wtf
[WRN 21:26:52.590] WwiseUnity: Platform specific settings cannot be found for <Windows>. Using global settings.
did this get loaded on earlier versions?
might just be that global settings is null and they're reliyng on the windows settings
yes, that is supposed to be working
this is the method that logs that
where is that method?
well gonna try commenting each line to see where the problem is 
[EXC 21:26:52.598] NullReferenceException: Object reference not set to an instance of an object AkCommonPlatformSettings.get_AkInitializationSettings () (at <e43ddaa261164e408c576121c269cf5b>:0) AkWwiseInitializationSettings.InitializeSoundEngine () (at <e43ddaa261164e408c576121c269cf5b>:0) AkSoundEngineController.Init (AkInitializer akInitializer) (at <034701ab4b354a619603fe6d965e8c00>:0) AkInitializer.OnEnable () (at <034701ab4b354a619603fe6d965e8c00>:0)
in AK.Wwise.Unity.API.dll
class AkWwiseInitializationSettings
nope
the game does during the loading
what could be the difference between 1.0.1 and 1.1.0 if we dont call it
and since SpaceWarp modifies the loading of the game, somewhere there must be some issue
there is the error message about it finding multiple of them
[WRN 14:12:54.326] WwiseUnity: There are multiple AkWwiseInitializationSettings objects instantiated; only one will be used.
didn't even see that
yeah
it makes me think that we might be going back in the flow two times some how
something gets recalled
yeah it looks that way
Also, with 1.1.0 all vessels and debris are prefixed with a 'CelestialBody/'. I don't think that was intentional.
lmao
