itsapi / pycraft

A Minecraft-inspired game for the terminal
GNU General Public License v2.0
198 stars 21 forks source link

Mobs lighting #138

Closed geraintwhite closed 7 years ago

geraintwhite commented 7 years ago

Only spawn mobs in darkness. This will need to be reworked to create the lighting buffer separately from the render process, and to support the Python renderer.

136

geraintwhite commented 7 years ago

You can't approve it yet...

olls commented 7 years ago

I didn't mean to start a review

olls commented 7 years ago

We will have to generate a larger lighting buffer on the server if we want to keep the same spawning range as we currently have. To support this better, and to prevent having to pass offsets everywhere, we should probably store the coordinates of the lighting buffer inside it.

olls commented 7 years ago

I think the lighting map will have to be generated in the LocalInterfaces, this means clients can generate one for the size of the window, and a server generates one the size of the mob spawn range.

I'm not sure whether the server lighting map generation should be done in the LocalServerInterface or the Game.

olls commented 7 years ago

Currently the mobs can spawn anywhere in the server's loaded map, we can't generate a lighting buffer for the entire map as it is too big and not continuous. To fix this we could only spawn mobs within a range of each player and generate lighting buffers for each one, one at a time. This might be too slow though, maybe we should put mob spawning into a background thread...

olls commented 7 years ago

Mob spawning is correctly working with the lighting now. The only other thing we might want to do is tweak the spawning conditions a bit.

olls commented 7 years ago

And compatibility with the Python renderer