Min DLLs to load for runtime only

I am porting the game into XboxOne and I would like to minimize the dlls that A* project plugin loads, if possible.

This is to reduce initial loading time which is very tight, so if there are any dlls that I can safely ignore, not load please let me know. Also if there are dlls that can be ignored, how can I do this? Delete them from the project?

Currently I think these dlls are related to a* project plugin.

Pathfinding.ClipperLib.dll
Pathfinding.Ionic.Zip.Reduced.dll
Pathfinding.Poly2Tri.dll
poly2tri.dll
Pathfinding.JsonFx.dll

there could be others…

HELP!

Hi

This depends on the graph type that you are using, which one are you using?
In my dev version I have actually written a really tiny json serializer/deserializer to replace the JsonFx library, I could send you a bleeding edge build if you want. The zip library can be removed by following the instructions here: http://arongranberg.com/astar/docs/iphone.php (in particular the ASTAR_NO_ZIP part).

I am only using Recast graph. Thanks.

Ok. In that case the above is what you can do. The poly2tri dll is required.
I am not sure why you have 2 poly2tri dll files however? Maybe one of them has been left behind after an upgrade? You should be able to delete one of them, probably the poly2tri.dll file.

Thanks… phew! resetting all the graph values will take some time, but…

when I hit apply for optimization , I get :

PlayerSettings Validation: Requested build target group (0) doesn’t exist; #define symbols for scripting won’t be added.
UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroup(BuildTargetGroup, String)
Pathfinding.OptimizationHandler:EnableDefine(String) (at Assets/AstarPathfindingProject/Editor/OptimizationHandler.cs:53)
Pathfinding.OptimizationHandler:ApplyDefines(List`1) (at Assets/AstarPathfindingProject/Editor/OptimizationHandler.cs:128)
AstarPathEditor:DrawOptimizationSettings() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:621)
AstarPathEditor:DrawMainArea() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:565)
AstarPathEditor:OnInspectorGUI() (at Assets/AstarPathfindingProject/Editor/AstarPathEditor.cs:317)
UnityEditor.DockArea:OnGUI()

PlayerSettings.SetScriptingDefineSymbolsForGroup ((BuildTargetGroup)buildTypes[i], defineString);

My version is 3.7.4 IS this is problem?

Hi

Yeah I am pretty sure Unity changed the way the build target groups were handled at some point. I fixed it some point after 3.7.4.

Ok, SO… I have done a quick test after upgrading to the latest version.

After few tweaks to take care of the changes, I was able to load the level but I get two errors like this :

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[Pathfinding.Poly2Tri.TriangulationPoint,System.Int32].get_Item (Pathfinding.Poly2Tri.TriangulationPoint key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
Pathfinding.Util.TileHandler.CutPoly (Pathfinding.Int3[] verts, System.Int32[] tris, Pathfinding.Int3[]& outVertsArr, System.Int32[]& outTrisArr, System.Int32& outVCount, System.Int32& outTCount, Pathfinding.Int3[] extraShape, Int3 cuttingOffset, Bounds realBounds, CutMode mode, Int32 perturbate) (at Assets/AstarPathfindingProject/Generators/Utilities/TileHandler.cs:809)
Pathfinding.Util.TileHandler+c__AnonStorey221.<>m__2F (Boolean force) (at Assets/AstarPathfindingProject/Generators/Utilities/TileHandler.cs:1215)
AstarPath.ProcessWorkItems (Boolean force) (at Assets/AstarPathfindingProject/Core/AstarPath.cs:1039)

I also get :

Assets/AstarPathfindingProject/Core/Serialization/JsonConverters.cs(3,33): error CS0234: The type or namespace name JsonFx' does not exist in the namespacePathfinding.Serialization’. Are you missing an assembly reference?

When I try to build windows stand alone build…

This is after following the instruction to not use zip and json stuff you have mentioned above.

I have deleted the dlls and the added compiler options.

– Edit –

I have commented out using jsonfx line from JsonConverters and it seems to build! Perhaps this needs a fix in your side as well?

Yeah seems to be a line of code that I had forgot to wrap in #if !ASTAR_NO_JSON.
In my dev version that whole file has been removed, so it should not cause any troubles in future versions.

I think that may be a bug in a 3rd party library that I am using. I have encountered it on a few rare occasions, but I haven’t been able to track down why it is happening. I have no idea why that would start to happen because of these changes, but try to just tweak a setting a tiny bit, you have probably encountered an edge case.

This doesn’t seem to break the game, so can we change it so that it is not logged as error? or warning? Or how do I capture it so that I can ignore it?

Hi

I am pretty sure it should break something. I would expect it would cause one tile to not be updated or generated at all.

What you could do is open the TileHandler.cs file (sorry about the messiness of the code in that file…), find the try, catch which looks like this

try {
    P2T.Triangulate(pl);
} catch (Poly2Tri.PointOnEdgeException) {

The for loop after that try, catch is what I think throws the exception, you can move that for loop inside the try group and change the

catch (Poly2Tri.PointOnEdgeException)

to

catch (System.Exception)

That will make it retry the cut with slightly moved navmesh cuts.

Like this?

try {

							P2T.Triangulate(pl);
							
							for (int i = 0; i < pl.Triangles.Count; i++) {
								Poly2Tri.DelaunayTriangle t = pl.Triangles[i];
	#if ASTARDEBUG
							Debug.DrawLine(Point2D2V3(t.Points._0), Point2D2V3(t.Points._1), Color.red);
							Debug.DrawLine(Point2D2V3(t.Points._1), Point2D2V3(t.Points._2), Color.red);
							Debug.DrawLine(Point2D2V3(t.Points._2), Point2D2V3(t.Points._0), Color.red);
								
							Debug.DrawLine((Vector3)outverts[point2Index[t.Points._0]]+Vector3.up*0.1f, (Vector3)outverts[point2Index[t.Points._1]]+Vector3.up*0.1f, Color.blue);
							Debug.DrawLine((Vector3)outverts[point2Index[t.Points._1]]+Vector3.up*0.1f, (Vector3)outverts[point2Index[t.Points._2]]+Vector3.up*0.1f, Color.blue);
							Debug.DrawLine((Vector3)outverts[point2Index[t.Points._2]]+Vector3.up*0.1f, (Vector3)outverts[point2Index[t.Points._0]]+Vector3.up*0.1f, Color.blue);
	#endif
								
							//Add the triangle with the correct indices (using the previously built lookup table)
								outtris.Add(point2Index[t.Points._0]);
								outtris.Add(point2Index[t.Points._1]);
								outtris.Add(point2Index[t.Points._2]);
							}
							
						} catch (System.Exception e) {
							Debug.LogWarning("PointOnEdgeException, perturbating vertices slightly ( at "+cmode+" in " + mode +")");

Yes, something like that I think.

(I haven’t tried this myself, but that looks correct)