sashakoshka / m4kc

Minecraft 4k: decompiled, translated to C using SDL for graphics and input, and improved upon
78 stars 8 forks source link

Attempt to fix tree generation #12

Closed Tempetas closed 2 years ago

Tempetas commented 2 years ago

I am not sure about what the purpose of those heightmap checks was, but from what I've seen removing them seems to fix the issue

sashakoshka commented 2 years ago

The check is to remove redundant work. If the heightmap falls below or above the current chunk, then the structure cannot generate.

If there is no check, the game will attempt to generate structures out of bounds, which is entirely safe (World_setBlock has bounds checking), but it causes a bunch of unnescesary checks which might slightly effect world gen performance.

However, I think that putting the bounds checking within genStructure is a better idea so I will merge this and then probably redo them in there. The checks themselves just seem to be broken.

Tempetas commented 2 years ago

Oh! Makes sense, thank you