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

Incomplete trees and lighting issue #41

Closed
Unarelith opened this issue Feb 15, 2020 · 1 comment
Closed

Incomplete trees and lighting issue #41

Unarelith opened this issue Feb 15, 2020 · 1 comment

Comments

@Unarelith
Copy link
Owner

Unarelith commented Feb 15, 2020

It's possible to see cut trees, and this problem is fixed when disconnecting/reconnecting to the server.

This issue is caused by a bad chunk update. When a tree generates on chunk A, it could generate on chunk B too. If chunk B isn't sent again when chunk A generates the tree, the client will not be able to see the complete tree. (Fixed by b2fd4e6)

Another problem, maybe related but isn't fixed by reconnecting to the server, is the sunlight. The trees can be completely lit on one side, and not lit at all on another side.

@Unarelith Unarelith changed the title Issues with trees Incomplete trees and lighting issue Feb 15, 2020
@Unarelith
Copy link
Owner Author

Note about 7793e2e: with this temporary fix, the client will wait all the neighbours of a chunk to be loaded before building its mesh. This causes two problems:

  • If the chunk is viewed from the outside (eg. from an unloaded chunk), it will look hollow
  • The generation looks slower

I had to do this because each time a chunk is received, all the neighbours needs to be reloaded to avoid unnecessary faces between them. And this process is slow, because for each chunk, there will be at least 7 mesh building (one when it's received, and one per neighbour).
This process was ok before b2fd4e6, but since this commit adds even more mesh building (because of trees), the game became quite slower.

Though, this fix won't be necessary anymore if I optimize mesh building.

On another topic, the lighting issue has been temporary fixed by c652233

I won't spend more time on this for now, so I'm closing it temporarily.

The main problem with that bug, is that the light is first propagated in chunk A, then the tree is generated from B to A, then the light is propagated into B.
Since the light has already been propagated into A, it won't be updated after B generates the tree.

It's possible to wait that all neighbours are generated to propagate the light and send the chunk, however this takes way too much time because worldgen is slow af. Maybe using multithreading for worldgen will make that solution viable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant