-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Option to make sky stars deterministic #16529
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
Conversation
|
Seems to me much better than having them decided randomly based on the player |
|
Idea for a maybe better design: Add a seed param to player:set_sky, with a missing seed defaulting to current behavior. Benefits: Can hide map seed from clients, can choose game-specific seed distinct from world seed per player, backwards compat (does it matter?) is kept. |
45355b5 to
3c5df72
Compare
|
PR is updated with appgurueu's design and ready for review again |
3c5df72 to
dcec022
Compare
|
PR is updated with appgurueu's recommendations and ready for review again |
dcec022 to
aa4a425
Compare
|
yes, thank you for your patience with me! updated. |
|
I planned to implement this in the future. So I support it. |
sfence
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to update l_get_stars function in l_object.cpp file.
It should return the actual value of star_seed, as described in lua_api.md.
aa4a425 to
5aedaec
Compare
|
updated with sfence's recommendation last week, ready for review 🙏 |
appgurueu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one small thing, otherwise this looks fine :)
sfence
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine.
|
Question to consider: Should |
No, since this is a client feature. |
5aedaec to
7b96624
Compare
|
updated setStarSeed as per appgurueu's recommendation. ready for final review! |
|
stopped force pushing and squashing until the review is over, cause the lack of history is what confused me in the last commit i think. thank you for your patience, ready for review. |
4920e89 to
e78a3c9
Compare
|
not sure how idiomatic my latest change is, but it works. ready for review. p.s. also added set_stars and set_stars 0 to https://gitea.your-land.de/fetsorn/consistent_stars for testing. |
| void Sky::setStarSeed(u64 star_seed) | ||
| { | ||
| // Allow force updating star seed at game init. | ||
| if (m_star_params.star_seed != star_seed || m_first_update) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I don't think the || m_first_update is necessary. setStarCount already calls updateStars() on the first update; if the star_seed is unchanged, there's nothing to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alright! If you say so :) I copied || m_first_update from setStarCount thinking that it's a typical setter, but turns out setStarCount is a special case which I do not completely understand yet. o.0 Does setStarCount check m_first_update because it is called in Sky constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does setStarCount check m_first_update because it is called in Sky constructor?
Basically. Something needs to call updateStars the first time, and setStarCount does that.
This could probably be refactored, but we can do that later.
In either case it's not a problem.
appgurueu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, works as expected.
I have a nitpick, but it is not blocking.
sfan5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
Goal of this PR is to make a consistent night sky.
Solves #16521.
The star constellations are now based on a seed passed in StarParams.
This is a patch I play with personally.
Relates to a larger plan for sky layers outlined in #11366.
Ready for Review
How to test