goatfungus / NMSSaveEditor

No Man's Sky - Save Editor
1.91k stars 240 forks source link

Base computer moving artifacts #200

Open jeffswt opened 5 years ago

jeffswt commented 5 years ago

I moved the base computer to a beacon 1000u away.

Everything in the original place were elevated for dozens of metres up into the sky.

I sense this has something to do with the spherical world. Is there any way to fix this?

image

EDIT: A simple schematic

image


Reproduction steps:

  1. Build a base computer and register the base.
  2. Build a beacon sufficiently far away. The farther the beacon is the more significant the bug will be.
  3. Use the save editor to move the base computer to the beacon.
  4. Return to the game and the beacon will appear in the sky. (The base computer will stay on the ground, though)
goatfungus commented 5 years ago

Wow... that is weird. It is most likely because of the world shape, and also because of the issues with imprecise floating point numbers in the calculation. Not really much we can do about that as every situation would be different.

I wonder if a backup of the previous base could be restored to the new location instead?

jeffswt commented 5 years ago

The farther you get from the original base, the larger the elevation difference you get after you move the base. I checked the vectors you modified, and there aren't supposed to be any problems -- if (and only if) you are working on a flat surface.

And you would get your base restored if you move back the base computer (swap back). So i suggest that there should be few to do with FP errors.

I'm trying to come up with a prototype of a moving algorithm that at least fixes the problem partially. But there are still a few things to consider:

EDIT: When I edited my base the actual build limit was between [1002, 1003)u and not 1000u. I suspect that, the actual base build limit was calculated in euclidean distance, between the point the person was standing and the base computer, while the distance shown on the Analysis Visor was the length of the arc on the sphere connecting the two points. That might explain this problem.

ukmerlin commented 5 years ago

I had a problem with mod parts not lining up with the rest of my base so I used Blender to slide it all back where it belonged. A simple height translation ought to be easy enough to do.

jeffswt commented 5 years ago

The question is, how are the objects stored? It should be apparent that, if the objects are all stored in a Cartesian plane, such issues would not have happened. From the position values we can also infer that it is not stored in a polar plane. Then how could this happen?

jeffswt commented 5 years ago

UPDATE: Position kept where they were after moving the base away for 1000+ metres. But relative angles are a bit strange and I'm still trying to fix them.

image

jeffswt commented 5 years ago

UPDATE AFTER 10 MINS: Sorry I forgot to delete the return before the file saver.

Now everything is working. I'll release the code after I figure out how to switch the base computer and the beacon safely. Still the base computer moved 1000u away.

Pic below:

image

jeffswt commented 5 years ago

https://github.com/jeffswt/no-mans-save-py/commit/f2ea730d

This can be incorporated into your code seamlessly with minor (language) modifications. I would be grateful if you attribute my work. Won't be a problem if you don't. It's just an idea.

Hope it'll be a quick fix.