Space Engineers

Space Engineers

Merge_Tunnel
Kiithnaras 5 Nov, 2018 @ 10:02pm
Fixing The Connections
Well crap. The Nov 5th update done bjorked something. I figured it'd be best solved in a discussion rather than comments.

Existing worlds can no longer load with the mod active. I figured I'd be smart, remove the mod, load the world, save it, exit, reactivate the mod, and try testing it.

I was sadly awarded a Crash to Desktop with the following log error upon attempting to place a Merge Tunnel:


2018-11-06 00:56:41.534 - Thread: 1 -> Exception occured: System.NullReferenceException: Object reference not set to an instance of an object.
at SpaceEngineers.Game.Entities.Blocks.MyShipMergeBlock.OnAddedToScene(Object source)
at VRage.Game.Components.MyHierarchyComponentBase.AddChild(IMyEntity child, Boolean preserveWorldPos, Boolean insertIntoSceneIfNeeded)
at Sandbox.Game.Entities.MyCubeGrid.AddCubeBlock(MyObjectBuilder_CubeBlock objectBuilder, Boolean testMerge, MyCubeBlockDefinition blockDefinition)
at Sandbox.Game.Entities.MyCubeGrid.AddBlock(MyObjectBuilder_CubeBlock objectBuilder, Boolean testMerge)
at Sandbox.Game.Entities.MyCubeGrid.BuildBlock(MyCubeBlockDefinition blockDefinition, Vector3 colorMaskHsv, Vector3I min, Quaternion orientation, Int64 owner, Int64 entityId, MyEntity builderEntity, MyObjectBuilder_CubeBlock blockObjectBuilder, Boolean updateVolume, Boolean testMerge, Boolean buildAsAdmin)
at Sandbox.Game.Entities.MyCubeGrid.BuildBlocksSuccess(Vector3 colorMaskHsv, HashSet`1 locations, HashSet`1 resultBlocks, MyEntity builder, Boolean instantBuilt, Int64 ownerId)
at Sandbox.Game.Entities.MyCubeGrid.BuildBlocksRequest(UInt32 colorMaskHsv, HashSet`1 locations, Int64 builderEntityId, Boolean instantBuild, Int64 ownerId)
at VRage.Network.MyReplicationLayerBase.InvokeLocally[T1,T2,T3,T4,T5,T6,T7](CallSite`7 site, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
at VRage.Network.MyReplicationSingle.DispatchEvent[T1,T2,T3,T4,T5,T6,T7,T8](CallSite callSite, EndpointId recipient, Nullable`1 position, T1& arg1, T2& arg2, T3& arg3, T4& arg4, T5& arg5, T6& arg6, T7& arg7, T8& arg8)
at VRage.Network.MyReplicationLayerBase.RaiseEvent[T1,T2,T3,T4,T5,T6,T7](T1 arg1, T7 arg7, Func`2 action, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, EndpointId endpointId, Nullable`1 position)
at Sandbox.Game.Entities.MyCubeGrid.BuildBlocks(Vector3 colorMaskHsv, HashSet`1 locations, Int64 builderEntityId, Int64 ownerId)
at Sandbox.Game.Entities.MyCubeBuilder.Add()
at Sandbox.Game.Entities.MyCubeBuilder.HandleCurrentGridInput(MyStringId context)
at Sandbox.Game.Entities.MyCubeBuilder.HandleAdminAndCreativeInput(MyStringId context)
at Sandbox.Game.Entities.MyCubeBuilder.HandleGameInput()
at Sandbox.Game.Gui.MyGuiScreenGamePlay.HandleInput(Boolean receivedFocusInThisUpdate)
at Sandbox.Graphics.GUI.MyScreenManager.HandleInput()
at Sandbox.Graphics.GUI.MyDX9Gui.HandleInput()
at Sandbox.MySandboxGame.Update()
at Sandbox.Engine.Platform.Game.UpdateInternal()
at Sandbox.Engine.Platform.Game.RunSingleFrame()
at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass1.<Run>b__0()
at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)
at Sandbox.Engine.Platform.Game.RunLoop()
at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen)
at SpaceEngineers.MyProgram.Main(String[] args)

I'll try testing a few more times and see if I can glean anything.
Last edited by Kiithnaras; 6 Nov, 2018 @ 12:39am
< >
Showing 1-9 of 9 comments
Kiithnaras 5 Nov, 2018 @ 10:22pm 
Further testing reveals that the Merge Passage does not cause crashes while the Merge Tunnel does. Inexplicable it is.

I do apologize as the dummy rotation does not seem to be the sole issue; the Passages are still experiencing the same behavior. Hopefully some behavior will help nail things down: When I manage to get the passages to "magnetize" via gentle bumping off-axis, they slowly push each other apart to about this resting position:

https://steamuserimages-a.akamaihd.net/ugc/957473015812212389/920D80CAD15E32AB2365D19D6C1151D1FC3889C2/

It is possible to get them to actively connect by simply pushing forward, though. Fiddly, but manageable.
For reference, this is the approximate detection and resting point for the default merge blocks:

https://steamuserimages-a.akamaihd.net/ugc/957473015812212207/3C28CF683BF445489E68BD6C607FF67243DEEE01/

I do hope this helps and understand that troubleshooting things that don't work properly can be super frustrating. I also have pretty much no experience with MWM-Builder, so I'm not of much help there. I can really only provide what is intuitive (like the assumption that rotated dummies was important - maybe it was???)

The off-axis magnetism seems to behave as though the dummies are looking for a pairing merge dummy in the negative direction (or potentially some other axis?) for some strange reason, unlike the vanilla merge blocks that detect each other when each respective field overlaps the others' origin.
Ara 5 Nov, 2018 @ 11:05pm 
Literally just spent the last 2 hours trying to figure out why my server was crashing. Did everything just shy of a complete server reinstall when it was discovered that it only crashed when a certain blue print was loaded... further investigation revealed this mod to be the problem. My findings concur with Kiithnaras, only the merge tunnel seems to be the problem.
Spysteven  [developer] 6 Nov, 2018 @ 7:00am 
Do we Know if its both the large and small block varients or just one? Because the scripting hasnt changed, only the models have change and if i can work out which model. I will compare the merge tunnel and merge passage models it may just be a reference issue with the textures or a wrap issue, i Did have to tweak the model and the was some texture tearing.
Last edited by Spysteven; 6 Nov, 2018 @ 7:05am
Kiithnaras 6 Nov, 2018 @ 10:16am 
Neither of the small blocks cause crashing. Due to a bit better precision, I'm able to test on those better as well.

The small Tunnel perhaps has the most tolerable behavior: they detect each other only when off-axis a bit, but they magnetize sensibly afterward. Even without magnetism, I'm still able to get them to connect by simply lining them up and gently bumping.

https://imgur.com/a/roOnhEG
(Steam images not cooperating presently)

I am not, however, able to get the small Passage to magnetize to each other or connect at all in any circumstance - small Tunnels can magnetize to Passages, but they wont register a connection.
Spysteven  [developer] 7 Nov, 2018 @ 7:07am 
The passage and merge tunnel will magnetize to one another because of how space engineers is scripted, so we know the crash issue is related to the large tunnel varient. Ill take a look at the model and see if i can find the issue
Kiithnaras 7 Nov, 2018 @ 11:00am 
You misunderstand - The magnetization doesn't happen directly on-axis for the tunnels as it does for the vanilla merge blocks. This was the case even with the large tunnels in my experience. I've always had to maneuver connecting tunnels off-axis, approximately center-to-edge, in order to trigger the magnetization. However, with the exception of the Large Passage merging, this magnetization has always brought the blocks to rest in a sensible manner and allows for easy connection once it is triggered.

Even so, the current connection behavior of the Small Tunnels is tolerable even without the magnetization directly center-to-center, so it isn't a huge deal for them.

Small Passages just don't magnetize and don't connect at all as far as I've tested.
Last edited by Kiithnaras; 7 Nov, 2018 @ 11:00am
Spysteven  [developer] 7 Nov, 2018 @ 2:55pm 
Thats really frustrating, because as i said when comparing the scripts to whats availible to space engineers mod sdk and even other mods the script is exaxtly the same. theres very little i can do with the magnetization.

The only option i can think of to improve the situation is to perhaps increase the size of the empties and see if that effects the range of detection. Now theres been no post yet but has the current update fixed the crashes?
Kiithnaras 7 Nov, 2018 @ 3:58pm 
Eureka! I've solved it (probably 95% sure).

Blocks no longer cause crashes at all - any of them. Great times.

It is not the rotation of the Dummies, nor the positioning or overlap relative to each other (contrary to my previous assumptions and assertions), based on what I've been able to discern from testing; the merge dummies are looking for the *physical model/collision mesh* of another merge block in order to trigger their magnetism. As soon as the dummy overlaps with the opposing tunnel model, THEN the magnetism triggers.

The vanilla blocks obviously are not hollow tubes, and this explains why I had to offset my docking approaches center-to-edge of the merge tunnels. Obviously, making a solid entity in the center of the merge tunnel would sort of defeat its purpose. However, making the merge dummies *wider*, not longer, to approximately 80-90% of the width of the tunnels, should do the trick and make them function without significant issue.
Last edited by Kiithnaras; 7 Nov, 2018 @ 3:59pm
Spysteven  [developer] 7 Nov, 2018 @ 6:05pm 
Glad to hear the success
< >
Showing 1-9 of 9 comments
Per page: 1530 50