Mapgen issues for folliage and water #3617

Open
opened 2023-04-01 02:17:45 +02:00 by ancientmarinerdev · 2 comments

MineClone2 version: master

What happened?

When profiling flying with an Elytra, mapgen was quite slow. After adding some functions:

MineClone2/MineClone2#3614

to help debug this profiling highlighted issues with this. Setting water palette was over 16%. Folliage colour searching and setting was 6.2%. Set grass palette was 2.7%. Fixing seagrass is 2.66%.

Another issue is these are limited to overworld only, so in nether, and end, they will still search and there is still a cost for that.

Water, and folliage are the big two, of course, but we need to think about why we need these. For example, seagrass, now you've set the correct param2, is the generator even needed?

@FossFanatic I think the approach to this needs to be reconsidered. I think VoxelManip may be more appropriate for this:

https://minetest.gitlab.io/minetest/lua-voxel-manipulator/

What should happen:

This should be more performant.

Steps to reproduce

Profile and fly and elytra.

MineClone2 version: master ### What happened? When profiling flying with an Elytra, mapgen was quite slow. After adding some functions: https://git.minetest.land/MineClone2/MineClone2/pulls/3614 to help debug this profiling highlighted issues with this. Setting water palette was over 16%. Folliage colour searching and setting was 6.2%. Set grass palette was 2.7%. Fixing seagrass is 2.66%. Another issue is these are limited to overworld only, so in nether, and end, they will still search and there is still a cost for that. Water, and folliage are the big two, of course, but we need to think about why we need these. For example, seagrass, now you've set the correct param2, is the generator even needed? @FossFanatic I think the approach to this needs to be reconsidered. I think VoxelManip may be more appropriate for this: https://minetest.gitlab.io/minetest/lua-voxel-manipulator/ ### What should happen: This should be more performant. ### Steps to reproduce Profile and fly and elytra.
ancientmarinerdev added the
bug
unconfirmed
labels 2023-04-01 02:17:45 +02:00
ancientmarinerdev added
#P2: HIGH
performance
and removed
unconfirmed
labels 2023-04-01 03:56:26 +02:00

The reason for the higher impact from foliage, water, and seagrass is because for those three, I used a different method of applying the param2, which is about three times slower than the VoxelManip method which the grass seems to currently use.

Making those three things use the VoxelManip method could speed things up by a factor of three.

The reason I didn't use VoxelManip, was because I wanted to get the basics out of the way first, not to mention that VoxelManip is very difficult to use.

I should give this another try, though, since the loading times do indeed seem very slow for flying with the elytra.

The reason for the higher impact from foliage, water, and seagrass is because for those three, I used a different method of applying the `param2`, which is about three times slower than the VoxelManip method which the grass seems to currently use. Making those three things use the VoxelManip method could speed things up by a factor of three. The reason I didn't use VoxelManip, was because I wanted to get the basics out of the way first, not to mention that VoxelManip is very difficult to use. I should give this another try, though, since the loading times do indeed seem very slow for flying with the elytra.
Author
Owner

The reason for the higher impact from foliage, water, and seagrass is because for those three, I used a different method of applying the param2, which is about three times slower than the VoxelManip method which the grass seems to currently use.

Making those three things use the VoxelManip method could speed things up by a factor of three.

The reason I didn't use VoxelManip, was because I wanted to get the basics out of the way first, not to mention that VoxelManip is very difficult to use.

I should give this another try, though, since the loading times do indeed seem very slow for flying with the elytra.

Fair point. It does seem a bit trickier. I think there is a VoxelManip in the codebase that could be used as a reference point.

Thanks for taking feedback on board. I hasn't realised the impact until I did some profiling. I have a PR in for moving the code to functions called by the generator. You're free to build on that or can start again and I'll close that:

https://git.minetest.land/MineClone2/MineClone2/pulls/3614/files

Either way is fine. As long as I can profile and understand the results, I am happy.

> The reason for the higher impact from foliage, water, and seagrass is because for those three, I used a different method of applying the `param2`, which is about three times slower than the VoxelManip method which the grass seems to currently use. > > Making those three things use the VoxelManip method could speed things up by a factor of three. > > The reason I didn't use VoxelManip, was because I wanted to get the basics out of the way first, not to mention that VoxelManip is very difficult to use. > > I should give this another try, though, since the loading times do indeed seem very slow for flying with the elytra. Fair point. It does seem a bit trickier. I think there is a VoxelManip in the codebase that could be used as a reference point. Thanks for taking feedback on board. I hasn't realised the impact until I did some profiling. I have a PR in for moving the code to functions called by the generator. You're free to build on that or can start again and I'll close that: https://git.minetest.land/MineClone2/MineClone2/pulls/3614/files Either way is fine. As long as I can profile and understand the results, I am happy.
ancientmarinerdev added this to the 0.83.0 - Safe and Sound milestone 2023-04-04 21:07:01 +02:00
Ghost modified the milestone from 0.83.0 - Safe and Sound to 0.84.0 - Very Nice 2023-04-15 22:50:32 +02:00
ancientmarinerdev added
#P3: elevated
and removed
#P2: HIGH
labels 2023-04-16 23:29:52 +02:00
ancientmarinerdev modified the milestone from 0.84.0 - Very Nice to 3 - Near future 2023-04-16 23:29:55 +02:00
ancientmarinerdev added the
#Review
label 2023-05-11 14:42:59 +02:00
ancientmarinerdev removed this from the 3 - Near future milestone 2023-05-11 14:43:13 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#3617
No description provided.