Revolutionary-Games / Thrive

The main repository for the development of the evolution game Thrive.
https://revolutionarygamesstudio.com/
Other
2.78k stars 495 forks source link

Exiting early multicellular crash with System.ArgumentException: CellTemplate can't be placed at this location #4635

Open hhyyrylainen opened 9 months ago

hhyyrylainen commented 9 months ago

With a specific cell layout it is possible to get the following error:

System.ArgumentException: CellTemplate can't be placed at this location

  at HexLayout`1[T].Add (T hex) [0x00022] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at EarlyMulticellularSpecies.Clone () [0x00040] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at AutoEvo.GenerationRecord.UpdateSpeciesData (Species species) [0x00021] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at CreatureStageBase`2[TPlayer,TSimulation].OnReturnFromEditor () [0x00058] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at MicrobeStage.OnReturnFromEditor () [0x00014] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at EditorBase`2[TAction,TStage].OnEditorExitTransitionFinished () [0x0009f] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at EarlyMulticellularEditor.OnEditorExitTransitionFinished () [0x00007] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at TransitionManager+Sequence.StartNext () [0x00094] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at TransitionManager+Sequence.Process () [0x00087] in <059a6e8017b947d18ebf2446d1e30318>:0 

  at TransitionManager._Process (System.Single delta) [0x00019] in <059a6e8017b947d18ebf2446d1e30318>:0 

Seems like the editor causes a cell layout to be created which when duplicated detects that some of the cells actually overlap in the created layout. Probably need to adjust how the cell layout is adjusted after exiting the editor (at least a safety check there anyway to make sure incorrect layouts can't be created would be good).

Edit: here's a cell layout that triggers the bug:

screenshot

that is from this report: https://community.revolutionarygamesstudio.com/t/crash-upon-leaving-multicellular-freebuild-editor/7063

hhyyrylainen commented 4 months ago

Looks like this bug can still happen:

USER ERROR: System.ArgumentException: CellTemplate can't be placed at this location
   at HexLayout`1.AddFast(T hex, List`1 temporaryStorage, List`1 temporaryStorage2) in /home/hhyyrylainen/Projects/Thrive/src/general/HexLayout.cs:line 73
   at EarlyMulticellularSpecies.Clone() in /home/hhyyrylainen/Projects/Thrive/src/early_multicellular_stage/EarlyMulticellularSpecies.cs:line 144
   at AutoEvo.GenerationRecord.UpdateSpeciesData(Species species) in /home/hhyyrylainen/Projects/Thrive/src/auto-evo/records/GenerationRecord.cs:line 74
   at CreatureStageBase`2.OnReturnFromEditor() in /home/hhyyrylainen/Projects/Thrive/src/general/base_stage/CreatureStageBase.cs:line 184
   at MicrobeStage.OnReturnFromEditor() in /home/hhyyrylainen/Projects/Thrive/src/microbe_stage/MicrobeStage.cs:line 601
   at EditorBase`2.OnEditorExitTransitionFinished() in /home/hhyyrylainen/Projects/Thrive/src/general/base_stage/EditorBase.cs:line 863
   at EarlyMulticellularEditor.OnEditorExitTransitionFinished() in /home/hhyyrylainen/Projects/Thrive/src/early_multicellular_stage/editor/EarlyMulticellularEditor.cs:line 407
   at TransitionManager.Sequence.StartNext() in /home/hhyyrylainen/Projects/Thrive/src/gui_common/TransitionManager.cs:line 289
   at TransitionManager.Sequence.Process() in /home/hhyyrylainen/Projects/Thrive/src/gui_common/TransitionManager.cs:line 259
   at TransitionManager._Process(Double delta) in /home/hhyyrylainen/Projects/Thrive/src/gui_common/TransitionManager.cs:line 43
   at Godot.Node.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
   at Godot.Control.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
   at TransitionManager.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /home/hhyyrylainen/Projects/Thrive/Godot.SourceGenerators/Godot.SourceGenerators.ScriptMethodsGenerator/TransitionManager_ScriptMethods.generated.cs:line 88
   at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** args, Int32 argCount, godot_variant_call_error* refCallError, godot_variant* ret)
   at: void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (:0)

Edit: any new info on what kind of cell layouts can cancel this would be excellent information.