NavData Serialization Different Every Run

Hi there,

When I load navdata from binary, then serialize it again, it will be the same length, but the binary is different.

Why is this not deterministically the same constantly?


I think I had trouble getting the libraries that I use to generate binary identical outputs. I think a timestamp is added somewhere. My code uses its own checksum to see if anything has changed, and that works perfectly well.
In some cases if you load the data if some other graphs have already been loaded before, the nodes may end up getting different node IDs, which would change the data as well.

Is there any reason you need it to be binary identical?

We’d like to load from data, and this is causing them to be caught by source control every single time a person serializes the mission.

I’m going to have rewrite this, I guess. Thanks for the info Aron!

I just wrote some unit tests to test that the checksum would be the same on two separate AstarPath instances with identical binary input for the data. It is not the same. It seems like the serialization here is wholly nondeterministic. I’m going to implement it such that it is unless you can help me see what I’m missing with the checksum itself.

Huh. Would you mind posting the unit test code here?

I can’t share the code exactly, but I can write up some example code on pastebin. Give me like 5 minutes!

Here’s a very quick pseudocode break down.

Are you serializing raw floating point numbers?

I am. It’s a binary serialization though, so that should be fine.

Yeah I agree, but I can verify it isn’t fine :frowning:. I think I may have done something to cause that in my refactoring.

I’m going to write our own. Is there any reason you didn’t take an out of the box JSON solution that I am missing?