Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Seed System #7

Merged
merged 5 commits into from
Jan 9, 2024
Merged

New Seed System #7

merged 5 commits into from
Jan 9, 2024

Conversation

BarthPaleologue
Copy link
Owner

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 and index. bodyIndex can also be passed as an argument to specify the celestial body the player starts near to.

The star system knows where it is at all times. It knows this because it knows where it isn't. By subtracting where it is from where it isn't, or where it isn't from where it is (whichever is greater), it obtains a difference, or deviation. The guidance subsystem uses deviations to generate corrective commands to drive the star system from a position where it is to a position where it isn't, and arriving at a position where it wasn't, it now is. Consequently, the position where it is, is now the position that it wasn't, and it follows that the position that it was, is now the position that it isn't. In the event that the position that it is in is not the position that it wasn't, the system has acquired a variation, the variation being the difference between where the star system is, and where it wasn't. If variation is considered to be a significant factor, it too may be corrected by the GEA. However, the star system must also know where it was. The star system guidance computer scenario works as follows. Because a variation has modified some of the information the star system has obtained, it is not sure just where it is. However, it is sure where it isn't, within reason, and it knows where it was. It now subtracts where it should be from where it wasn't, or vice-versa, and by differentiating this from the algebraic sum of where it shouldn't be, and where it was, it is able to obtain the deviation and its variation, which is called error.
@BarthPaleologue BarthPaleologue added the enhancement New feature or request label Jan 9, 2024
@BarthPaleologue BarthPaleologue merged commit 1c6d6c1 into main Jan 9, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant