Hugobros3 / chunkstories

Somewhat fancy blocky game engine written in Kotlin
http://chunkstories.xyz
Other
222 stars 10 forks source link

generate chunks receding from the player's position #6

Closed landru27 closed 6 years ago

landru27 commented 6 years ago

This is for issue #5

Hugobros3 commented 6 years ago

Way better, changing the API was indeed unnecessary. Reviewing the code, I think we can do better yet and keep all the direction-aware logic in HeightmapImplementation (and TaskGenerateWorldSlice ) : I add the worldUser after I create the heightmap object, but in it's unsaid invariant, HeightmapImplementation really requires it's set of users to be not empty (as it unloads and thus eventually destroys itself when users.size() reaches zero after deregistering an user).

With hindsight, the better way to do this would have been to just give worldUser to the HeightmapImplementation constructor and have all the fancy loading tricks shoved in there. I'll pull your master branch and try to do it myself ( and also fix the embarrassing typo in acquire ).

Hugobros3 commented 6 years ago

I've done just that