Skip to content
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.

Create a system to generate chunks in another thread #57

Closed
LukasKalbertodt opened this issue Jul 23, 2016 · 1 comment
Closed

Create a system to generate chunks in another thread #57

LukasKalbertodt opened this issue Jul 23, 2016 · 1 comment

Comments

@LukasKalbertodt
Copy link
Member

LukasKalbertodt commented Jul 23, 2016

Currently our application is single threaded. Probably the heaviest/slowest operation that has nothing to do with graphics is the generation or loading of Chunks (calling ChunkProvider::load_chunk()). This would be a good candidate to transfer to another thread to avoid blocking the render loop.

As @jonas-schievink mentioned, it's probably the easiest and (therefore) best to use to channels to send the "pls-load-this-chunk-pos" to the other thread and the Chunks back to the main thread. The main thread then integrates all new chunks into the world's chunk map and creates the corresponding chunk view (related to #55).

This is also related to #56 as the world must be read by different parts of the program (player physics, WorldView, ...) but we still need to mutate the world at some point. As suggested in the linked issue, we could wrap the world into an RwLock and then be careful to only write lock the world at one specific point such that locking never blocks (maybe?).

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

No branches or pull requests

2 participants