NavData Serialization Different Every Run


#1

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?


#2

Hi

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?


#3

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!


#4

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.


#5

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


#6

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


#7

Here’s a very quick pseudocode break down.

https://pastebin.com/1NcUMC3g


#8

Are you serializing raw floating point numbers?


#9

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


#10

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?