A* Pathfinding Project

Is there a way to save graph data using a custom serializer?


I’m not sure what binary serializer it uses by default, but the caches are very large. Is it using BinaryFormatter? Is there any way to use the serializer I’m using internally to bring the graph size down? I would do it programmatically so no need for editor support.



The caches are serialized using a custom binary format and then zipped, so I think it’s hard to bring the size down.
What are your graph settings?


I’m just using the default settings from the editor that includes node data. The graph data isn’t massive, but it is 100x the size of my current save file; it felt odd to have such an increase just for the graph! Either way, if it isn’t possible, it is not the end of the world. Thanks for the reply.



I mean what is your graph size?
And what is the file size that you are getting?

Have you changed anything in the Optimizations tab on the AstarPath component?


Oh, it’s 150x150 @ .25 node size. It is roughly 100kb. No, I haven’t changed any settings in optimizations. I’ve also tried .5 node size @ 50kb.

Going from Odin to Ceras decreased my save file from 50kb to 3kb, so I wanted to give it a shot at serializing the graph as well. These are all obviously small numbers in the first place, but it just felt odd to have 95% of my save solely based on the graph.


Well. That’s 150*150 = 22500 nodes in the graph that needs to be serialized.
If that’s 100kb it means each node only uses about 100000/22500 = 4.4 bytes which is pretty well compressed I would say since each node needs to store its coordinates, neighbours, penalties and other things.

Note that you can save only the settings of the graph if you are ok with scanning the graph once you load it.


Okay, thanks :smiley: