Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introducing a new type of seed for star systems.
The old system
Before this update, star system seeds were a single number that would be used to generate procedurally its celestial body. While this worked, it didn't account for the position of the starsystem in the starmap.
To allow loading any system at any time while retaining the ability to use the starmap properly, a new system was needed to recover the starmap position from the system seed.
One approach could have been a 4D space filling curve that takes the coordinates in the starmap (a 3d sector coordinate and a 1d index inside the sector). This would lead to a loss of precision so I chose a simpler solution
The new system
Instead of using a simple 64bit float for the seed, I store the star sector coordinates of the system as 3 64bit floats (that would be integers if that was possible in JS) and the index of the system inside the sector as another 64bit float.
This 4 values are then hashed to get a simple float that is used to seed the rng of the system.
This allows to easily use the coordinates of the system in the starmap, ensuring the starmap is always following the player anywhere it spawns in the universe.
Breaking changes
As a consequence, the old urls generated by the "share" button no longer work.
A new URL scheme has been created where the 4 seed components have to be passed as
starMapX
,starMapY
,starMapZ
andindex
.bodyIndex
can also be passed as an argument to specify the celestial body the player starts near to.